diff --git a/script/fetch-prod-db.rb b/script/fetch-prod-db.rb index ececda4ee..59b420d3c 100755 --- a/script/fetch-prod-db.rb +++ b/script/fetch-prod-db.rb @@ -9,7 +9,16 @@ if ARGV.size != 1 end tenant_id = ARGV[0] -CONTAINER = "fizzy-web-production-b2f4038ea1fd054e313308940d9e445428f35b23" + +# Automatically detect the fizzy-web-production container +puts "→ Detecting fizzy-web-production container..." +container_output, status = Open3.capture2(%(ssh app@fizzy-app-101 "docker ps --format '{{.Names}}' | grep fizzy-web-production")) +abort("Failed to detect container") unless status.success? + +CONTAINER = container_output.strip +abort("No fizzy-web-production container found") if CONTAINER.empty? +puts "→ Using container: #{CONTAINER}" + REMOTE_PATH = "/rails/storage/tenants/production/#{tenant_id}/db/main.sqlite3.1" Dir.mktmpdir do |tmpdir|