Migrating from the legacy infrastructure to the new V2 self-hosted setup

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.

1. Prepare a database dump of the existing database

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

2. Create a new environment for the V2 setup

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.

3. Import your keys

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)

4. Import your database dumps

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

5. Importing your file uploads

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).

Other ways to get help

Browse or post to the forum
Recommended for non-account related issues.
Join the Standard Notes Discord group
Recommended for small talk.
Send an email to [email protected]
Recommended for account related issues.