Coffee journaling on ATProto (alpha) alpha.arabica.social
coffee
17
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: docker caddy setup

pdewey 0b9b80ec 3ad8ad2e

+205 -7
+11
.env.example
··· 1 + # Arabica Production Configuration 2 + # Copy this file to .env and update with your values 3 + 4 + # Your domain name (required for production) 5 + DOMAIN=arabica.example.com 6 + ACME_EMAIL=admin@example.com 7 + 8 + LOG_LEVEL=info 9 + LOG_FORMAT=json 10 + SERVER_PUBLIC_URL=https://${DOMAIN} 11 + SECURE_COOKIES=true
+31
Caddyfile
··· 1 + {$DOMAIN:localhost} { 2 + reverse_proxy arabica:18910 { 3 + header_up X-Real-IP {remote_host} 4 + header_up X-Forwarded-For {remote_host} 5 + header_up X-Forwarded-Proto {scheme} 6 + header_up X-Forwarded-Host {host} 7 + } 8 + 9 + header { 10 + X-Content-Type-Options "nosniff" 11 + X-Frame-Options "SAMEORIGIN" 12 + Referrer-Policy "strict-origin-when-cross-origin" 13 + -Server 14 + } 15 + 16 + log { 17 + output stdout 18 + format json 19 + level INFO 20 + } 21 + 22 + encode gzip 23 + 24 + @static { 25 + path /static/* 26 + } 27 + handle @static { 28 + header Cache-Control "public, max-age=31536000, immutable" 29 + reverse_proxy arabica:18910 30 + } 31 + }
+138
README.deploy.md
··· 1 + # Arabica Deployment Guide 2 + 3 + Quick guide to deploy Arabica to a VPS with Docker and automatic HTTPS. 4 + 5 + ## Prerequisites 6 + 7 + - VPS with Docker and Docker Compose installed 8 + - Domain name pointing to your VPS IP address (A record) 9 + - Ports 80 and 443 open in firewall 10 + 11 + ## Quick Start (Production) 12 + 13 + 1. **Clone the repository:** 14 + ```bash 15 + git clone <repository-url> 16 + cd arabica 17 + ``` 18 + 19 + 2. **Configure your domain:** 20 + ```bash 21 + cp .env.example .env 22 + nano .env 23 + ``` 24 + 25 + Update `.env` with your domain: 26 + ```env 27 + DOMAIN=arabica.yourdomain.com 28 + ACME_EMAIL=your-email@example.com 29 + ``` 30 + 31 + 3. **Deploy:** 32 + ```bash 33 + docker compose up -d 34 + ``` 35 + 36 + That's it! Caddy will automatically: 37 + - Obtain SSL certificates from Let's Encrypt 38 + - Renew certificates before expiry 39 + - Redirect HTTP to HTTPS 40 + - Proxy requests to Arabica 41 + 42 + 4. **Check logs:** 43 + ```bash 44 + docker compose logs -f 45 + ``` 46 + 47 + 5. **Visit your site:** 48 + ``` 49 + https://arabica.yourdomain.com 50 + ``` 51 + 52 + ## Local Development 53 + 54 + To run locally without a domain: 55 + 56 + ```bash 57 + docker compose up 58 + ``` 59 + 60 + Then visit `http://localhost` (Caddy will serve on port 80). 61 + 62 + ## Updating 63 + 64 + ```bash 65 + git pull 66 + docker compose down 67 + docker compose build 68 + docker compose up -d 69 + ``` 70 + 71 + ## Troubleshooting 72 + 73 + ### Certificate Issues 74 + 75 + If Let's Encrypt can't issue a certificate: 76 + - Ensure your domain DNS is pointing to your VPS 77 + - Check ports 80 and 443 are accessible 78 + - Check logs: `docker compose logs caddy` 79 + 80 + ### View Arabica logs 81 + 82 + ```bash 83 + docker compose logs -f arabica 84 + ``` 85 + 86 + ### Reset everything 87 + 88 + ```bash 89 + docker compose down -v # Warning: deletes all data 90 + docker compose up -d 91 + ``` 92 + 93 + ## Production Checklist 94 + 95 + - [ ] Domain DNS pointing to VPS 96 + - [ ] Ports 80 and 443 open in firewall 97 + - [ ] `.env` file configured with your domain 98 + - [ ] Valid email set for Let's Encrypt notifications 99 + - [ ] Regular backups of `arabica-data` volume 100 + 101 + ## Backup 102 + 103 + To backup user data: 104 + 105 + ```bash 106 + docker compose exec arabica cp /data/arabica.db /data/arabica-backup.db 107 + docker cp $(docker compose ps -q arabica):/data/arabica-backup.db ./backup-$(date +%Y%m%d).db 108 + ``` 109 + 110 + ## Advanced Configuration 111 + 112 + ### Custom Caddyfile 113 + 114 + Edit `Caddyfile` directly for advanced options like: 115 + - Rate limiting 116 + - Custom headers 117 + - IP whitelisting 118 + - Multiple domains 119 + 120 + ### Environment Variables 121 + 122 + All available environment variables in `.env`: 123 + 124 + | Variable | Default | Description | 125 + | ------------------- | ------------------------------------ | ------------------------------- | 126 + | `DOMAIN` | localhost | Your domain name | 127 + | `ACME_EMAIL` | (empty) | Email for Let's Encrypt | 128 + | `LOG_LEVEL` | info | debug/info/warn/error | 129 + | `LOG_FORMAT` | json | console/json | 130 + | `SERVER_PUBLIC_URL` | https://${DOMAIN} | Override public URL | 131 + | `SECURE_COOKIES` | true | Use secure cookies | 132 + 133 + ## Support 134 + 135 + For issues, check the logs first: 136 + ```bash 137 + docker compose logs 138 + ```
+25 -7
compose.yml
··· 1 1 services: 2 + caddy: 3 + image: caddy:2-alpine 4 + ports: 5 + - "80:80" 6 + - "443:443" 7 + - "443:443/udp" 8 + volumes: 9 + - ./Caddyfile:/etc/caddy/Caddyfile:ro 10 + - caddy-data:/data 11 + - caddy-config:/config 12 + environment: 13 + - DOMAIN=${DOMAIN:-localhost} 14 + - ACME_EMAIL=${ACME_EMAIL:-} 15 + restart: unless-stopped 16 + depends_on: 17 + - arabica 18 + 2 19 arabica: 3 20 build: . 4 - ports: 5 - - "18910:18910" 21 + expose: 22 + - "18910" 6 23 volumes: 7 24 - arabica-data:/data 8 25 environment: 9 26 - PORT=18910 10 27 - ARABICA_DB_PATH=/data/arabica.db 11 - - LOG_LEVEL=info 12 - - LOG_FORMAT=json 13 - # Uncomment for production behind reverse proxy: 14 - # - SERVER_PUBLIC_URL=https://arabica.example.com 15 - # - SECURE_COOKIES=true 28 + - LOG_LEVEL=${LOG_LEVEL:-info} 29 + - LOG_FORMAT=${LOG_FORMAT:-json} 30 + - SERVER_PUBLIC_URL=${SERVER_PUBLIC_URL:-https://${DOMAIN}} 31 + - SECURE_COOKIES=true 16 32 restart: unless-stopped 17 33 18 34 volumes: 19 35 arabica-data: 36 + caddy-data: 37 + caddy-config: