Files
supabase/apps/docs/content/guides/self-hosting/copy-from-platform-s3.mdx
Miranda Limonczenko 28d9157aab docs: stop guide subtitles from repeating the first sentence (#52568)
Closes DOCS-1553

## Problem

Some guides set a subtitle that says almost exactly what the first
sentence of the page says, so the reader reads the same line twice.

## Solution

- Add a **Write good frontmatter** section to the style guide, with
**Title**, **Subtitle**, and **Description** subsections. A title is 35
characters or fewer, in sentence case, and follows the Google developer
style guide's title rules. A subtitle is optional and decorative. If it
matches the first sentence, leave it out. A description is 150–160
characters, with relevant keywords.
- Remove the subtitle on 12 guides where it repeated the first sentence.
On the 6 of those with no description, move the subtitle to
`description` so the meta description doesn't change.
- Change the Vault subtitle to `Manage secrets in Postgres` to match the
rule's example.
- In `CONTRIBUTING.md`, mark `description` as required and link to the
new section.

## Manual testing

1. Open [Creating a
client](https://docs-git-docs-guide-subtitles-supabase.vercel.app/docs/guides/auth/server-side/creating-a-client).
See no subtitle under the title.
2. Open
[Vault](https://docs-git-docs-guide-subtitles-supabase.vercel.app/docs/guides/database/vault).
See `Manage secrets in Postgres` under the title.
3. Read [Write good
frontmatter](https://github.com/supabase/supabase/blob/docs/guide-subtitles/apps/docs/style-guide/03-page-structure.md#write-good-frontmatter).
2026-10-30 12:33:14 -07:00

155 lines
5.3 KiB
Plaintext

---
title: 'Copy Storage Objects from Platform'
description: 'Copy storage objects from a managed Supabase project to a self-hosted instance using rclone.'
---
This guide walks you through copying storage objects from a managed Supabase platform project to a self-hosted instance using [rclone](https://rclone.org/) with S3-to-S3 copy.
<Admonition type="caution">
Direct file copy (e.g., downloading files and placing them into `volumes/storage/`) does not work. Self-hosted Storage uses an internal file structure that differs from what you get when downloading files from the platform. Use the S3 protocol to transfer objects so that Storage creates the correct metadata records.
</Admonition>
## Before you begin
You need:
- A working self-hosted Supabase instance with the S3 protocol endpoint enabled - see [Configure S3 Storage](/docs/guides/self-hosting/self-hosted-s3#enable-the-s3-protocol-endpoint)
- Your platform project's S3 credentials - generated from the [S3 Configuration](/dashboard/project/_/storage/s3) page
- Matching buckets created on your self-hosted instance
- [rclone](https://rclone.org/install/) installed on the machine running the copy
## Step 1: Get platform S3 credentials
In your managed Supabase project dashboard, go to **Storage** > **S3 Configuration** > **Access keys**. Generate a new access key pair and copy:
- **Endpoint**: `https://<project-ref>.supabase.co/storage/v1/s3`
- **Region**: your project's region (e.g., `us-east-1`)
- **Access Key ID** and **Secret access key**
<Admonition type="note">
For better performance with large files, use the direct storage hostname: `https://<project-ref>.storage.supabase.co/storage/v1/s3`
</Admonition>
## Step 2: Create buckets on self-hosted
Buckets must exist on the destination before you can copy objects into them. You can create them through the dashboard UI, or with the **SQL Editor**.
<Admonition type="note">
If you already restored your platform database to self-hosted using the [restore guide](/docs/guides/self-hosting/restore-from-platform), your bucket definitions are already present. You can skip this step.
</Admonition>
To list your platform buckets, connect to your platform database and run:
```sql
select id, name, public from storage.buckets order by name;
```
Then create matching buckets on your self-hosted instance. Connect to your self-hosted database and run:
```sql
insert into storage.buckets (id, name, public)
values
('your-storage-bucket', 'your-storage-bucket', false)
on conflict (id) do nothing;
```
Repeat for each bucket, setting `public` to `true` or `false` as appropriate.
## Step 3: Configure rclone
Create or edit your rclone configuration file (`~/.config/rclone/rclone.conf`):
```ini rclone.conf
[platform]
type = s3
provider = Other
access_key_id = your-platform-access-key-id
secret_access_key = your-platform-secret-access-key
endpoint = https://your-project-ref.supabase.co/storage/v1/s3
region = your-project-region
[self-hosted]
type = s3
provider = Other
access_key_id = your-self-hosted-access-key-id
secret_access_key = your-self-hosted-secret-access-key
endpoint = http://your-domain:8000/storage/v1/s3
region = your-self-hosted-region
```
Replace the credentials with your actual values. For self-hosted, use the `REGION`, `S3_PROTOCOL_ACCESS_KEY_ID` and `S3_PROTOCOL_ACCESS_KEY_SECRET` you configured in [Configure S3 Storage](/docs/guides/self-hosting/self-hosted-s3#enable-the-s3-protocol-endpoint).
Verify both remotes connect:
```sh
rclone lsd platform:
rclone lsd self-hosted:
```
Both commands should list your buckets.
## Step 4: Copy objects
Copy a single bucket:
```sh
rclone copy platform:your-storage-bucket self-hosted:your-storage-bucket --progress
```
To copy all buckets:
```sh
for bucket in $(rclone lsf platform: | tr -d '/'); do
echo "Copying bucket: $bucket"
rclone copy "platform:$bucket" "self-hosted:$bucket" --progress
done
```
<Admonition type="note">
For large migrations, consider adding `--transfers 4` to increase parallelism, or `--checkers 8` to speed up the comparison phase. See the [flags documentation](https://rclone.org/flags/) for all options.
</Admonition>
## Verify the copy
Compare object counts between source and destination:
```sh
rclone size platform:your-storage-bucket && \
rclone size self-hosted:your-storage-bucket
```
Open Studio on your self-hosted instance and browse the storage buckets to confirm files are accessible.
## Troubleshooting
### Signature errors
If you see `SignatureDoesNotMatch` when connecting to either remote:
- **Platform**: Regenerate S3 access keys from your project's Storage Settings. Ensure the endpoint URL includes `/storage/v1/s3`.
- **Self-hosted**: Verify that `REGION`, `S3_PROTOCOL_ACCESS_KEY_ID` and `S3_PROTOCOL_ACCESS_KEY_SECRET` in `.env` file match your rclone config.
### Bucket not found
If rclone reports that a bucket doesn't exist on the self-hosted side, create it first - see [Step 2](#step-2-create-buckets-on-self-hosted). The S3 protocol does not auto-create buckets on copy.
### Timeouts on large files
For very large files, increase rclone's timeout:
```sh
rclone copy platform:your-storage-bucket self-hosted:your-storage-bucket --timeout 30m
```
### Empty listing on platform
If `rclone lsd platform:` returns nothing, verify the endpoint URL ends with `/storage/v1/s3` and that the S3 access keys have not expired. Regenerate them from the dashboard if needed.