300dffd376
ref: https://3.basecamp.com/2914079/buckets/37331921/messages/8422006338 The script takes advantage of the fact that we can bind to the existing untenanted database by adding it explicitly (and temporarily) as a readonly shard to the database.yml, and so in the script with_original_db is connected to the original database. storage/tenants/%{tenant}/ is now the root directory for all state stored for a particular tenant, including active storage and the database. We leave the existing files and production database in place after the migration, in case we need to roll back (by reverting the code and config). We also don't do a granular active storage blob copy, since the attachments are mostly on Account (and not on Bubble). Instead we hardlink the blobs on disk (so we don't take up additional space with duplicates). Finally, we're manually adding the kamal-proxy hosts to the deploy file, so that we can generate letsencrypt certs for the subdomains. This is only intended to be a short-term solution, we'll want something like a wildcard cert before we go live.
37 lines
1.2 KiB
YAML
37 lines
1.2 KiB
YAML
test:
|
|
service: Disk
|
|
root: <%= Rails.root.join("tmp/storage/%{tenant}") %>
|
|
tenanted: true
|
|
|
|
local:
|
|
service: Disk
|
|
root: <%= Rails.root.join("storage", "tenants", Rails.env, "%{tenant}", "files") %>
|
|
tenanted: true
|
|
|
|
# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
|
# amazon:
|
|
# service: S3
|
|
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
|
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
|
# region: us-east-1
|
|
# bucket: your_own_bucket-<%= Rails.env %>
|
|
|
|
# Remember not to checkin your GCS keyfile to a repository
|
|
# google:
|
|
# service: GCS
|
|
# project: your_project
|
|
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
|
# bucket: your_own_bucket-<%= Rails.env %>
|
|
|
|
# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
|
# microsoft:
|
|
# service: AzureStorage
|
|
# storage_account_name: your_account_name
|
|
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
|
# container: your_container_name-<%= Rails.env %>
|
|
|
|
# mirror:
|
|
# service: Mirror
|
|
# primary: local
|
|
# mirrors: [ amazon, google, microsoft ]
|