Created
July 2, 2024 04:37
-
-
Save bibstha/cd3c8cf65425fc6fa0a5f2fe0766f815 to your computer and use it in GitHub Desktop.
Kamal pre-deploy hook to run database migrations. File path .kamal/hooks/pre-deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# These environment variables are available: | |
# KAMAL_RECORDED_AT | |
# KAMAL_PERFORMER | |
# KAMAL_VERSION | |
# KAMAL_HOSTS | |
# KAMAL_COMMAND | |
# KAMAL_SUBCOMMAND | |
# KAMAL_ROLE (if set) | |
# KAMAL_DESTINATION (if set) | |
# Only check the build status for production deployments | |
if ENV["KAMAL_COMMAND"] == "rollback" || ENV["KAMAL_DESTINATION"] != "production" | |
exit 0 | |
end | |
`kamal app exec -p -d $KAMAL_DESTINATION --version $KAMAL_VERSION "rails db:migrate"` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment