ubergeek77 / Lemmy-Easy-Deploy

Deploy Lemmy the easy way!
MIT License
133 stars 14 forks source link

Any suggestion on how to move to a new VPS? #7

Closed danmed closed 1 year ago

danmed commented 1 year ago

I tested this on a cheap crappy VPS and it works great.. but stupidly i got a bit invested in the whole thing and ive outgrown the VPS..

Do you have any suggestion on how to move to a new VPS but retain my instance?

Would it be as simple as

?

ubergeek77 commented 1 year ago

Hello again! I believe I responded to you about this on Lemmy!

Migration isn't really supported by this project, but for the benefit of you and everyone else, I can share some guidance with you here.

Basically, your data is stored in Docker volumes which are not present in that live folder. So, moving the live folder will not be enough. You will need to copy the Docker volumes, too.

In their infinite wisdom, Docker still does not have a great way to do this. You have some options though:

https://github.com/loomchild/volume-backup

https://github.com/BretFisher/docker-vackup

You can get a list of volumes you need to back up on your current instance with docker volume ls. The important ones will be prefixed with lemmy-easy-deploy_

NOTE: You will have to manually set the labels on the new volume when migrating it. The first repo I linked has some guidance on how to do that. You can run this on your current server to see which labels you will need (this is just one example, but all the volumes will have similar labels):

docker volume inspect lemmy-easy-deploy_postgres_data

The ones you need are in that Labels object. Here is an example output from mine:

        "Labels": {
            "com.docker.compose.project": "lemmy-easy-deploy",
            "com.docker.compose.version": "2.18.1",
            "com.docker.compose.volume": "postgres_data"
        },

Notice the pattern there - com.docker.compose.project will always be lemmy-easy-deploy, and com.docker.compose.volume will always be "whatever the volume is called in docker-compose.yml," so postgres_data in this case. All lemmy-easy-deploy_ volumes will have similar labels, don't forget about those.

If you are worried about messing that up, don't worry. As long as the names of the volumes are the same, Lemmy Easy Deploy should pick them up. It's just, if you don't set these labels properly, Docker Compose will print warnings.

If you've got your volumes set up, and docker volume ls on the new system looks just like the old system (as in, all the volume names are identical), you should be good to run ./deploy.sh -f to redeploy.

So to summarize:

Good luck!