# Leaving Gregale: export your database, files and settings

Gregale · Updated 2026-12-05

Take everything out of Gregale: pg_dump your Postgres, sync buckets with any S3 tool, export Compose and account records. Tested, with what stays behind.

**You can leave Gregale with everything you put in: a `pg_dump` of each
managed Postgres database, every object in your buckets through any S3
tool, each project as a Docker Compose file, and your account's records as
JSON.** Two things don't come back out. Sealed secret values are never
shown again, so keep your own copy. Gregale doesn't hand out the images it
built, so you rebuild from your source. We ran every step below in
production on December 5, 2026.

**[See the run](#verified-on-gregale-december-5-2026)**, or jump to
[how other platforms compare](#how-other-platforms-compare).

## What to export, and how

| What                  | How                                                                                   | What you get                                                        |
| --------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| Code                  | Nothing to export: Gregale deploys from your repository or an upload                  | Your source. An app with a Dockerfile builds anywhere Docker does   |
| Managed Postgres      | `pg_dump` from inside the app with `gregale app exec`                                 | A standard SQL dump that `psql` restores into any PostgreSQL        |
| Object storage        | Any S3 tool against `https://s3.gregale.dev`, or `gregale bucket download` per object | Every object, byte for byte                                         |
| Services and settings | `gregale project export <project> --out compose.yaml`                                 | A Compose file; Gregale settings are `x-gregale-*` keys             |
| Environment variables | `gregale env list` for plain values, `gregale env pull` for secret names              | Plain values, and secret names with blank values                    |
| Account records       | `gregale account export --no-secrets -o export.json`                                  | Apps, settings, deployments, builds, crons, edge rules, audit trail |
| Crons                 | `gregale cron list`                                                                   | Each schedule, path and time zone                                   |
| Custom domains        | Your DNS records stay yours; point them at the new host                               | No export needed                                                    |

### Postgres

Run `pg_dump` inside a fresh VM of the app, where `DATABASE_URL` is
already set, and stream the dump to your machine:

```bash
gregale app exec my-api --interactive --shell -- \
  'pg_dump --no-owner --no-privileges "$DATABASE_URL"' > dump.sql
```

The app's image needs `pg_dump` at the database's major version or newer;
our database ran PostgreSQL 17. If your image doesn't have it,
deploy a small helper app whose image does, attach the same database with
`gregale postgres attach <database> <helper>`, and run the command there.
The app's own `read_write` binding is enough for `pg_dump`. Restore the
file with `psql`:

```bash
psql "$NEW_DATABASE_URL" -f dump.sql
```

### Object storage

Each bucket speaks the S3 API, so `aws s3 sync` or `rclone` copy a whole
bucket with the bucket's S3 credentials (see
[object storage](https://gregale.dev/docs/object-storage.md)). For a single object, the CLI needs
no S3 credentials:

```bash
gregale bucket download my-api BUCKET_ID reports/2026-11.pdf ./2026-11.pdf
```

### Configuration

`gregale project export` writes the project's services as a Compose file:
build directories, memory limits and each environment variable, referenced
by name as `${NAME}`. Fill the values from your own copy before you run it
elsewhere. Crons are not in the Compose file; list them with
`gregale cron list`.

## Verified on Gregale, December 5, 2026

The test app, `leave-test`, was Node.js 22 on Alpine with
`postgresql17-client` and the AWS CLI in its image. `gregale add postgres`
created a managed database (PostgreSQL 17.12) in 29 seconds, and
`gregale add bucket` added a bucket in 5. A release command created two
tables, 1,000 customers and 5,000 orders, with a foreign key, an index and a
view.

**Postgres.** The `pg_dump` command above streamed a 292 KB SQL dump to a
laptop in Turkey in 4.1 seconds, with the app's own `read_write` binding.
`psql` restored it into a local PostgreSQL 16.15 in 9.7 seconds. Every
count matched: 1,000 customers, 5,000 orders, the same 24,662,500 cents in
total, 1,000 rows from the view, and the order ID sequence continued at
5,001. The one error was `unrecognized configuration parameter
"transaction_timeout"`, a PostgreSQL 17 setting that version 16 doesn't
have; restoring into version 17 avoids it.

**Object storage.** We uploaded three objects (a 2 MB PDF, a CSV and a JSON
file). `gregale bucket download` fetched the PDF in 2.6 seconds, and its
SHA-256 matched the original. Inside the app, the stock AWS CLI listed the
bucket at `https://s3.gregale.dev` with the bucket's credentials and
`aws s3 sync` copied all three objects, 2,000,261 bytes.

**Configuration.** `gregale project export` wrote a two-service project as
a Compose file in 2.3 seconds, with memory limits and the variables
`${FEATURE_FLAGS}` and `${LOG_LEVEL}` by name. It warned that one service's
build directory was a guess, since none had been recorded. `gregale env pull` wrote the app's 9 secret names with blank
values, among them a token we had set ourselves; the plain `LOG_LEVEL=info`
showed in `gregale env list` instead.

**Account.** `gregale account export --no-secrets` wrote a 30 MB JSON file
for our test account in 11.8 seconds: apps and their settings, every
deployment with its image digest, builds, crons, edge rules, usage and the
audit trail. It doesn't hold database contents, bucket objects or
environment values; export those as above.

## What stays behind

- **Secret values.** A sealed value is never returned or logged once it's
  set. Keep the source of truth in your own password
  manager or secrets store, and set the values again on the new host.
- **Built images.** Gregale doesn't offer a download of the images it
  builds; the account export lists their digests only. An app deployed
  with a Dockerfile rebuilds anywhere. One deployed without a Dockerfile
  needs one written for it; `gregale deploy --preview` shows the detected
  runtime, port and health path to start from.
- **Platform features.** Scale to zero, edge rules, crons and release
  checks are Gregale settings. Other hosts have their own versions, or
  none, so plan to set them up again.

## How other platforms compare

Checked on each vendor's own pages on December 5, 2026:

| Platform | Database export                                                                   | Secret values readable later                               | Config file                                                           | Built image                              |
| -------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------- | --------------------------------------------------------------------- | ---------------------------------------- |
| Heroku   | `pg:backups:capture`, then `pg:backups:download`; meant for databases up to 20 GB | Yes, `heroku config` shows them                            | `app.json` for app setup                                              | Yes, the Slug API returns a download URL |
| Render   | "Create export" in the dashboard; kept 7 days; not on Free databases              | Not stated for variables; secret files can be revealed     | `render.yaml`                                                         | Not stated                               |
| Railway  | No export feature documented; backups restore into the same project               | Yes, except sealed variables, which can't be read back     | `railway.json` or `railway.toml`, marked deprecated, until 2027-01-01 | Not stated                               |
| Fly.io   | Managed Postgres backups, no download documented                                  | No: "we do not allow read access to the plain-text values" | `fly.toml`                                                            | Not stated                               |
| Gregale  | `pg_dump` through `gregale app exec`                                              | No, sealed values are never shown                          | `gregale.yaml`, and `gregale project export` to Compose               | No; rebuild from your source             |

The pattern: platforms that keep secrets write-only (Fly.io, Railway's
sealed variables, Gregale) make you keep your own copy, and the ones that
show them back (Heroku) let you copy them on the way out. Wherever you go,
a plain `pg_dump` is the most portable form of a Postgres database.

## Before you leave

1. Lower the TTL on your DNS records a day ahead.
2. Stop writes, for example with `gregale app update my-api --maintenance`,
   which answers every request with 503, then take the final `pg_dump` and
   bucket sync.
3. Run `gregale account export` for your records, and
   `gregale billing export --month YYYY-MM` for each month's invoice data.
4. Point DNS at the new host and check it serves.
5. Delete with `gregale account delete`. Deletion waits 30 days, and
   `gregale account restore` cancels it until then. The
   [DPA](https://gregale.dev/docs/dpa.md) keeps the export available until that grace period
   ends, and personal data is deleted within 30 days after.

## Sources

Gregale facts come from the production run above and the
[account](https://gregale.dev/docs/account.md#export-and-deletion),
[environment variables](https://gregale.dev/docs/env.md), [Postgres](https://gregale.dev/docs/postgres.md),
[object storage](https://gregale.dev/docs/object-storage.md), [compliance](https://gregale.dev/docs/compliance.md) and
[DPA](https://gregale.dev/docs/dpa.md) docs. Other platforms, checked December 5, 2026:
[Heroku Postgres import and export](https://devcenter.heroku.com/articles/heroku-postgres-import-export),
[Heroku config vars](https://devcenter.heroku.com/articles/config-vars),
[Heroku Platform API](https://devcenter.heroku.com/articles/platform-api-reference),
[Render Postgres backups](https://render.com/docs/postgresql-backups),
[Render environment variables](https://render.com/docs/configure-environment-variables),
[Render Blueprint spec](https://render.com/docs/blueprint-spec),
[Railway backups](https://docs.railway.com/reference/backups),
[Railway variables](https://docs.railway.com/guides/variables),
[Railway config as code](https://docs.railway.com/reference/config-as-code),
[Fly.io secrets](https://docs.fly.io/apps/secrets),
[Fly.io Managed Postgres](https://docs.fly.io/mpg),
[Fly.io app configuration](https://docs.fly.io/reference/configuration).

## Questions

### Can I export my Postgres database from Gregale?

Yes. Run pg_dump inside the app with gregale app exec, where DATABASE_URL is already set, and stream the dump to your machine. In a production run on December 5, 2026, a 292 KB dump took 4.1 seconds and restored into another PostgreSQL with every row count matching.

### Can I get my secret values back from Gregale?

No. Sealed values are never returned or logged once set, and gregale env pull writes secret names with blank values. Keep the source of truth in your own password manager or secrets store. Fly.io and Railway sealed variables work the same way; Heroku shows config var values.

### How do I copy files out of Gregale object storage?

Buckets speak the S3 API at https://s3.gregale.dev, so aws s3 sync or rclone copy a whole bucket with its S3 credentials. For one object, gregale bucket download needs no S3 credentials. In our run, a 2 MB file downloaded in 2.6 seconds with a matching SHA-256.

### Can I download the container image Gregale built?

No. Gregale does not offer image downloads, and the account export lists image digests only. An app with a Dockerfile rebuilds anywhere; for one deployed without a Dockerfile, gregale deploy --preview shows the detected runtime, port and health path to write one from.

### What happens to my data when I delete my Gregale account?

Deletion waits 30 days, and gregale account restore cancels it until then. The Data Processing Addendum keeps the account export available until that grace period ends, and personal data is deleted within 30 days after it.

Canonical URL: https://gregale.dev/articles/leave-gregale-export-data

