Deploy and rebuild the database on Dokku
masterIf you are hosting bible_api on Dokku and need to rebuild the database (e.g., after a migration or initial setup), follow these steps to create a new database, import the data using the provided Ruby script, and promote the new database to production.
Note: Replace bible_api_2024 with your desired database name and bible-api.com with your actual Dokku app name. Ensure you use the correct environment variable provided by Dokku for the DATABASE_URL during the import step.
# 1. Create and link the new database
dokku mysql:create bible_api_2024
dokku mysql:link bible_api_2024 bible-api.com
# 2. Enter the app container and run the import script
dokku enter bible-api.com
# Inside the container, use the Dokku-provided MySQL URL
DATABASE_URL="$DOKKU_MYSQL_AQUA_URL" ruby import.rb
exit
# 3. Promote the new database to production
dokku mysql:promote bible_api_2024 bible-api.com
# 4. Cleanup old databases (optional)
dokku mysql:unlink bible_api_2023 bible-api.com
dokku mysql:stop bible_api_2023
dokku mysql:destroy bible_api_2023