Migrated from one server to another, lost all data #1911
Replies: 1 comment 1 reply
-
Hey there @MarkErik -- let me know if this helps! Just ran into this one. Couldn't figure out how to migrate from a docker-compose stack on one host to a new docker-compose stack on another host without the database getting lost. I ran through the migration process a few times and this is the process that I landed on that worked to migrate my database successfully: You can properly migrate the data using a combination of the methodology mentioned here in #1459 (reply in thread). NOTA BENE 1: The biggest snafu / problem that I ran into was the versions of docker-compose! When I originally setup my stack I was on an older version of docker-compose, v1.29.2. And when I setup my new host the version of docker-compose was much newer, v2.17.2. Newer versions of docker-compose bring up the stack using slightly different naming conventions and that was causing an issue for me. NOTA BENE 2: My docker-compose file (and other files) is in a directory called So I did the following:
$ docker-compose --version
docker-compose version 1.29.2, build unknown
$ docker volume ls
DRIVER VOLUME NAME
local hosting_db-data
local hosting_event-data
$ docker inspect hosting_event-data -f "{{json .Labels}}"
{"com.docker.compose.project":"hosting","com.docker.compose.version":"1.29.2","com.docker.compose.volume":"event-data"}
$ docker inspect hosting_db-data -f "{{json .Labels}}"
{"com.docker.compose.project":"hosting","com.docker.compose.version":"1.29.2","com.docker.compose.volume":"db-data"}
$ docker volume create --label "com.docker.compose.project=hosting" --label "com.docker.compose.version=1.29.2" --label "com.docker.compose.volume=event-data" hosting_event-data
hosting_event-data
$ docker volume create --label "com.docker.compose.project=hosting" --label "com.docker.compose.version=1.29.2" --label "com.docker.compose.volume=db-data" hosting_db-data
hosting_db-data
$ docker volume ls
DRIVER VOLUME NAME
local hosting_db-data
local hosting_event-data
$ docker inspect hosting_event-data hosting_db-data ## Checking for our labels.
[
{
"CreatedAt": "2023-05-13T22:47:41Z",
"Driver": "local",
"Labels": {
"com.docker.compose.project": "hosting",
"com.docker.compose.version": "1.29.2",
"com.docker.compose.volume": "event-data"
},
"Mountpoint": "/var/lib/docker/volumes/hosting_event-data/_data",
"Name": "hosting_event-data",
"Options": {},
"Scope": "local"
},
{
"CreatedAt": "2023-05-13T22:50:59Z",
"Driver": "local",
"Labels": {
"com.docker.compose.project": "hosting",
"com.docker.compose.version": "1.29.2",
"com.docker.compose.volume": "db-data"
},
"Mountpoint": "/var/lib/docker/volumes/hosting_db-data/_data",
"Name": "hosting_db-data",
"Options": {},
"Scope": "local"
}
]
$ docker run -v hosting_db-data:/volume --rm --log-driver none loomchild/volume-backup backup | ssh user@host docker run -iv hosting_db-data:/volume --rm loomchild/volume-backup restore
Enter the 3 digit challenge code on your key to authorize <ssh:https://user@host|ed25519>
3 6 4
$ docker run -v hosting_event-data:/volume --rm --log-driver none loomchild/volume-backup backup | ssh user@host docker run -iv hosting_event-data:/volume --rm loomchild/volume-backup restore
Enter the 3 digit challenge code on your key to authorize <ssh:https://user@host|ed25519>
3 6 1 The new stack came online and all the database data was present and plausible was running normally as if it nothing changed. |
Beta Was this translation helpful? Give feedback.
-
First off, I'll say that this is likely my fault - but for the future I would like to know what is the best way to migrate Plausible from one server to another.
My setup:
What I did:
Result:
I realise that copying all the files probably isn't the correct way to migrate the data.
In the future, I was wondering what would be a better way?
Thank you and much appreciated for any advice.
BTW: here is the docker log upon first starting the containers on the new server (I see there are lots of DB doesn't exist errors) Strange that if I lost the websites, but that my admin user was still there.
Beta Was this translation helpful? Give feedback.
All reactions