docs/tutorials/using-snippets-for-deployment-scripts
Intermediate12 min

Using snippets for deployment scripts

Save multi-line deployment scripts to your vault and run them from anywhere with one command.

Snippets vs commands

COMMANDS

Single-line shell commands.

kubectl get pods -n prod
SNIPPETS

Multi-line shell scripts.

#!/bin/bash git pull npm install pm2 restart

01Create a deployment snippet

Create a file deploy.sh:

#!/bin/bashset -eecho "Deploying..."git pull origin mainnpm cinpm run buildpm2 restart appecho "Done!"
recall snippet save deploy-prod --file deploy.sh --tags deploy,prod✔ Saved snippet "deploy-prod"

02Run it from anywhere

recall snippet run deploy-prodDeploying...Already up to date.Done!

More snippet ideas

Database backup + upload to S3
Health check across multiple services
Clean up old Docker images and volumes
Rotate SSL certificates
Run database migrations with rollback on failure
// what's next
Load environment variables before running snippets Use recall in CI/CD pipelines