Generic DigitalOcean droplet deployment using doctl CLI for any application type (APIs, web servers, background workers). Includes validation, deployment scripts, systemd service management, secret handling, health checks, and deployment tracking. Use when deploying Python/Node.js/any apps to droplets, managing systemd services, handling secrets securely, or when user mentions droplet deployment, doctl, systemd, or server deployment.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
README.mdscripts/deploy-to-droplet.shscripts/update-secrets.shThis skill provides comprehensive deployment lifecycle management for applications deployed directly to DigitalOcean droplets using doctl CLI and systemd service management.
The deployment lifecycle consists of five phases:
Script: scripts/validate-app.sh <app-path>
Purpose: Validates application is ready for deployment
Checks:
Usage:
# Validate Python app
./scripts/validate-app.sh /path/to/python-app
# Validate Node.js app
./scripts/validate-app.sh /path/to/nodejs-app
# Verbose mode
VERBOSE=1 ./scripts/validate-app.sh .
Exit Codes:
0: Validation passed1: Validation failed (must fix before deployment)Script: scripts/deploy-to-droplet.sh <app-path> <droplet-ip> <app-name>
Purpose: Deploys application to DigitalOcean droplet
Actions:
Usage:
# Deploy Python app
./scripts/deploy-to-droplet.sh /path/to/app 137.184.196.101 myapp
# Deploy with custom port
PORT=8080 ./scripts/deploy-to-droplet.sh /path/to/app 137.184.196.101 myapp
# Deploy with specific Python version
PYTHON_VERSION=3.11 ./scripts/deploy-to-droplet.sh /path/to/app 137.184.196.101 myapp
# Deploy Node.js app
APP_TYPE=nodejs ./scripts/deploy-to-droplet.sh /path/to/app 137.184.196.101 myapp
Environment Variables:
APP_TYPE: python or nodejs (auto-detected if not specified)PORT: Port to run on (default: 8000)PYTHON_VERSION: Python version (default: 3.11)NODE_VERSION: Node.js version (default: 20)SERVICE_USER: User to run service as (default: root)APP_DIR: Target directory on droplet (default: /opt/<app-name>)Required Environment Variables (must be set before running):
.env.example must be providedExit Codes:
0: Deployment successful1: Deployment failedScript: scripts/update-secrets.sh <droplet-ip> <app-name>
Purpose: Updates environment variables without redeploying code
Actions:
Usage:
# Update secrets interactively
./scripts/update-secrets.sh 137.184.196.101 myapp
# Update from local .env file
ENV_FILE=.env.production ./scripts/update-secrets.sh 137.184.196.101 myapp
Exit Codes:
0: Secrets updated successfully1: Update failedScript: scripts/health-check.sh <droplet-ip> <app-name> [port]
Purpose: Validates deployment health and service status
Checks:
Usage:
# Check service health
./scripts/health-check.sh 137.184.196.101 myapp
# Check with custom port
./scripts/health-check.sh 137.184.196.101 myapp 8080
# Continuous monitoring (runs every 30s)
MONITOR=true ./scripts/health-check.sh 137.184.196.101 myapp
Exit Codes:
0: All health checks passed1: One or more health checks failedScript: scripts/manage-deployment.sh <action> <droplet-ip> <app-name>
Purpose: Manage deployed application lifecycle
Actions:
start: Start the servicestop: Stop the servicerestart: Restart the servicestatus: Show service statuslogs: View service logsrollback: Rollback to previous versionremove: Remove deployment completelyUsage:
# Restart service
./scripts/manage-deployment.sh restart 137.184.196.101 myapp
# View logs (last 100 lines)
./scripts/manage-deployment.sh logs 137.184.196.101 myapp
# View logs (follow)
FOLLOW=true ./scripts/manage-deployment.sh logs 137.184.196.101 myapp
# Rollback to previous version
./scripts/manage-deployment.sh rollback 137.184.196.101 myapp
# Remove deployment
./scripts/manage-deployment.sh remove 137.184.196.101 myapp
File: templates/systemd-service.template
Purpose: Systemd service file template for any application type
Variables:
{{APP_NAME}}: Application name{{APP_DIR}}: Application directory path{{APP_USER}}: User to run service as{{APP_TYPE}}: python or nodejs{{ENTRY_POINT}}: Main file (server.py, index.js, etc.){{PORT}}: Port to run onExample:
[Unit]
Description={{APP_NAME}} Application
After=network.target
[Service]
Type=simple
User={{APP_USER}}
WorkingDirectory={{APP_DIR}}
Environment="PATH=/usr/local/bin:/usr/bin:/bin"
EnvironmentFile={{APP_DIR}}/.env
ExecStart={{EXEC_START}}
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
File: templates/.env.template
Purpose: Secure environment variable template
Example:
# Application Configuration
PORT=8000
HOST=0.0.0.0
NODE_ENV=production
# API Keys (NEVER commit these)
API_KEY=your_api_key_here
DATABASE_URL=your_database_url_here
# Optional
LOG_LEVEL=info
File: templates/deployment-config.json
Purpose: Track deployments to droplets
Structure:
{
"version": "1.0.0",
"deployments": [
{
"id": "deployment-uuid-here",
"appName": "myapp",
"appType": "python",
"dropletIp": "137.184.196.101",
"port": 8000,
"appDirectory": "/opt/myapp",
"serviceUser": "root",
"status": "active",
"deployedAt": "2025-11-02T18:30:00Z",
"deployedBy": "user@example.com",
"version": "1.0.0",
"metadata": {
"gitCommit": "abc123",
"gitBranch": "main",
"pythonVersion": "3.11",
"entryPoint": "server.py"
},
"environmentVariables": [
{
"name": "API_KEY",
"isSet": true,
"source": "doctl-secrets"
},
{
"name": "PORT",
"isSet": true,
"source": "deployment-script"
}
],
"health": {
"lastCheck": "2025-11-02T18:35:00Z",
"status": "healthy",
"uptime": "5m 30s",
"memoryUsage": "45MB",
"cpuUsage": "2%"
}
}
],
"metadata": {
"lastUpdated": "2025-11-02T18:35:00Z",
"totalDeployments": 1,
"activeDeployments": 1
}
}
File: templates/deployment-checklist.md
Purpose: Pre-deployment checklist
Contents:
File: examples/python-fastapi-deployment.md
Shows:
File: examples/nodejs-express-deployment.md
Shows:
File: examples/background-worker-deployment.md
Shows:
Validate Application:
./scripts/validate-app.sh /path/to/app
Deploy to Droplet:
./scripts/deploy-to-droplet.sh /path/to/app 137.184.196.101 myapp
Verify Health:
./scripts/health-check.sh 137.184.196.101 myapp
Update Code:
./scripts/deploy-to-droplet.sh /path/to/app 137.184.196.101 myapp
Verify Health:
./scripts/health-check.sh 137.184.196.101 myapp
Update Secrets:
./scripts/update-secrets.sh 137.184.196.101 myapp
Verify Service Restarted:
./scripts/manage-deployment.sh status 137.184.196.101 myapp
# Check service status
./scripts/manage-deployment.sh status 137.184.196.101 myapp
# View logs
./scripts/manage-deployment.sh logs 137.184.196.101 myapp
# Common issues:
# - Missing environment variables
# - Port already in use
# - Permission issues
# - Syntax errors in code
# Check doctl authentication
doctl auth list
# Verify droplet accessible
doctl compute ssh 137.184.196.101 --ssh-command "echo 'Connection successful'"
# Re-run with verbose output
VERBOSE=1 ./scripts/deploy-to-droplet.sh /path/to/app 137.184.196.101 myapp
# Check service is running
./scripts/manage-deployment.sh status 137.184.196.101 myapp
# Check logs for errors
./scripts/manage-deployment.sh logs 137.184.196.101 myapp
# Verify port is listening
doctl compute ssh 137.184.196.101 --ssh-command "netstat -tlnp | grep <port>"
This skill integrates with:
/deployment:prepare - Pre-deployment validation/deployment:deploy - Execute deployment/deployment:validate - Post-deployment verification/deployment:rollback - Rollback to previous versionAfter creating the skill, you should also create:
digitalocean-app-deployment - For App Platform deployments