Migrating Servers

I migrated an NGINX reverse proxy server with many letsencrypt certificates on it. It's a largely undocumented task, and there wasn't really much good tooling for it. I needed a tool to handle the creation of all the symlinks, and it felt like a fairly nuanced situation, but seeing as some people here are encountering the same issue, I thought I would share my tool with the community.

Enjoy!

2 Likes

Great that you've developed a tool to help others with possible problems!

One question though: why not just migrate the symlinks with the rest? zip has the --symlinks option (short version -y) to do this for example :slight_smile:

Example:

osiris@erazer tmp $ zip -ry foo.zip foo
  adding: foo/ (stored 0%)
  adding: foo/bar/ (stored 0%)
  adding: foo/baz (stored 0%)
osiris@erazer tmp $ mkdir bar && cd bar
osiris@erazer bar $ unzip ../foo.zip 
Archive:  ../foo.zip
   creating: foo/
   creating: foo/bar/
    linking: foo/baz                 -> bar 
finishing deferred symbolic links:
  foo/baz                -> bar
osiris@erazer bar $ 

Also note that if I read your script correctly, it makes absolute symbolic links instead of the relative ones generated by Certbot itself. Maybe throw in some os.path.relpath() magic? -> made a PR for this.

6 Likes

I didn't know that the symlinks were relative. In fact, I didn't know symlinks could be relative. That's super cool and basically makes my tool obsolete. Still, sweet solution. I'll see if I can add this info to the readme of the repository so that people looking can reference it.

4 Likes