Get the FREE Ultimate OpenClaw Setup Guide →

app-deployment

Scanned
npx machina-cli add skill The-Focus-AI/marina-skill/app-deployment --openclaw
Files (1)
SKILL.md
3.0 KB

App Deployment Skill

You help deploy applications using a git-push-to-deploy workflow.

Setup

  1. Run bash ${CLAUDE_PLUGIN_ROOT}/scripts/check-deps.sh to verify tools are available.

How Deployment Works

  1. User runs git push production main
  2. SSH connects to server as deploy user
  3. SSH forced-command routes to deployer script
  4. deployer creates a bare git repo (first time), receives the push
  5. post-receive hook checks out code and runs docker build
  6. deployer stops old container and starts new one with Caddy labels
  7. Caddy automatically provisions HTTPS and reverse proxies to port 8080

App requirements:

  • Must have a Dockerfile in the project root
  • Container must listen on port 8080

Scripts

Deployment utilities use ${CLAUDE_PLUGIN_ROOT}/scripts/deploy.sh:

Copy env to server

bash ${CLAUDE_PLUGIN_ROOT}/scripts/deploy.sh env

Copies .env.production (preferred) or .env to the server and restarts the container.

Restart container

bash ${CLAUDE_PLUGIN_ROOT}/scripts/deploy.sh restart

Force rebuild

bash ${CLAUDE_PLUGIN_ROOT}/scripts/deploy.sh push-empty

Creates an empty commit and pushes to trigger a full rebuild.

Show remote info

bash ${CLAUDE_PLUGIN_ROOT}/scripts/deploy.sh info

Setting Up a New Deployment

Walk the user through these steps:

  1. Check prerequisites:

    • Verify Dockerfile exists
    • Check the app listens on port 8080
  2. Check for existing remote: git remote -v | grep production

  3. If no production remote, guide setup: a. List servers: bash ${CLAUDE_PLUGIN_ROOT}/scripts/server.sh list b. Discover domains: bash ${CLAUDE_PLUGIN_ROOT}/scripts/dns.sh list-zones c. Pick/create server and choose app name d. Add remote: git remote add production deploy@<server>.<domain>:<appname>.<domain> e. Add DNS: bash ${CLAUDE_PLUGIN_ROOT}/scripts/dns.sh add <appname>.<domain> <server_ip> f. Push: git push production main

  4. After deployment: the app is at https://<appname>.<domain> (Caddy handles HTTPS).

Git Remote Format

deploy@<server-hostname>:<site-fqdn>

Example: deploy@web1.example.com:myapp.example.com

The site FQDN becomes both the Docker container name and the hostname Caddy uses for routing/HTTPS.

Behavior

  • Check for Dockerfile before attempting deployment
  • When setting up, show the full git remote URL and confirm
  • After deployment, tell the user the app URL
  • If deployment fails, suggest checking logs: ssh deploy@<server> (shows last 20 log entries)
  • Warn about sensitive values before copying env files

Source

git clone https://github.com/The-Focus-AI/marina-skill/blob/main/skills/app-deployment/SKILL.mdView on GitHub

Overview

Deploy apps using a git-push-to-deploy workflow. It sets up a production remote, pushes code, manages environment variables, and restarts containers, with Caddy provisioning HTTPS and routing to port 8080.

How This Skill Works

On push to production main, an SSH login as deploy triggers a deployer script via a forced command. The script creates a bare git repo if needed, receives the push, and the post-receive hook checks out code and runs docker build, then the deployer stops the old container and starts a new one labeled for Caddy. Caddy then provisions HTTPS and reverse proxies to port 8080.

When to Use It

  • Deploy a new app to a remote server using a production remote
  • Update an existing app by pushing code to production main
  • Copy environment variables to the server before restarting the container
  • Force a full rebuild after env or dependency changes
  • Verify the app URL and HTTPS via Caddy after deployment

Quick Start

  1. Step 1: Check prerequisites: verify Dockerfile exists and the app listens on port 8080
  2. Step 2: Check for a production remote; if absent, run server and DNS discovery commands and add the remote, then push to production main
  3. Step 3: After deployment, verify the app at https://<appname>.<domain> and use deploy.sh info to view remote details

Best Practices

  • Ensure a Dockerfile exists in the project root
  • Confirm the app listens on port 8080
  • Check for an existing production remote before pushing
  • Copy env files with caution and restart the container after deploy
  • Use the deploy.sh scripts (env, restart, push-empty, info) for common tasks

Example Use Cases

  • Deploying a new app to a server via git push production main
  • Updating an existing app by pushing new code to production main and watching deployments
  • Copying .env.production to the server and restarting the container
  • Forcing a rebuild with push-empty to trigger a full docker build
  • Checking remote info after setting up a new deployment

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers