This guide assumes you are migrating from the legacy V1 self-hosted setup. You are on the legacy configuration if you began self-hosting prior to February 2023.
Migrating from the legacy setup to the new V2 setup involves creating a database dump and importing it into your new environment.
Note that the steps below will only work if you are setting up the new V2 infrastructure from scratch. If you have previously created a V2 setup, the import files will be ignored, as the database has already been created and migrated.
Run the following command in your legacy environment:
./server.sh dump-db
This will create four database dump files:
data/mysql/001-db-dump.sql
data/revisions-db/002-adjust.sql
data/revisions-db/003-revisions-dump.sql
data/revisions-db/004-revisions-ownership.sql
Follow the guide here to setup a new folder where your V2 setup files will be placed. In this guide, we'll refer to this folder as sn-v2
.
In order for the V2 setup to encrypt your setting with the same values as your legacy setup, you need to copy the following environment variables from your legacy setup to your V2 setup
ENCRYPTION_SERVER_KEY
(from docker/auth.env
) into AUTH_SERVER_ENCRYPTION_SERVER_KEY
(in sn-v2/.env
)AUTH_JWT_SECRET
(from .env
) into AUTH_JWT_SECRET
(in sn-v2/.env
)VALET_TOKEN_SECRET
(from .env
) into VALET_TOKEN_SECRET
(in sn-v2/.env
)In the sn-v2
directory, create the directory data/import
. Place the database dump files created above inside sn-v2/data/import
.
mkdir -p data/import
mv your-path-to-mysql-dumps/001-db-dump.sql data/import
mv your-path-to-mysql-dumps/002-adjust.sql data/import
mv your-path-to-mysql-dumps/003-revisions-dump.sql data/import
mv your-path-to-mysql-dumps/004-revisions-ownership.sql data/import
Your data will be automatically imported once the V2 process starts. You can start it by running the following command inside your sn-v2
directory:
docker compose up -d
To import your file uploads, copy the contents of data/uploads
from your legacy setup into the sn-v2/uploads
folder (create the uploads
directory if it doesn't exist).