-
Most of these steps are from this guide, but there are some small modifications, so copy from here, not the article.
-
Dump the database on the source server. Open a web terminal and run
-
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} pg_dump --no-owner --no-privileges --username=${CLOUDRON_POSTGRESQL_USERNAME} --host=${CLOUDRON_POSTGRESQL_HOST} ${CLOUDRON_POSTGRESQL_DATABASE} > /tmp/pgdump.sql
-
When you dump the file, open it and change
email public.citext NOT NULL,
toemail character varying(254) NOT NULL,
on line 797. -
Install Metabase on the new Cloudron instance. Once running, open a web terminal, click the "Upload to /tmp" button and upload the pgdump.sql file from the previous step.
-
Then remove any lines on the file that mention extensions
-
sed -e 's/CREATE EXTENSION/-- CREATE EXTENSION/g' -e 's/COMMENT ON EXTENSION/-- COMMENT ON EXTENSION/g' /tmp/pgdump.sql > /tmp/pgdump_mod.sql
-
In the same terminal, clear the existing database
-
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public"
-
And import the new database (note we've set ON_ERROR_STOP to off because there will be an issue with the
citext
extension) -
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} --set ON_ERROR_STOP=off --file=/tmp/pgdump_mod.sql
-
Your new install should now have all the data from the old install. The last thing to do is to set the
MB_ENCRYPTION_SECRET_KEY
. Cloudron automatically creates a new secret for each install, but your new install needs to match the old one. -
ssh into your source server and open the
/home/yellowtent/appdata
directory, then open the relevant app folder and find the .env file. There should be a line that starts withexport MB_ENCRYPTION_SECRET_KEY=
. Copy this line -
ssh into your destination server, find the relevant metabase directory and the .env file. Paste the line you copied out of the source file.
-
Open the new Cloudron and restart your app.
-