Post Deploy Configuration
Ruby Post-Deploy Configuration
Ruby applications often require additional tasks after deployment, such as database migrations, token generation, or loading default data. The platform automates these tasks through a project-level rake_deploy file.
Post-Deploy Configuration Overview
The platform can execute Rake tasks after an application is deployed. This is useful for finalizing complex application setup, running additional application-specific actions, or applying configuration tasks such as db:migrate.
rake_deployrake keyword.Create the rake_deploy File
Open the application root
Open the configuration-file manager or connect to the Ruby application server through SSH, then navigate to the project root directory.
Create rake_deploy
Create a new text file named exactly rake_deploy.
Add the required commands
Enter each Rake task on a separate line.
$COMMAND_NAME_1 $COMMAND_NAME_2 ... $COMMAND_NAME_N
Do not include the rake prefix
The file should contain only the task names. The platform automatically adds rake when executing each line.
How Commands Are Executed
For the previous rake_deploy example, the platform runs:
rake $COMMAND_NAME_1 rake $COMMAND_NAME_2 ... rake $COMMAND_NAME_N
- The first command must complete before the next command starts.
- The commands are triggered when the Apache or NGINX service restarts.
- After successful execution, the
rake_deployfile is removed automatically. - For different tasks on the next deployment, create a new
rake_deployfile containing the new command list.
Repeatable deployment tasks
Keep the file in the deployment package or generate it during the release process when the same post-deployment tasks must be performed after every deployment.
Redmine Example
For a Redmine deployment, the rake_deploy file can contain:
generate_secret_token db:migrate redmine:load_default_data
The platform executes the tasks as follows:
rake generate_secret_token rake db:migrate rake redmine:load_default_data
Freeze gems
To freeze gems, add gems:unpack as another command in the rake_deploy file.
Review Execution Logs
The platform saves the output generated by each rake_deploy execution in a corresponding log file. Open the environment’s Logs view in the dashboard to review task output and troubleshoot failures.
- Confirm that every task started and completed.
- Check database connection or migration errors.
- Review missing-gem or dependency messages.
- Confirm that the
rake_deployfile was removed after successful completion.
Expected Result
After the Apache or NGINX service restarts, the platform executes each task listed in rake_deploy sequentially through Rake. The output is written to the dashboard logs, and the file is deleted automatically when all commands finish successfully.
Important Notes
- Place
rake_deployin the application root directory. - Add one task per line.
- Do not include the
rakeprefix in the file. - Commands run sequentially after an Apache or NGINX restart.
- The file is removed only after successful execution.
- Create a new file when different commands are needed for a later deployment.
- Review the Logs view when a task does not complete.
Common Issues and Solutions
rake_deploy, is stored in the application root, and the Apache or NGINX service was restarted.