pelias / docker

Run the Pelias geocoder in docker containers, including example projects.
MIT License
332 stars 224 forks source link

Backup & Restore Pelias #171

Open umar18 opened 4 years ago

umar18 commented 4 years ago

Hello, Sorry if it sounds stupid !! I have successfully deployed Pelias on my Linux environment, now i want to setup another machine as backup. I don't want to setup the new machine from scratch and wait for another week. Can i make a backup of the existing docker and restore on the new machine ??

missinglink commented 4 years ago

Hi @umar18, the way it works is that the docker containers themselves don't contain any state, so you can delete them and recreate them.

You'll need to make a copy of the files in your docker project directory such as .env, docker-compose.yml and pelias.json.

Then all the rest of the data is stored within a directory defined by the variable DATA_DIR (this depends on how you set it up on your computer):

pelias system env | grep DATA_DIR
DATA_DIR=/data/pelias/docker/projects/singapore

On my computer the data for this project is stored in /data/pelias/docker/projects/singapore and for you it'll be a different directory. This setting is defined in .env.

Within that directory you'll find all the data for elasticsearch and all other services listed in your docker-compose config:

ls -lah /data/pelias/docker/projects/singapore
total 0
drwxr-xr-x   9 peter  staff   288B Mar 19  2019 .
drwxr-xr-x   6 peter  staff   192B Oct 15 09:30 ..
drwxr-xr-x   3 peter  staff    96B Jan 10 16:31 elasticsearch
drwxr-xr-x  14 peter  staff   448B Mar 14  2019 interpolation
drwxr-xr-x   4 peter  staff   128B Mar 14  2019 openaddresses
drwxr-xr-x   3 peter  staff    96B Mar 14  2019 openstreetmap
drwxr-xr-x   4 peter  staff   128B Mar 14  2019 placeholder
drwxr-xr-x   3 peter  staff    96B Mar 14  2019 polylines
drwxr-xr-x   5 peter  staff   160B Mar 14  2019 whosonfirst

You can simply tar or zip or whatever that directory and copy it to another system.

Some things to be aware of are:

Hope that helps.

umar18 commented 4 years ago

Thanks @missinglink for the reply. For data i will do that but for the docker can i use docker commit and docker load commands ? Actually the problem is that i want to install Pelias completely offline (without internet)

missinglink commented 4 years ago

Maybe https://docs.docker.com/engine/reference/commandline/save/ ?

missinglink commented 4 years ago

You can use commands for saving containers but you really don't need to, the containers are stateless, you can delete a container and spawn a new one and it'll still work.

You just need to find a way of getting the docker images on the host machine as you won't have access to docker pull when offline.