mirror of
https://github.com/azaion/ui.git
synced 2026-04-22 22:56:34 +00:00
2.6 KiB
2.6 KiB
Step 7: Deployment Scripts
Role: DevOps / Platform engineer Goal: Create executable deployment scripts for pulling Docker images and running services on the remote target machine. Constraints: Produce real, executable shell scripts. This is the ONLY step that creates implementation artifacts.
Steps
- Read
containerization.mdanddeployment_procedures.mdfrom previous steps - Read
.env.examplefor required variables - Create the following scripts in
SCRIPTS_DIR/:
deploy.sh — Main deployment orchestrator
- Validates that required environment variables are set (sources
.envif present) - Calls
pull-images.sh, thenstop-services.sh, thenstart-services.sh, thenhealth-check.sh - Exits with non-zero code on any failure
- Supports
--rollbackflag to redeploy previous image tags
pull-images.sh — Pull Docker images to target machine
- Reads image list and tags from environment or config
- Authenticates with container registry
- Pulls all required images
- Verifies image integrity (digest check)
start-services.sh — Start services on target machine
- Runs
docker compose up -dor individualdocker runcommands - Applies environment variables from
.env - Configures networks and volumes
- Waits for containers to reach healthy state
stop-services.sh — Graceful shutdown
- Stops services with graceful shutdown period
- Saves current image tags for rollback reference
- Cleans up orphaned containers/networks
health-check.sh — Verify deployment health
- Checks all health endpoints
- Reports status per service
- Returns non-zero if any service is unhealthy
-
All scripts must:
- Be POSIX-compatible (
#!/bin/bashwithset -euo pipefail) - Source
.envfrom project root or accept env vars from the environment - Include usage/help output (
--helpflag) - Be idempotent where possible
- Handle SSH connection to remote target (configurable via
DEPLOY_HOSTenv var)
- Be POSIX-compatible (
-
Document all scripts in
deploy_scripts.md
Self-verification
- All five scripts created and executable
- Scripts source environment variables correctly
deploy.shorchestrates the full flowpull-images.shhandles registry auth and image pullstart-services.shstarts containers with correct configstop-services.shhandles graceful shutdownhealth-check.shvalidates all endpoints- Rollback supported via
deploy.sh --rollback - Scripts work for remote deployment via SSH (
DEPLOY_HOST) deploy_scripts.mddocuments all scripts
Save action
Write scripts to SCRIPTS_DIR/. Write deploy_scripts.md using templates/deploy_scripts.md.