Claude
Skills
Sign in
Back

digitalocean-app-deployment

Included with Lifetime
$97 forever

DigitalOcean App Platform deployment using doctl CLI for containerized applications, web services, static sites, and databases. Includes app spec generation, deployment orchestration, environment management, domain configuration, and health monitoring. Use when deploying to App Platform, managing app specs, configuring databases, or when user mentions App Platform, app spec, managed deployment, or PaaS deployment.

Generalscripts

What this skill does


# DigitalOcean App Platform Deployment Skill

This skill provides comprehensive deployment lifecycle management for applications deployed to DigitalOcean App Platform using doctl CLI and app specs.

## Overview

The deployment lifecycle consists of five phases:
1. **Pre-Deployment Validation** - Application readiness, app spec validation, configuration
2. **App Spec Generation** - Create/update app spec based on project detection
3. **Deployment** - Create or update app, configure services and databases
4. **Domain & Environment Management** - Custom domains, environment variables, scaling
5. **Post-Deployment Verification** - Health checks, deployment status validation

## Supported Application Types

- **Web Services**: Node.js, Python, Go, Ruby, PHP applications
- **Static Sites**: React, Vue, Next.js static exports, Hugo, Jekyll
- **Workers**: Background jobs, queue processors, scheduled tasks
- **Databases**: PostgreSQL, MySQL, Redis (managed databases)
- **Docker**: Custom Docker containers

## Available Scripts

### 1. Application Validation

**Script**: `scripts/validate-app.sh <app-path>`

**Purpose**: Validates application is ready for App Platform deployment

**Checks**:
- Dockerfile present (for Docker apps) OR supported runtime detected
- Environment configuration (.env.example present)
- No hardcoded secrets in code or Dockerfile
- Port configuration matches App Platform requirements (8080 default)
- Build command specified or detectable
- Resource requirements reasonable

**Usage**:
```bash
# Validate Docker app
./scripts/validate-app.sh /path/to/docker-app

# Validate Node.js app
./scripts/validate-app.sh /path/to/nodejs-app

# Validate static site
STATIC_SITE=true ./scripts/validate-app.sh /path/to/static-site

# Verbose mode
VERBOSE=1 ./scripts/validate-app.sh .
```

**Exit Codes**:
- `0`: Validation passed
- `1`: Validation failed (must fix before deployment)

### 2. Generate App Spec

**Script**: `scripts/generate-app-spec.sh <app-path> <app-name>`

**Purpose**: Generates DigitalOcean app spec from project detection

**Actions**:
- Detects application type (Docker, Node.js, Python, static)
- Generates appropriate app spec configuration
- Configures build and run commands
- Sets up environment variables
- Defines health checks
- Configures resource limits
- Outputs app spec to .do/app.yaml

**Usage**:
```bash
# Generate app spec for Docker app
./scripts/generate-app-spec.sh /path/to/app myapp

# Generate with custom port
PORT=3000 ./scripts/generate-app-spec.sh /path/to/app myapp

# Generate with database
DATABASE=postgres ./scripts/generate-app-spec.sh /path/to/app myapp

# Generate for static site
STATIC_SITE=true ./scripts/generate-app-spec.sh /path/to/app myapp

# Generate with custom domain
DOMAIN=myapp.example.com ./scripts/generate-app-spec.sh /path/to/app myapp
```

**Environment Variables**:
- `APP_TYPE`: `docker`, `nodejs`, `python`, `static` (auto-detected if not specified)
- `PORT`: Port to run on (default: 8080 for App Platform)
- `DATABASE`: Database type (`postgres`, `mysql`, `redis`)
- `STATIC_SITE`: Set to `true` for static site deployments
- `DOMAIN`: Custom domain to configure
- `REGION`: DigitalOcean region (default: nyc)
- `INSTANCE_SIZE`: App instance size (default: basic-xxs)
- `INSTANCE_COUNT`: Number of instances (default: 1)

**Exit Codes**:
- `0`: App spec generated successfully
- `1`: Generation failed

### 3. Deploy to App Platform

**Script**: `scripts/deploy-to-app-platform.sh <app-spec-path> [app-id]`

**Purpose**: Deploys application to DigitalOcean App Platform

**Actions**:
- Validates doctl authentication
- Creates new app OR updates existing app
- Uploads app spec
- Triggers deployment
- Monitors deployment progress
- Captures deployment URL
- Verifies deployment completed

**Usage**:
```bash
# Create new app
./scripts/deploy-to-app-platform.sh .do/app.yaml

# Update existing app
./scripts/deploy-to-app-platform.sh .do/app.yaml abc123-app-id

# Deploy with monitoring
MONITOR=true ./scripts/deploy-to-app-platform.sh .do/app.yaml

# Deploy and wait for completion
WAIT=true ./scripts/deploy-to-app-platform.sh .do/app.yaml abc123-app-id
```

**Environment Variables**:
- `MONITOR`: Set to `true` to monitor deployment progress
- `WAIT`: Set to `true` to wait for deployment completion
- `TIMEOUT`: Deployment timeout in minutes (default: 15)

**Exit Codes**:
- `0`: Deployment successful
- `1`: Deployment failed

### 4. Update Environment Variables

**Script**: `scripts/update-env-vars.sh <app-id>`

**Purpose**: Updates environment variables for deployed app

**Actions**:
- Retrieves current app spec
- Prompts for updated environment variables
- Updates app spec with new variables
- Triggers redeployment to apply changes
- Verifies redeployment successful

**Usage**:
```bash
# Update env vars interactively
./scripts/update-env-vars.sh abc123-app-id

# Update from .env file
ENV_FILE=.env.production ./scripts/update-env-vars.sh abc123-app-id

# Update specific variables
KEY1=value1 KEY2=value2 ./scripts/update-env-vars.sh abc123-app-id
```

**Exit Codes**:
- `0`: Environment variables updated successfully
- `1`: Update failed

### 5. Configure Domain

**Script**: `scripts/configure-domain.sh <app-id> <domain>`

**Purpose**: Configures custom domain for App Platform app

**Actions**:
- Validates domain ownership
- Adds domain to app configuration
- Configures SSL/TLS certificate
- Updates DNS configuration
- Verifies domain is accessible

**Usage**:
```bash
# Add custom domain
./scripts/configure-domain.sh abc123-app-id myapp.example.com

# Add domain with www redirect
WWW_REDIRECT=true ./scripts/configure-domain.sh abc123-app-id myapp.example.com

# Force HTTPS
FORCE_HTTPS=true ./scripts/configure-domain.sh abc123-app-id myapp.example.com
```

**Exit Codes**:
- `0`: Domain configured successfully
- `1`: Configuration failed

### 6. Scale Application

**Script**: `scripts/scale-app.sh <app-id> <instance-count> [instance-size]`

**Purpose**: Scales app horizontally or vertically

**Actions**:
- Updates app spec with new instance configuration
- Triggers redeployment with new scale
- Monitors scaling progress
- Verifies all instances healthy

**Usage**:
```bash
# Scale to 3 instances
./scripts/scale-app.sh abc123-app-id 3

# Scale and change instance size
./scripts/scale-app.sh abc123-app-id 2 professional-xs

# Available instance sizes:
# - basic-xxs, basic-xs, basic-s, basic-m
# - professional-xs, professional-s, professional-m, professional-l
```

**Exit Codes**:
- `0`: Scaling successful
- `1`: Scaling failed

### 7. Health Check

**Script**: `scripts/health-check.sh <app-id>`

**Purpose**: Validates App Platform deployment health

**Checks**:
- App deployment status (active/deploying/failed)
- All components healthy
- HTTP endpoint responding
- Database connectivity (if configured)
- SSL certificate valid
- Resource usage within limits
- Recent deployment logs

**Usage**:
```bash
# Check app health
./scripts/health-check.sh abc123-app-id

# Continuous monitoring (runs every 60s)
MONITOR=true ./scripts/health-check.sh abc123-app-id

# Detailed health report
DETAILED=true ./scripts/health-check.sh abc123-app-id
```

**Exit Codes**:
- `0`: All health checks passed
- `1`: One or more health checks failed

### 8. Manage Deployment

**Script**: `scripts/manage-deployment.sh <action> <app-id>`

**Purpose**: Manage App Platform app lifecycle

**Actions**:
- `info`: Show app information and status
- `logs`: View app logs
- `restart`: Restart app components
- `rollback`: Rollback to previous deployment
- `destroy`: Delete app completely
- `list`: List all apps in account

**Usage**:
```bash
# Show app info
./scripts/manage-deployment.sh info abc123-app-id

# View logs (last 100 lines)
./scripts/manage-deployment.sh logs abc123-app-id

# View logs (follow)
FOLLOW=true ./scripts/manage-deployment.sh logs abc123-app-id

# Restart app
./scripts/manage-deployment.sh restart abc123-app-id

# Rollback to previous vers

Related in General