# production-access > Use this skill when the user needs to interact with the production environment. This includes: SSH access to the server, viewing production logs, running health checks, deploying code, viewing server status, or troubleshooting the live website. Activate when user mentions: production, deploy, SSH, server, health check, logs, live site, droplet, DigitalOcean, or asks about the deployed application. - Author: Steve Glen - Repository: FrostyTeeth/claude_plugin1 - Version: 20260124133458 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/FrostyTeeth/claude_plugin1 - Web: https://mule.run/skillshub/@@FrostyTeeth/claude_plugin1~production-access:20260124133458 --- --- name: production-access description: | Use this skill when the user needs to interact with the production environment. This includes: SSH access to the server, viewing production logs, running health checks, deploying code, viewing server status, or troubleshooting the live website. Activate when user mentions: production, deploy, SSH, server, health check, logs, live site, droplet, DigitalOcean, or asks about the deployed application. --- # Production Access Skill This skill enables access to and management of the production environment. ## Configuration Before using, set environment variables in `.env.local`: ```bash # Required PRODUCTION_DOMAIN=your-domain.example.com PRODUCTION_SERVER_IP=123.45.67.89 # Optional (have sensible defaults) APP_NAME=my-app SSH_USER=root SSH_KEY_NAME=server_key ``` ## Production Environment - **Domain**: `https://${PRODUCTION_DOMAIN}` - **Admin**: `https://${PRODUCTION_DOMAIN}/admin` - **Server**: Cloud provider (e.g., DigitalOcean Droplet, AWS EC2) - **SSH User**: Configured via `SSH_USER` (default: `root`) - **Production Directory**: `${SERVER_PATH}` (default: `/opt/${APP_NAME}`) ## SSH Configuration The SSH key path is configured via `SSH_KEY_NAME`: ``` .ssh/${SSH_KEY_NAME} ``` The production server IP is configured in `.env.local`: ``` PRODUCTION_SERVER_IP=123.45.67.89 ``` ## Available Scripts All scripts are located in `.claude/scripts/production-access/`: | Script | Purpose | Usage | |--------|---------|-------| | `config.sh` | Central configuration | Sources environment variables | | `ssh-connect.sh` | Core SSH connection | `./ssh-connect.sh [command]` | | `health-check.sh` | Comprehensive health checks | `./health-check.sh [--verbose] [--json]` | | `deploy.sh` | Deploy latest code | `./deploy.sh [--force] [--no-cache] [--dry-run]` | | `logs.sh` | View production logs | `./logs.sh [service] [-f] [--lines N]` | | `status.sh` | Production status overview | `./status.sh` | | `rollback.sh` | Rollback deployment | `./rollback.sh [--commits N] [--db-backup FILE]` | | `ssl-manage.sh` | SSL certificate management | `./ssl-manage.sh [status\|renew\|init\|setup-cron]` | ## How to Use ### 1. SSH to Production For interactive session: ```bash ./.claude/scripts/production-access/ssh-connect.sh ``` To run a single command: ```bash ./.claude/scripts/production-access/ssh-connect.sh "docker ps" ``` ### 2. Check Production Health Run all health checks: ```bash ./.claude/scripts/production-access/health-check.sh ``` This checks: Docker containers, API health, HTTPS endpoint, SSL certificate, disk space, memory, and database. ### 3. View Production Status ```bash ./.claude/scripts/production-access/status.sh ``` Shows: server info, container status, git branch, resources, recent logs, and database backups. ### 4. View Logs ```bash # All logs ./.claude/scripts/production-access/logs.sh # Follow logs in real-time ./.claude/scripts/production-access/logs.sh -f # Specific service ./.claude/scripts/production-access/logs.sh backend -f ``` ### 5. Deploy to Production ```bash # Standard deployment ./.claude/scripts/production-access/deploy.sh # Dry run (preview only) ./.claude/scripts/production-access/deploy.sh --dry-run # Force rebuild with fresh images ./.claude/scripts/production-access/deploy.sh --force --no-cache ``` Deployment steps: 1. Verify SSH connection 2. Backup database 3. Pull latest code from origin/main 4. Stop old containers 5. Build new Docker images 6. Start new containers 7. Run health checks ### 6. Rollback ```bash # Rollback 1 commit ./.claude/scripts/production-access/rollback.sh --commits 1 # Rollback with database restore ./.claude/scripts/production-access/rollback.sh --commits 1 --db-backup backup_YYYYMMDD_HHMMSS.db ``` ## Container Management ```bash # Restart all services ./.claude/scripts/production-access/ssh-connect.sh "docker compose -p ${COMPOSE_PROJECT} restart" # Restart specific service ./.claude/scripts/production-access/ssh-connect.sh "docker compose -p ${COMPOSE_PROJECT} restart backend" # View container resource usage ./.claude/scripts/production-access/ssh-connect.sh "docker stats --no-stream" ``` ## Database Operations ```bash # List backups ./.claude/scripts/production-access/ssh-connect.sh "ls -lht ${BACKUP_FULL_PATH}/*.db | head -10" # Create manual backup ./.claude/scripts/production-access/ssh-connect.sh "cp ${DB_FULL_PATH} ${BACKUP_FULL_PATH}/manual_\$(date +%Y%m%d_%H%M%S).db" ``` ## Security Notes - SSH keys are gitignored and should NEVER be committed - Always use the provided scripts for consistency and logging - Database backups are automatic before deployments - The production server IP in `.env.local` is also gitignored ## Architecture & Persistence For detailed information about how configurations are managed and why SSL certs/database won't be lost during deployments, see: **[PRODUCTION_ARCHITECTURE.md](./PRODUCTION_ARCHITECTURE.md)** Key points: - **Nginx config** is version-controlled → Make changes in git, not on server - **SSL certificates** persist across deployments via volume mounts - **Database** is backed up before each deployment and preserved via volumes