|
| 1 | +.. _ref_migrate_from: |
| 2 | + |
| 3 | +======================================= |
| 4 | +Migrating from Gel Cloud to Self-Hosted |
| 5 | +======================================= |
| 6 | + |
| 7 | +:edb-alt-title: Migrating from Gel Cloud to Self-Hosted Gel |
| 8 | + |
| 9 | +|Gel| Cloud is sunsetting at the end of January 2026. To ensure your |
| 10 | +applications continue to run smoothly, you should migrate your data to a |
| 11 | +self-hosted |Gel| instance. |
| 12 | + |
| 13 | +This guide outlines the process of migrating your production data. We strongly |
| 14 | +recommend performing a "dry run" with your staging or development environment |
| 15 | +first to familiarize yourself with the workflow. |
| 16 | + |
| 17 | + |
| 18 | +Phase 1: Preparation |
| 19 | +==================== |
| 20 | + |
| 21 | +1. Spin up your self-hosted deployment |
| 22 | +-------------------------------------- |
| 23 | + |
| 24 | +While you can host |Gel| on any infrastructure that supports Docker or binary |
| 25 | +installations, we recommend using a managed cloud provider (such as Fly.io, |
| 26 | +AWS, or GCP with managed Postgres) for production reliability. |
| 27 | + |
| 28 | +See our :ref:`self-hosted deployment guides <ref_guide_deployment>` for |
| 29 | +step-by-step instructions on deploying to various platforms. |
| 30 | + |
| 31 | +Ensure your new instance is: |
| 32 | + |
| 33 | +* Running the same version of |Gel| as your Cloud instance (or newer). |
| 34 | +* Configured with a persistent volume for data or connected to a managed |
| 35 | + Postgres instance. |
| 36 | + |
| 37 | +2. Retrieve connection parameters |
| 38 | +--------------------------------- |
| 39 | + |
| 40 | +Once your new instance is live, you need its DSN (Data Source Name) or |
| 41 | +individual connection parameters. Each :ref:`deployment guide |
| 42 | +<ref_guide_deployment>` outlines the best way to retrieve the various |
| 43 | +connection parameters from your specific setup. You will typically need: |
| 44 | + |
| 45 | +* **Host**: The domain or IP of your new instance. |
| 46 | +* **Port**: Default is ``5656``. |
| 47 | +* **User**: Default is |admin|. |
| 48 | +* **Password**: The password you set during initialization. |
| 49 | +* **TLS CA**: The certificate used to secure the connection (unless using a |
| 50 | + public CA or ``--trust-tls-cert``). |
| 51 | + |
| 52 | +The DSN format is: |
| 53 | + |
| 54 | +.. code-block:: text |
| 55 | +
|
| 56 | + gel://<user>:<password>@<host>:<port>/<branch> |
| 57 | +
|
| 58 | +All components except the scheme are optional. See :ref:`ref_reference_connection_dsn` |
| 59 | +for more details. |
| 60 | + |
| 61 | + |
| 62 | +Phase 2: The Migration (Cutover) |
| 63 | +================================ |
| 64 | + |
| 65 | +To ensure data consistency, you must prevent new writes to your database |
| 66 | +during the transfer. |
| 67 | + |
| 68 | +1. Enable maintenance mode |
| 69 | +-------------------------- |
| 70 | + |
| 71 | +Before touching the data, put your application into maintenance mode. This |
| 72 | +ensures that no new records are created in |Gel| Cloud after you've started |
| 73 | +the dump. |
| 74 | + |
| 75 | +* **Web Apps**: Point your load balancer to a static "Maintenance" page. |
| 76 | +* **Background Jobs**: Stop all workers, cron jobs, or queues that interact |
| 77 | + with the database. |
| 78 | + |
| 79 | +2. Perform the migration |
| 80 | +------------------------ |
| 81 | + |
| 82 | +You can use the |Gel| CLI to move data directly from your Cloud instance to |
| 83 | +your new self-hosted instance. |
| 84 | + |
| 85 | +.. code-block:: bash |
| 86 | +
|
| 87 | + # 1. Dump from Gel Cloud to directory |
| 88 | + $ gel dump --instance <org-name>/<instance-name> \ |
| 89 | + --all --format=dir \ |
| 90 | + production_dump |
| 91 | +
|
| 92 | + # 2. Restore to self-hosted from dump |
| 93 | + $ gel restore --dsn <new_self_hosted_dsn> --all production_dump |
| 94 | +
|
| 95 | +.. note:: |
| 96 | + |
| 97 | + If your self-hosted instance uses a self-signed TLS certificate, you may |
| 98 | + need to add ``--tls-security insecure`` to the restore command, or first |
| 99 | + retrieve the TLS certificate and set it via :gelenv:`TLS_CA`. |
| 100 | + |
| 101 | + |
| 102 | +Phase 3: Verification and Go-Live |
| 103 | +================================= |
| 104 | + |
| 105 | +1. Update application environment variables |
| 106 | +------------------------------------------- |
| 107 | + |
| 108 | +Update your application's configuration to point to the new instance. Replace |
| 109 | +the Gel Cloud specific connection environment variables :gelenv:`INSTANCE` and |
| 110 | +:gelenv:`SECRET_KEY` variables with the new connection details: |
| 111 | + |
| 112 | +* :gelenv:`DSN`: :geluri:`user:password@host:port/branch` |
| 113 | +* :gelenv:`TLS_CA`: The TLS certificate content (if your instance uses a |
| 114 | + self-signed certificate) |
| 115 | +* :gelenv:`CLIENT_TLS_SECURITY`: Set to ``insecure`` if you need to skip TLS |
| 116 | + verification (not recommended for production) |
| 117 | + |
| 118 | +2. Sanity check |
| 119 | +--------------- |
| 120 | + |
| 121 | +Before turning off maintenance mode: |
| 122 | + |
| 123 | +* Run a few :gelcmd:`query` commands against the new instance to verify data |
| 124 | + integrity. |
| 125 | +* Check that your schema migrated correctly: :gelcmd:`migrate --status`. |
| 126 | +* Launch a local instance of your app connected to the new production DB to |
| 127 | + ensure connection logic is sound. |
| 128 | + |
| 129 | +3. Disable maintenance mode |
| 130 | +--------------------------- |
| 131 | + |
| 132 | +Once verified, restart your application servers and background workers. |
| 133 | +Monitor your logs closely for any connection or permission errors. |
| 134 | + |
| 135 | + |
| 136 | +Post-Migration Note |
| 137 | +=================== |
| 138 | + |
| 139 | +Once you are 100% certain your data is safe and your app is stable on the new |
| 140 | +host, you can de-provision your |Gel| Cloud instance. Remember that all |Gel| |
| 141 | +Cloud data will be deleted after the January 2026 deadline. |
0 commit comments