Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions to migrate snikket server to a new VPS? #218

Open
lispstudent opened this issue Mar 8, 2024 · 7 comments
Open

Instructions to migrate snikket server to a new VPS? #218

lispstudent opened this issue Mar 8, 2024 · 7 comments

Comments

@lispstudent
Copy link

I need to help moving a small snikket server to a new VPS with a different provider.

I have never moved a docker install, and I am not sure how to do it in snikket case, where there are 4 containers:

# docker ps

CONTAINER ID   IMAGE                                 COMMAND                  CREATED          STATUS                    PORTS     NAMES
b1672688cb2e   snikket/snikket-server:stable         "/bin/entrypoint.sh"     59 minutes ago   Up 17 minutes (healthy)             snikket
c2f96f06a112   snikket/snikket-web-proxy:stable      "/usr/bin/tini /bin/…"   59 minutes ago   Up 17 minutes                       snikket-proxy
736db306c31f   snikket/snikket-web-portal:stable     "/bin/sh /entrypoint…"   59 minutes ago   Up 17 minutes (healthy)             snikket-portal
5699ba0c3979   snikket/snikket-cert-manager:stable   "/usr/bin/tini /bin/…"   59 minutes ago   Up 17 minutes                       snikket-certs

I read about docker save and docker export. What is the safest way to do this? Shall I do that for all 4 containers?

Could some instructions be added to the admin documentation, please?

@lispstudent
Copy link
Author

lispstudent commented Mar 8, 2024

Another possibility that came to mind, just rsync the whole docker directory?

docker stop $(docker ps -a -q)
systemctl stop docker.socket && systemctl stop docker.service
systemctl disable docker.socket && systemctl disable docker.service

rsync -avp --progress root@old_server_ip:/var/lib/docker/ root@new_server_ip:/var/lib/docker/

@mwild1
Copy link
Member

mwild1 commented Mar 8, 2024

You're right, we need some docs on this! Over in the snikket-selfhosted repo you'll find some scripts, including a backup.sh and restore.sh.

  1. Before the migration, ensure your DNS record TTLs are set to something low (e.g. 60s). If they are currently set to something high, you should lower them to 60 and wait until the old records have expired.
  2. Run the backup.sh on your old server and then stop it with 'docker-compose down' to make sure no further changes are made to the data.
  3. Copy the backup file to your new server.
  4. On the new server, follow the normal Snikket quick-start guide until the last step where you create the admin invite.
  5. Run restore.sh on the new server, passing it the backup file you previously created. Then run 'docker compose restart' to make sure the restored data is loaded.
  6. Update the IP address in your DNS records to point to the new server. Your Snikket apps should connect as if nothing happened!

After everything is confirmed working, raise the TTLs on your DNS records back up to something higher. This will allow the apps to (re)connect to your server more quickly during daily usage.

Give me feedback on your success following the above steps. If they seem good, I'll copy them into a documentation page. Good luck! :)

@lispstudent
Copy link
Author

lispstudent commented Mar 9, 2024

Thank you so much for the detailed instructions.

It is a bit scary for me to test, as the current Snikket VPS has about 100 online friends, and I would not want to have a long downtime if anything would go wrong.

Some users are across time zones and even if I revert the DNS, there could be some downtime if something goes wrong.

Is there a way, once I run restore.sh on the new VPS, to modify the Snikket server and proxy settings to point a temporary test domain, refresh Let's Encrypt certificates for such test domain so I could at least verify a test account is reachable?

@lispstudent
Copy link
Author

I was able to move Snikket to a new VPS.

My DNS provider offers minimum 300 sec. TTLs, so I preferred to change DNS right after step 2.

I will update my report after some spot checks with users, to verify all is there.

  • As a side note, it would be nice to add a small section to highlight how easy it is to make a back up.
    Just a cron job with backup.sh to a back-up directory, which can be moved off-site would suffice. Wonderful simplicity!

Thank you for such clear and perfect instructions.

Kudos to Snikket and its Team!

@lispstudent
Copy link
Author

I can confirm users had no problems. Everything worked smoothly.

Many thanks, @mwild1 !

On my side, this ticket could be closed any time it is convenient to the maintainers.

@ip-rw
Copy link

ip-rw commented Apr 14, 2024

I never really understood what problem docker volumes were trying to solve.

docker(compose)'s real charm is you can take software with the outdated habit of scattering itself all over your computer and reduce it to a single, portable directory. Bonus is you you can see what the application does at a glance, 0 noise.

Just about to setup a new Snikket install and it doesn't feel like a chore at all. Prosody is awesome, and would run on one those solar calculators or a reasonably fresh potato it's so lightweight...

I miss the admin commands module from prosody, I forget the name but I found myself wanting it back! Adding this in by default definitely have my vote. I'll send a pull req...

@lispstudent
Copy link
Author

admin commands module

I also would love to have more modules, including the admin commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants