To backup and migrate the Chevereto Docker service, follow these steps:
- Stop the running Chevereto container using the following command:
docker stop chevereto
- Backup the
/var/www/html/images/
directory. Different VPSs may have different backup and migration methods. If you are using a Linux-based VPS, you can use thetar
command for backup. For example, execute the following command to backup theimages
directory to the current directory:
tar -zcvf images_backup.tar.gz /var/www/html/images/
- Export the database using the following command:
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
Where CONTAINER
is the name or ID of the Chevereto container, and DATABASE
is the name of the database used by Chevereto.
-
Copy the backup files and the exported database file to the new VPS.
-
Install Docker and Docker Compose on the new VPS if not already installed. You can follow the official installation guide for the respective operating system. For example, on Ubuntu 20.04, you can install as follows:
sudo apt-get update
sudo apt-get install docker-compose docker.io
- Create a new directory on the new VPS. For convenience, you can name the directory Chevereto and navigate to it using the following command:
mkdir Chevereto
cd Chevereto
- Create a new
docker-compose.yml
file in the Chevereto directory to start the Chevereto service. To ensure the service starts correctly, make sure to modify the following environment variables to match the original Chevereto service:
-
CHEVERETO_DB_HOST
: The connection address of the database. -
CHEVERETO_DB_USER
: The username used to connect to the database. -
CHEVERETO_DB_PASS
: The password used to connect to the database. -
CHEVERETO_DB_NAME
: The name of the database used by Chevereto. -
CHEVERETO_ASSET_STORAGE_BUCKET
: The storage path for image files.
The specific content of the docker-compose.yml
file is as follows:
version: '3'
services:
chevereto:
image: ghcr.io/chevereto/chevereto:latest
container_name: chevereto
ports:
- "80:80"
environment:
- CHEVERETO_DB_HOST=database
- CHEVERETO_DB_USER=chevereto
- CHEVERETO_DB_PASS=user_database_password
- CHEVERETO_DB_NAME=chevereto
- CHEVERETO_ASSET_STORAGE_TYPE=local
- CHEVERETO_ASSET_STORAGE_URL=/images/_assets/
- CHEVERETO_ASSET_STORAGE_BUCKET=/var/www/html/images/_assets/
volumes:
- /var/www/html/images:/var/www/html/images
depends_on:
- database
database:
image: ghcr.io/chevereto/chevereto-mariadb:latest
container_name: chevereto_database
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=chevereto
Make sure the docker-compose.yml
file is located in the root directory of the Chevereto directory for subsequent commands.
- Start the Chevereto service on the new VPS using the following command:
docker-compose up -d
This will start the Chevereto service on the new VPS and connect to the original database and read the backup directory based on the environment variable settings. After this, you can check if the Chevereto service is working properly by accessing the IP address or domain name of the new VPS through a browser.