Custom Deployment Actions
You can define custom actions in the Squash YAML file. These are custom commands that will be executed inside your application’s container or within the host VM itself. When you define a custom action it will appear in the Deployment settings page, as a new item within the “Actions” dropdown.
This is an easy way to quickly run routine/common tasks inside a Squash deployment without the need of having to SSH to the host VM.
Here is an example of two custom actions we have defined, the YAML file sample is below.
Example YAML file. Because we are not specifying any container names these commands will be executed inside all containers.
deployments: CRM: filename: ./src/CRM/docker-compose.yml context_path: ./src vm_size: 2GB deployment_page_commands: Restart Cache: - /etc/init.d/memcached restart Git Pull & App Restart: - /home/code/acme-app/etc/my_init.d/app-restart.sh
And here is another example that is container specific, the “Restart Cache” command below will only execute inside container named “app-container”:
deployments: CRM: filename: ./src/CRM/docker-compose.yml context_path: ./src vm_size: 2GB deployment_page_commands: Restart Cache: app-container: - /etc/init.d/memcached restart
And lastly, you may also define commands that will be executed in the host VM itself, outside any containers.
- Note that squash_host is a reserved word, Squash uses this to detect when a command needs to run in the host VM.
- The path /home/test-instance/code is the standard path where Squash downloads your branch of code.
MyApp: filename: ./src/Dockerfile deployment_page_commands: Update App: squash_host: - /home/test-instance/code/update_app.sh
For more details please check the deployment_page_commands specification.