diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts index 4703ccf6216..fc3e6ae2806 100644 --- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts @@ -1955,6 +1955,10 @@ export const local_development: NavMenuConstant = { name: 'Managing config and secrets', url: '/guides/local-development/managing-config', }, + { + name: 'Restoring downloaded backup', + url: '/guides/local-development/restoring-downloaded-backup', + }, { name: 'Customizing email templates', url: '/guides/local-development/customizing-email-templates', diff --git a/apps/docs/content/guides/local-development/restoring-downloaded-backup.mdx b/apps/docs/content/guides/local-development/restoring-downloaded-backup.mdx new file mode 100644 index 00000000000..d8812196b6e --- /dev/null +++ b/apps/docs/content/guides/local-development/restoring-downloaded-backup.mdx @@ -0,0 +1,49 @@ +--- +title: Restoring a downloaded backup locally +subtitle: Restore a backup of a remote database on a local instance to inspect and extract data +--- + +You can restore a downloaded backup to a local Supabase instance. This might be useful if your paused project has exceeded its [restoring time limit](/docs/guides/platform/upgrading#time-limits). You can download the latest backup, then load it locally to inspect and extract your data. + + + +If you want to restore your backup to a hosted Supabase project, follow the [Migrating within Supabase guide](/docs/guides/platform/migrating-within-supabase) instead. + + + +## Downloading your backup + +First, download your project's backup file from dashboard and identify its backup image version (following the `PG:` prefix): + +Project Paused: 90 Days Remaining + +## Restoring your backup + +Given Postgres version `15.6.1.115`, start Postgres locally with `db_cluster.backup` being the path to your backup file. + +```sh +supabase init +echo '15.6.1.115' > supabase/.temp/postgres-version +supabase db start --from-backup db_cluster.backup +``` + +Note that the earliest Supabase Postgres version that supports a local restore is `15.1.0.55`. If your hosted project was running on earlier versions, you will likely run into errors during restore. Before submitting any support ticket, make sure you have attached the error logs from `supabase_db_*` docker container. + +Once your local database starts up successfully, you can connect using psql to verify that all your data is restored. + +```sh +psql 'postgresql://postgres:postgres@localhost:54322/postgres' +``` + +If you want to use other services like Auth, Storage, and Studio dashboard together with your restored database, restart the local development stack. + +```sh +supabase stop +supabase start +``` + +A Postgres database started with Supabase CLI is not production ready and should not be used outside of local development. diff --git a/apps/docs/content/guides/platform/upgrading.mdx b/apps/docs/content/guides/platform/upgrading.mdx index 3e6bf7b99cf..37fa3f7346b 100644 --- a/apps/docs/content/guides/platform/upgrading.mdx +++ b/apps/docs/content/guides/platform/upgrading.mdx @@ -84,7 +84,7 @@ During the 90-day restore window a paused project can be restored to the platfor src="/docs/img/guides/platform/paused-90-day.png" /> -After the 90-day restore window, you can download your project's backup file, and Storage objects from the project dashboard. See [restoring a backup locally](#restoring-a-downloaded-backup-locally) for instructions on how to load that backup locally to recover your data. +After the 90-day restore window, you can download your project's backup file, and Storage objects from the project dashboard. See [restoring a backup locally](/docs/guides/local-development/restoring-downloaded-backup) for instructions on how to load that backup locally to recover your data. -#### Restoring a downloaded backup locally - - - If you want to restore your backup to a hosted Supabase project, you will need to use the - [Migrating within Supabase guide](/docs/guides/platform/migrating-within-supabase) - - -If the 90 day project restore window has expired but you need to access data contained within your project using SQL, you can use the [Supabase CLI](/docs/guides/local-development) to restore the project into a local Postgres instance. - -First, download your project's backup file from dashboard and identify its backup image version (following the `PG:` prefix): - -Project Paused: 90 Days Remaining - -Given Postgres version `15.6.1.115`, start Postgres locally with `db_cluster.backup` being the path to your backup file. - -```sh -supabase init -echo '15.6.1.115' > supabase/.temp/postgres-version -supabase db start --from-backup db_cluster.backup -``` - -Note that the earliest Supabase Postgres version that supports a local restore is `15.1.0.55`. If your hosted project was running on earlier versions, you will likely run into errors during restore. Before submitting any support ticket, make sure you have attached the error logs from `supabase_db_*` docker container. - -Once your local database starts up successfully, you can connect using psql to verify that all your data is restored. - -```sh -psql 'postgresql://postgres:postgres@localhost:54322/postgres' -``` - -If you want to use other services like Auth, Storage, and Studio dashboard together with your restored database, restart the local development stack. - -```sh -supabase stop -supabase start -``` - -A Postgres database started with Supabase CLI is not production ready and should not be used outside of local development. - #### Disk sizing When upgrading, the Supabase platform will "right-size" your disk based on the current size of the database. For example, if your database is 100GB in size, and you have a 200GB disk, the upgrade will reduce the disk size to 120GB (1.2x the size of your database).