# Deployment Guide ## CI/CD Pipeline Overview This repository includes automated CI/CD for building and deploying the "How to Talk to Claude" guide. ### Workflows #### 1. Test Build (`.github/workflows/test.yml`) - **Trigger**: Pull requests to `master` - **Purpose**: Validate Docker builds and basic functionality - **Tests**: Docker build, container startup, health checks #### 2. Build and Deploy (`.github/workflows/deploy.yml`) - **Trigger**: Pushes to `master` branch - **Purpose**: Build multi-arch images and deploy to production - **Features**: - Multi-platform builds (amd64, arm64) - Container registry publishing - Automated deployment via SSH ### Setup Requirements #### Repository Secrets Configure these secrets in your Git repository: ```bash DEPLOY_HOST=your-server.com DEPLOY_USER=deployment-user DEPLOY_KEY=-----BEGIN OPENSSH PRIVATE KEY-----... GITHUB_TOKEN=automatically-provided ``` #### Server Setup On your deployment server: 1. **Install Docker and Docker Compose** 2. **Create deployment directory**: ```bash mkdir -p /opt/how-to-claude cd /opt/how-to-claude ``` 3. **Copy production files**: ```bash # Copy docker-compose.prod.yml and .env.production # Update .env.production with actual values ``` 4. **Ensure Caddy network exists**: ```bash docker network create caddy ``` ### Manual Deployment For manual deployment: ```bash # Local build and test docker build -t how-to-claude:latest . docker run -p 8080:80 how-to-claude:latest # Production deployment ./deploy.sh ``` ### Environment Files - `.env.example` - Template for local development - `.env.production` - Production environment variables - `docker-compose.yml` - Local development - `docker-compose.prod.yml` - Production deployment ### Monitoring The deployment includes: - **Health checks** at `/health` endpoint - **Container restart policies** - **Image cleanup** after deployment ### Troubleshooting **Build fails:** - Check Astro build logs in CI - Verify production config resolves plugin conflicts **Deployment fails:** - Verify SSH access and Docker permissions - Check server disk space and network connectivity - Review container logs: `docker logs how-to-claude` **Site not accessible:** - Verify Caddy network configuration - Check domain DNS settings - Test health endpoint: `curl http://localhost:80/health`