-
Notifications
You must be signed in to change notification settings - Fork 1
Provisioning
Run one-time setup scripts on remote hosts. The provision command handles uploading and executing host-specific provisioning scripts via SSH.
Since: v0.23.0
strut harbor provision # Run scripts/provision-harbor.sh on the host
strut harbor provision --verify # Run verification section only
strut harbor provision --script ./my.sh # Use custom script
strut harbor provision --dry-run # PreviewPlace provision scripts at:
scripts/
├── provision-harbor.sh # For host "harbor"
├── provision-compass.sh # For host "compass"
└── provision-staging.sh # For host "staging"
Or under infra/scripts/ as an alternative location.
The naming convention is provision-<host-alias>.sh. The host alias comes from the [hosts] section in strut.conf (see Multi-Host Topology).
- Resolves the provision script (convention-based or
--script <path>) - Connects to the host via SSH (from topology or env vars)
- Checks for a
.provisionedmarker (skips if already provisioned) - SCPs the script to
/tmp/on the remote host - Executes it with
sudo bash - Creates a
.provisionedmarker with timestamp on success - Cleans up the remote temp file
| Flag | Description |
|---|---|
--script <path> |
Use a specific script instead of convention lookup |
--verify |
Run only the verification section (safe to re-run) |
--dry-run |
Show execution plan without making changes |
Once a host is provisioned, a marker file is created at <deploy_dir>/.provisioned. This prevents accidental re-provisioning.
To re-provision a host:
- Use
--verifyto re-run the verification section only - Or delete the marker file on the remote host and run again
A provision script is a standard bash script that runs with root access on the remote host. Best practices:
#!/usr/bin/env bash
set -euo pipefail
# --- Provisioning: harbor ---
# Install packages
apt-get update && apt-get install -y docker.io docker-compose-plugin
# Configure Docker
systemctl enable docker
usermod -aG docker ubuntu
# Setup directories
mkdir -p /home/ubuntu/strut
# --- Verification (runs with --verify) ---
if [[ "${1:-}" == "--verify" ]]; then
echo "Verifying..."
docker --version || { echo "Docker not installed"; exit 1; }
docker compose version || { echo "Docker Compose not installed"; exit 1; }
echo "All checks passed"
exit 0
fiThe host alias resolves via:
-
[hosts]section instrut.conf(topology) - Fallback to
VPS_HOST,VPS_USER,VPS_PORT,VPS_SSH_KEYenv vars
# 1. Write provision script
nano scripts/provision-harbor.sh
# 2. Preview what will happen
strut harbor provision --dry-run
# 3. Run provisioning
strut harbor provision
# 4. Verify it worked
strut harbor provision --verify
# 5. Continue with strut setup
strut harbor remote:init --env prod
strut my-app release --env prodstrut · v0.28.0 · Report an Issue
Getting Started
Core Concepts
Operations
- Deployment
- Ship and Rebuild
- GitHub Actions
- Remote Host Setup
- Provisioning
- Blue-Green Deploy
- Deploy Rollback
- Database Backups
- Secrets Management
- Stack Groups
- Lifecycle Hooks
- Notifications
- Key Rotation
- Drift Detection
- Domain and SSL
- Certificate Management
- Gateway Management
- Monitoring
- Volume Management
Advanced
- Security Posture
- VPS Audit and Migration
- Stack Validation
- Data Anonymization
- Debugging
- Local Development
Extending
Contributing