11---
2+
23title : Migrate to external services
34description : Move your Plane data from the default local Postgres and MinIO containers to managed cloud services for a production ready deployment.
4- ---
5+ ---------------------------------------------------------------------------------------------------------------------------------------------------
56
67# Migrate to external Postgres and storage
78
@@ -13,10 +14,11 @@ This guide walks through moving your existing data from the local containers to
1314
1415You need :
1516
16- - Docker and Docker Compose installed on the host running Plane
17- - The PostgreSQL client ` psql ` and ` pg_restore ` installed on your local machine
18- - Your cloud Postgres connection details: host, username, database name, and password
19- - Your cloud storage connection details: endpoint URL, access key, secret key, and bucket name
17+ * Docker and Docker Compose installed on the host running Plane
18+ * The PostgreSQL client `psql` and `pg_restore` installed on your local machine
19+ * Your cloud Postgres connection details: host, username, database name, and password
20+ * Your cloud storage connection details: endpoint URL, access key, secret key, and bucket name
21+ * Your cloud PostgreSQL version should ideally match your source PostgreSQL version
2022
2123# # Stop Plane
2224
@@ -49,16 +51,33 @@ docker exec \
4951
5052Verify the file was created and is not empty :
5153
52- ```
54+ ` ` ` bash
5355ls -lh plane-backup.dump
5456` ` `
5557
5658# # Restore the database to your cloud Postgres
5759
58- Use ` pg_restore ` on your local machine to load the dump into your cloud database. Replace the placeholder values with your actual connection details.
60+ Before restoring, clear the existing schema in your cloud database.
61+
62+ ` ` ` bash
63+ psql \
64+ -h "your-cloud-host.com" \
65+ -U "cloud-username" \
66+ -d "cloud-database-name" \
67+ -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;"
68+ ` ` `
69+
70+ Restore the dump using `pg_restore`.
71+
72+ The `--no-owner` flag prevents ownership errors when the source database roles do not exist in your cloud database.
73+
74+ The `--no-privileges` flag skips grants for roles that may not exist in the target database.
5975
6076` ` ` bash
6177pg_restore \
78+ --no-owner \
79+ --no-privileges \
80+ --verbose \
6281 -h "your-cloud-host.com" \
6382 -U "cloud-username" \
6483 -d "cloud-database-name" \
@@ -67,42 +86,85 @@ pg_restore \
6786
6887You will be prompted for your cloud database password.
6988
89+ # ## PostgreSQL version compatibility
90+
91+ Use a `pg_restore` version that matches your target PostgreSQL version when possible.
92+
93+ For example, if your cloud database is PostgreSQL 15, use PostgreSQL 15 client tools.
94+
95+ If you use a newer `pg_restore` version, you may see :
96+
97+ ` ` ` text
98+ ERROR: unrecognized configuration parameter "transaction_timeout"
99+ Command was: SET transaction_timeout = 0;
100+ ` ` `
101+
102+ This warning can be ignored if the restore continues successfully. Using matching PostgreSQL client tools avoids this warning.
103+
70104# # Sync storage to your cloud bucket
71105
72106MinIO ships with the `mc` client. Use it from inside the MinIO container to sync your local uploads to your cloud storage.
73107
74- 1 . Create an alias for your local MinIO.
108+ # ## 1. Create an alias for your local MinIO
75109
76- Your MinIO credentials are in plane.env as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY .
110+ Your MinIO credentials are in ` plane.env` as `MINIO_ROOT_USER` and `MINIO_ROOT_PASSWORD` .
77111
78112` ` ` bash
79113docker compose --env-file plane.env exec plane-minio \
80114 mc alias set localminio http://localhost:9000 \
81115 <MINIO_ROOT_USER> <MINIO_ROOT_PASSWORD>
82116` ` `
83117
84- 2 . Create an alias for your cloud storage.
118+ # ## 2. Create an alias for your cloud storage
119+
120+ For AWS S3, use the S3 endpoint.
121+
122+ Default AWS endpoint :
123+
124+ ` ` ` bash
125+ docker compose --env-file plane.env exec plane-minio \
126+ mc alias set cloudminio https://s3.amazonaws.com \
127+ <CLOUD_ACCESS_KEY> <CLOUD_SECRET_KEY>
128+ ` ` `
129+
130+ Regional AWS S3 endpoint :
85131
86132` ` ` bash
87133docker compose --env-file plane.env exec plane-minio \
88- mc alias set cloudminio < cloud-endpoint-url > \
134+ mc alias set cloudminio https://s3.<aws-region>.amazonaws.com \
89135 <CLOUD_ACCESS_KEY> <CLOUD_SECRET_KEY>
90136` ` `
91137
92- 3 . Mirror local data to your cloud bucket.
138+ For other S3-compatible providers, replace the endpoint with your provider's S3 endpoint.
139+
140+ Verify the connection :
141+
142+ ` ` ` bash
143+ docker compose --env-file plane.env exec plane-minio \
144+ mc ls cloudminio
145+ ` ` `
146+
147+ # ## 3. Mirror local data to your cloud bucket
93148
94149` ` ` bash
95150docker compose --env-file plane.env exec plane-minio \
96151 mc mirror localminio/uploads cloudminio/<bucket-name> --overwrite
97152` ` `
98153
99- This copies all files from the local uploads bucket to your cloud bucket. The ` --overwrite ` flag replaces any existing files in the destination with the same name.
154+ Example :
155+
156+ ` ` ` bash
157+ docker compose --env-file plane.env exec plane-minio \
158+ mc mirror localminio/uploads cloudminio/my-plane-bucket --overwrite
159+ ` ` `
160+
161+ This copies all files from the local uploads bucket to your cloud bucket. The `--overwrite` flag replaces existing files with the same name.
100162
101163Wait for the sync to complete before continuing.
102164
103165# # Update your environment configuration
104166
105- Open plane.env and update the database and storage settings to point to your cloud services.
167+ Open ` plane.env` and update the database and storage settings to point to your cloud services.
106168
107169# ## Database
108170
@@ -112,17 +174,21 @@ DATABASE_URL=postgresql://cloud-username:cloud-password@your-cloud-host.com:5432
112174
113175# ## Storage
114176
177+ For AWS S3 :
178+
115179` ` ` bash
116180AWS_ACCESS_KEY_ID=<CLOUD_ACCESS_KEY>
117181AWS_SECRET_ACCESS_KEY=<CLOUD_SECRET_KEY>
118- AWS_S3_ENDPOINT_URL=< cloud-endpoint-url >
182+ AWS_S3_ENDPOINT_URL=https://s3.amazonaws.com
119183AWS_S3_BUCKET_NAME=<bucket-name>
120- AWS_REGION = < aws-region>
184+ AWS_REGION= <aws-region>
121185` ` `
122186
187+ For other S3-compatible providers, replace `AWS_S3_ENDPOINT_URL` with your provider endpoint.
188+
123189# # Restart Plane
124190
125- Bring all services back up
191+ Bring all services back up :
126192
127193` ` ` bash
128194docker compose up -d
@@ -132,4 +198,4 @@ Open Plane in a browser and verify that your data, attachments, and pages are in
132198
133199# # After migration
134200
135- Keep plane-backup.dump in a safe location as a point-in-time backup.
201+ Keep ` plane-backup.dump` in a safe location as a point-in-time backup.
0 commit comments