-
Notifications
You must be signed in to change notification settings - Fork 0
Remote Host Setup
Guide to bootstrapping strut on a remote VPS so that release, update, and other remote commands work correctly.
When you run strut my-stack release --env prod, strut SSHes into the VPS and expects:
-
The project repository cloned at
VPS_DEPLOY_DIR(default:/home/$VPS_USER/strut) -
The
strutCLI executable at$VPS_DEPLOY_DIR/strut -
An env file (e.g.
.prod.env) in the deploy directory with production secrets -
Docker + Docker Compose installed and accessible to
VPS_USER
If any of these are missing, release will fail. The remote:init command automates steps 1–2.
The fastest way to set up a new VPS:
# Stack-scoped (reads VPS_HOST, VPS_USER, etc. from your env file)
strut my-stack remote:init --env prod
# Standalone with explicit connection params
strut remote:init --host compass.local --user gfargo --key ~/.ssh/id_rsa| Step | Action |
|---|---|
| 1 | Tests SSH connectivity |
| 2 | Checks if strut is already installed (reports version/branch if so) |
| 3 | Clones the project repository (uses GH_PAT if set, otherwise interactive auth) |
| 4 | Makes strut executable and verifies strut --version on the remote |
| Flag | Description |
|---|---|
--host <host> |
VPS hostname or IP (overrides VPS_HOST) |
--user <user> |
SSH user (overrides VPS_USER) |
--key <path> |
SSH key path (overrides VPS_SSH_KEY) |
--port <port> |
SSH port (overrides VPS_PORT, default: 22) |
--repo <url> |
Git repository URL (default: detected from local git remote) |
--branch <name> |
Branch to checkout (default: main) |
--deploy-dir <path> |
Remote deploy directory (overrides VPS_DEPLOY_DIR) |
--dry-run |
Show execution plan without making changes |
strut my-stack remote:init --env prod --dry-runIf you prefer to set up manually (or need to customize beyond what remote:init provides):
# SSH into your VPS
ssh user@your-vps
# Clone with HTTPS + PAT
git clone https://oauth2:YOUR_PAT@github.com/org/repo.git ~/strut
# Or clone with SSH (requires deploy key on VPS)
git clone git@github.com:org/repo.git ~/strutchmod +x ~/strut/strut
~/strut/strut --version# From your local machine
scp .prod.env user@your-vps:~/strut/ssh user@your-vps "cd ~/strut && ./strut my-stack health --env prod"Set GH_PAT in your env file. strut uses it for both remote:init and update:
# In .prod.env
GH_PAT=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxThe PAT needs Contents (read) and Metadata (read) permissions on the repository.
Create one at: https://github.com/settings/tokens?type=beta
Generate a dedicated SSH key on the VPS and add it as a deploy key on GitHub:
ssh user@your-vps "ssh-keygen -t ed25519 -f ~/.ssh/strut_deploy_key -N '' -C 'strut@your-vps'"
ssh user@your-vps "cat ~/.ssh/strut_deploy_key.pub"Then add the public key at: Repository → Settings → Deploy keys → Add deploy key
The remote:init command offers this flow interactively when no PAT is available.
After initial setup, use update to pull the latest code:
strut my-stack update --env prodThis runs git fetch && git reset --hard origin/main in the deploy directory. It requires GH_PAT for private repos.
strut isn't initialized on the remote. Run:
strut my-stack remote:init --env prodYour SSH agent is offering too many keys. strut v0.20.2+ adds IdentitiesOnly=yes when a key is specified. Upgrade strut or set VPS_SSH_KEY in your env file.
The VPS doesn't accept your SSH key. Verify:
- Key permissions:
chmod 600 ~/.ssh/id_rsa - Key is in
~/.ssh/authorized_keyson the VPS -
VPS_SSH_KEYpoints to the correct key
- For HTTPS: verify
GH_PAThas access to the repository - For SSH: verify the deploy key is added to the correct repository
- Check the repo URL:
git remote get-url origin
strut · v0.1.0 · Report an Issue
Getting Started
Core Concepts
Operations
- Deployment
- Remote Host Setup
- Blue-Green Deploy
- Deploy Rollback
- Database Backups
- Stack Groups
- Lifecycle Hooks
- Notifications
- Key Rotation
- Drift Detection
- Domain and SSL
- Monitoring
- Volume Management
Advanced
- Security Posture
- VPS Audit and Migration
- Stack Validation
- Data Anonymization
- Debugging
- Local Development
Extending
Contributing