Recovering from breaking update (cannot load certificate) #3349
Replies: 5 comments 3 replies
-
Nginx proxy manager should handle this automated, as this can stop a whole production server. |
Beta Was this translation helpful? Give feedback.
-
So I had to follow your procedure after manually saving a dying server. I moved all docker-compose.yml files manually from Server A to Server B with a flash drive and also made sure to copy all of the docker volumes. In my docker-compose.yml I have the following volumes for NPM:
I think that I copied everything with sudo rsync but I'm not 100% sure. Anyways, my folders in /media/raid/docker/docker/nginx-manager/letsencrypt/live/npm-x/ were empty. So maybe I did not use sudo for copying and I did not have access to those subfolders, so they were left empty while copying. Anyway, I also agree that NPM should have the ability to recover from such an event and be able to continue without these files. It should not handle this error with not starting. |
Beta Was this translation helpful? Give feedback.
-
Thanks for this guide ! |
Beta Was this translation helpful? Give feedback.
-
@lorenzopicoli thank you so much! Fortunately I had bind mounts for the folders, but NPM was looking for npm-2 when I only had npm-1. I renamed npm-1 to npm-2, and then it was looking for npm-1! I copied npm-2 and renamed it npm-1 and no more errors. What a relief! I spent all night trying to figure this out. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot @lorenzopicoli, you rock! Your post saved me lots of time, as I was struggling with Thanks again! |
Beta Was this translation helpful? Give feedback.
-
Update: I think this happens if you forgot to set the letsencrypt folder as a volume and tried to upgrade to another version
You might be seeing an error like this this:
The bad news is that you may have lost your SSL certificates: https://github.com/NginxProxyManager/nginx-proxy-manager/releases/tag/v2.10.4
If you don't have a snapshot of your docker container you just lost all of your SSL certificates.
This error message is happening because the services tries to read from these files (that were probably there at some point) on startup and when it doesn't find it, it can't start.
Now the good news is that I managed to get it working and I'll try to explain what I did here.
Update docker compose
In your docker compose file, create a new volume. This is the change that broke your installation. Your volumes section should look like this:
Make sure that is done, the image tag is updated to whatever version you were trying to upgrade to. Now go ahead and restart the docker container.
Get the server to start
Now to get the server to start, we'll create the folders that it expects to exist. You lost the SSL certs so you can't fully recover those files, but we can put some dummy information in there to get the server to start.
``
Now in another terminal window, get the logs from the container:
You should see something like this:
The important part of this message is the
npm-x
part.Keep this window open. Now back to the previous window, run
mkdir npm-x
where x is the same number you see in the logs.As soon as you answer the questions you should see that the error message is gone on the other terminal window. If it's not gone it should have at least changed to another
npm-y
folder. Duplicate the folder for each and every folder that the server throws an error for. I had to do it for 20 folders.Once you get to a point where all the folders are back in place you'll see:
Server started
which means you should have access to the web ui again.Getting certificates again
Now to get your certificates back, go to the SSL tab and delete all your old entries, they are gone. Re generate all of your certificates.
You MUST go back to the hosts tab and for each one of them go on edit and make sure that your NEW SSL certificate is selected otherwise it won't work
Cleaning up
Now go back in the container and run
ls -halt
in the/etc/letsencrypt/live
folder. You will be able to see the folders and when they were created. Simply delete the ones that you created initially. I recommend you cd into each one of them and make sure it only containsprivkey.pem
andfullchain.pem
, if it contains other information like a README file, don't delete the folder.If you screw up and delete something you shouldn't, you can see which host was affected by installing sqlite and checking the DB in
sqlite3 /data/database.sqlite
withselect id, domain_names from certificate WHERE is_deleted = 0;
.Making sure it all works
Restart the pod and make sure it starts properly
Beta Was this translation helpful? Give feedback.
All reactions