Skip to content

FEATURE: Add utilities for backups and remote URLs #32992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nbianca
Copy link
Member

@nbianca nbianca commented May 29, 2025

This commit introduces two new features related to the backup and
restore system that make use of remote URLs:

  • discourse backup_url generates a URL of a backup file

  • discourse restore <backup> can now accept a URL to a backup file,
    that is downloaded and then restored

These two utilities make it easier to manage backups, especially when
trying to move backups between different servers without using an
intermediate storage location (download to local machine and then upload
to local machine).

discourse backup_url creates a temporary API key (expires after 1 day)
and a "backup token" to access the backup file. The first key is
necessary because only logged in users can access backup files. This
also provides a layer of security because the key is limited to a
specific backup file and token. The second token is necessary to limit
access to the backup file and avoid presigned URLs for longer periods of
time.

@nbianca nbianca marked this pull request as draft May 30, 2025 07:50
@nbianca nbianca changed the title Add utilities for backups and remote URLs FEATURE: Add utilities for backups and remote URLs Jun 2, 2025
@nbianca nbianca marked this pull request as ready for review June 3, 2025 20:10
script/discourse Outdated
return
end

token = EmailBackupToken.set(Discourse.system_user.id)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the case when store is remote (e.g. S3), I can return a presigned URL to avoid dealing with API keys and backup email tokens.

This commit introduces two new features related to the backup and
restore system that make use of remote URLs:

- `discourse backup_url` generates a URL of a backup file

- `discourse restore <backup>` can now accept a URL to a backup file,
that is downloaded and then restored

These two utilities make it easier to manage backups, especially when
trying to move backups between different servers without using an
intermediate storage location (download to local machine and then upload
to local machine).

`discourse backup_url` works only for remote backup stores (S3).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant