Deployment workflows - davidgb8246/RapidRollout GitHub Wiki
π Deployment Workflows
RapidRollout gives you full control over custom logic during deployments by allowing you to define After Start Script Files. These scripts are executed as root
after your application has been initialized.
- If your project uses Docker Compose, scripts will run after
docker compose up -d
has completed. - If not, theyβll run after the repository has been downloaded and all private files have been saved to the system.
This allows you to execute service configurations, migrations, or any system-level commands in a reliable and automated way.
π§© What Is an After Start Script?
An After Start Script File is a special type of private file that runs automatically during key deployment events. These are defined in the Private Files section by selecting the file type after-start-script
.
π¦ When Scripts Run
These scripts are triggered during three types of events:
Event | Description |
---|---|
PROJECT_DEPLOY |
When a new deployment is triggered (on git push ) |
PROJECT_REBOOT |
When a reboot is manually initiated from the dashboard |
PROJECT_REBUILD |
When a rebuild is manually initiated from the dashboard |
β
All scripts run with bash
and root permissions, so you have full control over system-level operations.
π€ Input Passed to Scripts
Each script receives a JSON payload via stdin, which provides context about the event that triggered the execution.
π Payload Format
PROJECT_DEPLOY
:
For {
"user": "deploy-user-abc123",
"action": "PROJECT_DEPLOY",
"deployment_id": "a1b2c3d4-e5f6-7890-1234-abcdef123456"
}
PROJECT_REBOOT
and PROJECT_REBUILD
:
For {
"user": "deploy-user-abc123",
"action": "PROJECT_REBOOT" // or PROJECT_REBUILD
}
You can access and parse this input in your script using common shell tools.
π¦ Example usage in script:
#!/bin/bash
# Parse JSON input argument into associative array
json_arg="$1"
# Declare associative array
declare -A data
# Populate the array using jq safely
while IFS="=" read -r key value; do
data["$key"]="$value"
done < <(echo "$json_arg" | jq -r 'to_entries[] | "\(.key)=\(.value)"')
echo "Running ${data["action"]} for user ${data["user"]}"
π Sending Deployment Debug Messages
When running an After Start Script File during a project deployment, you can send debug or status messages to RapidRollout using a built-in endpoint:
POST /api/management/addDeploymentStatusMessage/
π Requirements
This endpoint should only be used during project deployments, as the messages must be linked to a specific deployment via its UUID.
Required Parameters:
deployment_id
(string): The UUID of the active deployment.secret
(string): The projectβs secret key, generated during project creation or manually reset from the dashboard.message
(string): The message you want to log for debugging or informational purposes.
π¦ Example Payload (JSON)
{
"deployment_id": "123e4567-e89b-12d3-a456-426614174000",
"secret": "your-project-secret-key",
"message": "Finished running setup.sh successfully."
}
β Use Cases
- Reporting progress of post-deployment tasks.
- Logging outputs or important checkpoints for debugging.
- Letting the dashboard reflect detailed messages during setup.
β οΈ Note: Do not use this endpoint for rebuild or reboot actions, as those do not generate a
deployment_id
and cannot accept messages.
β Tips
- Scripts should be safe to run multiple times without causing errors or unexpected behavior.
- Test your scripts thoroughly before adding them.
- You can use this to configure services, restart daemons, run migrations, or anything your app needs post-startup.
π§ Permissions & Security
- Scripts are executed as root, so use caution.
- Make sure the script files have execute permissions (e.g.,
755
). - Never expose sensitive logic or secrets directly in scripts.
By using these After Start Scripts, RapidRollout gives you the flexibility to adapt your deployments to your app's unique infrastructure needs.