chore: Remove nginx - use direct Caddy routing
- Remove nginx service from docker-compose - Services bind to localhost:3000/3001 only - Add Caddy configuration guide - Update README with simplified structure - External reverse proxy handles SSL/routing
This commit is contained in:
@@ -34,22 +34,23 @@ npm install
|
|||||||
|
|
||||||
# 2. Set up environment
|
# 2. Set up environment
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
# Edit .env with your values (see docs/SETUP-INFRASTRUCTURE.md)
|
# Edit .env with your values
|
||||||
|
|
||||||
# 3. Create required directories
|
# 3. Create public directory
|
||||||
mkdir -p frontend/public
|
mkdir -p frontend/public
|
||||||
|
|
||||||
# 4. Start with Docker Compose
|
# 4. Start services
|
||||||
docker-compose up -d --build
|
docker-compose up -d --build
|
||||||
|
|
||||||
# 6. Initialize database (first time only)
|
# 5. Initialize database (first time only)
|
||||||
docker-compose exec backend npx prisma db push
|
docker-compose exec backend npx prisma db push
|
||||||
|
|
||||||
# 7. Deploy Solana program (optional, for token features)
|
# 6. Configure Caddy (see docs/CADDY-CONFIG.md)
|
||||||
cd anchor-program
|
# Services expose ports 3000 (frontend) and 3001 (backend) on localhost
|
||||||
anchor deploy
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
See `docs/CADDY-CONFIG.md` for reverse proxy setup.
|
||||||
|
|
||||||
## Project Structure
|
## Project Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -58,11 +59,14 @@ coop-credits/
|
|||||||
├── backend/ # Express API server
|
├── backend/ # Express API server
|
||||||
├── frontend/ # Next.js dashboard
|
├── frontend/ # Next.js dashboard
|
||||||
├── shared/ # Shared types and utilities
|
├── shared/ # Shared types and utilities
|
||||||
├── docker/ # Docker configurations
|
├── docs/ # Documentation
|
||||||
├── deployment/ # Deployment scripts
|
│ └── CADDY-CONFIG.md # Reverse proxy setup
|
||||||
└── docker-compose.yml # Full stack orchestration
|
├── docker-compose.yml # Docker orchestration (no nginx)
|
||||||
|
└── .env.example # Environment template
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note:** No internal reverse proxy. Use Caddy/Nginx/Traefik externally.
|
||||||
|
|
||||||
## User Flow
|
## User Flow
|
||||||
|
|
||||||
1. **Login** → User visits coop.hobokenchicken.com, authenticates with Plex
|
1. **Login** → User visits coop.hobokenchicken.com, authenticates with Plex
|
||||||
|
|||||||
+5
-20
@@ -60,7 +60,7 @@ services:
|
|||||||
- OVERSEER_API_KEY=${OVERSEER_API_KEY}
|
- OVERSEER_API_KEY=${OVERSEER_API_KEY}
|
||||||
- ENCRYPTION_KEY=${ENCRYPTION_KEY}
|
- ENCRYPTION_KEY=${ENCRYPTION_KEY}
|
||||||
ports:
|
ports:
|
||||||
- "3001:3001"
|
- "127.0.0.1:3001:3001" # Localhost only, Caddy proxies to this
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -75,38 +75,23 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
dockerfile: frontend/Dockerfile
|
dockerfile: frontend/Dockerfile
|
||||||
args:
|
args:
|
||||||
- NEXT_PUBLIC_API_URL=http://localhost:3001
|
- NEXT_PUBLIC_API_URL=${API_URL:-http://localhost:3001}
|
||||||
- NEXT_PUBLIC_SOLANA_NETWORK=devnet
|
- NEXT_PUBLIC_SOLANA_NETWORK=devnet
|
||||||
- NEXT_PUBLIC_SOLANA_RPC_URL=https://api.devnet.solana.com
|
- NEXT_PUBLIC_SOLANA_RPC_URL=https://api.devnet.solana.com
|
||||||
container_name: coop-frontend
|
container_name: coop-frontend
|
||||||
environment:
|
environment:
|
||||||
- NEXT_PUBLIC_API_URL=http://localhost:3001
|
- NODE_ENV=production
|
||||||
|
- NEXT_PUBLIC_API_URL=${API_URL:-http://localhost:3001}
|
||||||
- NEXT_PUBLIC_SOLANA_NETWORK=devnet
|
- NEXT_PUBLIC_SOLANA_NETWORK=devnet
|
||||||
- NEXT_PUBLIC_SOLANA_RPC_URL=https://api.devnet.solana.com
|
- NEXT_PUBLIC_SOLANA_RPC_URL=https://api.devnet.solana.com
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "127.0.0.1:3000:3000" # Localhost only, Caddy proxies to this
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
networks:
|
networks:
|
||||||
- coop-network
|
- coop-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
nginx:
|
|
||||||
image: nginx:alpine
|
|
||||||
container_name: coop-nginx
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
volumes:
|
|
||||||
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
||||||
depends_on:
|
|
||||||
frontend:
|
|
||||||
condition: service_started
|
|
||||||
backend:
|
|
||||||
condition: service_healthy
|
|
||||||
networks:
|
|
||||||
- coop-network
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
redis_data:
|
redis_data:
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
# Caddy Configuration
|
||||||
|
|
||||||
|
Caddy handles SSL termination and routes to the application services.
|
||||||
|
|
||||||
|
## Caddyfile Example
|
||||||
|
|
||||||
|
```caddy
|
||||||
|
coop.hobokenchicken.com {
|
||||||
|
# Frontend (Next.js)
|
||||||
|
handle_path /* {
|
||||||
|
reverse_proxy localhost:3000
|
||||||
|
}
|
||||||
|
|
||||||
|
# API routes
|
||||||
|
handle_path /api/* {
|
||||||
|
reverse_proxy localhost:3001
|
||||||
|
}
|
||||||
|
|
||||||
|
# Webhooks
|
||||||
|
handle_path /webhooks/* {
|
||||||
|
reverse_proxy localhost:3001
|
||||||
|
}
|
||||||
|
|
||||||
|
# WebSocket support
|
||||||
|
handle_path /socket.io/* {
|
||||||
|
reverse_proxy localhost:3001
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Docker Compose (no nginx)
|
||||||
|
|
||||||
|
Services bind to localhost only (`127.0.0.1`):
|
||||||
|
|
||||||
|
- **Frontend**: `127.0.0.1:3000`
|
||||||
|
- **Backend**: `127.0.0.1:3001`
|
||||||
|
- **Postgres**: `5432` (internal only)
|
||||||
|
- **Redis**: `6379` (internal only)
|
||||||
|
|
||||||
|
## Start Stack
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start services
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
|
# Verify
|
||||||
|
curl http://localhost:3001/health
|
||||||
|
```
|
||||||
|
|
||||||
|
Caddy automatically provisions SSL and routes traffic.
|
||||||
Reference in New Issue
Block a user