This commit is contained in:
dvirlabs 2026-01-04 23:14:32 +02:00
parent 2ddb069d1d
commit 2d3f4602de
5 changed files with 218 additions and 1 deletions

39
.env Normal file
View File

@ -0,0 +1,39 @@
# Database Configuration (AWS RDS)
DB_USER=recipes_user
DB_PASSWORD=recipes_password
DB_NAME=recipes_db
DB_HOST=my-recipes-rds.chw4omcqsuqv7.eu-central-1.rds.amazonaws.com
DB_PORT=5432
# Email Configuration
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=dvirlabs@gmail.com
SMTP_PASSWORD=agaanrhbbazbdytv
SMTP_FROM=dvirlabs@gmail.com
# Google OAuth
GOOGLE_CLIENT_ID=143092846986-hsi59m0on2c9rb5qrdoejfceieao2ioc.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=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
GOOGLE_REDIRECT_URI=http://localhost:8000/auth/google/callback
FRONTEND_URL=http://localhost
# Microsoft Entra ID (Azure AD) OAuth
AZURE_CLIENT_ID=db244cf5-eb11-4738-a2ea-5b0716c9ec0a
AZURE_CLIENT_SECRET=Zad8Q~qRBxaQq8up0lLXAq4pHzrVM2JFGFJhHaDp
AZURE_TENANT_ID=consumers
AZURE_REDIRECT_URI=http://localhost:8000/auth/azure/callback
# Cloudflare R2 Backup Configuration
R2_ENDPOINT=https://d4704b8c40b2f95b2c7bf7ee4ecc52f8.r2.cloudflarestorage.com
R2_ACCESS_KEY=1997b1e48a337c0dbe1f7552a08631b5
R2_SECRET_KEY=369694e39fedfedb254158c147171f5760de84fa2346d5d5d5a961f1f517dbc6
R2_BUCKET_NAME=recipes-backups
# Automatic Backup Schedule
# Options: test (every 1 minute), daily, weekly, disabled
BACKUP_INTERVAL=weekly
# Frontend API URL (for frontend container to connect to backend via docker-compose)
# Use the service name 'backend' from docker-compose.yaml
VITE_API_URL=http://backend:8000

39
aws/.env Normal file
View File

@ -0,0 +1,39 @@
# Database Configuration (AWS RDS)
DB_USER=recipes_user
DB_PASSWORD=recipes_password
DB_NAME=recipes_db
DB_HOST=my-recipes-rds.chw4omcqsuqv7.eu-central-1.rds.amazonaws.com
DB_PORT=5432
# Email Configuration
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=dvirlabs@gmail.com
SMTP_PASSWORD=agaanrhbbazbdytv
SMTP_FROM=dvirlabs@gmail.com
# Google OAuth
GOOGLE_CLIENT_ID=143092846986-hsi59m0on2c9rb5qrdoejfceieao2ioc.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=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
GOOGLE_REDIRECT_URI=http://localhost:8000/auth/google/callback
FRONTEND_URL=http://localhost
# Microsoft Entra ID (Azure AD) OAuth
AZURE_CLIENT_ID=db244cf5-eb11-4738-a2ea-5b0716c9ec0a
AZURE_CLIENT_SECRET=Zad8Q~qRBxaQq8up0lLXAq4pHzrVM2JFGFJhHaDp
AZURE_TENANT_ID=consumers
AZURE_REDIRECT_URI=http://localhost:8000/auth/azure/callback
# Cloudflare R2 Backup Configuration
R2_ENDPOINT=https://d4704b8c40b2f95b2c7bf7ee4ecc52f8.r2.cloudflarestorage.com
R2_ACCESS_KEY=1997b1e48a337c0dbe1f7552a08631b5
R2_SECRET_KEY=369694e39fedfedb254158c147171f5760de84fa2346d5d5d5a961f1f517dbc6
R2_BUCKET_NAME=recipes-backups
# Automatic Backup Schedule
# Options: test (every 1 minute), daily, weekly, disabled
BACKUP_INTERVAL=weekly
# Frontend API URL (for frontend container to connect to backend via docker-compose)
# Use the service name 'backend' from docker-compose.yaml
VITE_API_URL=http://backend:8000

70
aws/README.md Normal file
View File

@ -0,0 +1,70 @@
# AWS Deployment Guide
## Quick Start
1. Pull the latest changes:
```bash
cd /root/my-recipes
git pull origin aws
```
2. Navigate to the AWS deployment folder:
```bash
cd aws
```
3. Run docker-compose:
```bash
docker compose up -d
```
4. Check logs:
```bash
docker compose logs -f
```
## What's Included
- `docker-compose.yaml` - Docker compose configuration with all services
- `.env` - Environment variables with AWS RDS, R2, OAuth configs
## Services
- **Backend**: http://localhost:8000 (FastAPI)
- **Frontend**: http://localhost (Nginx)
## Configuration
All configuration is in the `.env` file:
- AWS RDS endpoint already configured
- Cloudflare R2 backup storage configured
- Google & Azure OAuth configured
- Email SMTP configured
## Useful Commands
```bash
# Start services
docker compose up -d
# Stop services
docker compose down
# View logs
docker compose logs -f
# Restart services
docker compose restart
# Rebuild and start
docker compose up -d --build
# Remove everything (including volumes)
docker compose down -v
```
## Backups
Automatic backups are scheduled weekly on Sundays at 2:00 AM and stored in Cloudflare R2.
Manual backups location: `../backend/backups/`

69
aws/docker-compose.yaml Normal file
View File

@ -0,0 +1,69 @@
version: "3.9"
services:
backend:
build: ../backend
container_name: recipes-backend
restart: unless-stopped
ports:
- "8000:8000"
environment:
# Database Configuration (RDS)
DATABASE_URL: postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: ${DB_NAME}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT:-5432}
# Email Configuration
SMTP_HOST: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT:-587}
SMTP_USER: ${SMTP_USER}
SMTP_PASSWORD: ${SMTP_PASSWORD}
SMTP_FROM: ${SMTP_FROM}
# Google OAuth
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
GOOGLE_REDIRECT_URI: ${GOOGLE_REDIRECT_URI}
# Microsoft Azure OAuth
AZURE_CLIENT_ID: ${AZURE_CLIENT_ID}
AZURE_CLIENT_SECRET: ${AZURE_CLIENT_SECRET}
AZURE_TENANT_ID: ${AZURE_TENANT_ID:-consumers}
AZURE_REDIRECT_URI: ${AZURE_REDIRECT_URI}
# Frontend URL
FRONTEND_URL: ${FRONTEND_URL}
# Cloudflare R2 Backup Configuration
R2_ENDPOINT: ${R2_ENDPOINT}
R2_ACCESS_KEY: ${R2_ACCESS_KEY}
R2_SECRET_KEY: ${R2_SECRET_KEY}
R2_BUCKET_NAME: ${R2_BUCKET_NAME}
# Backup Schedule
BACKUP_INTERVAL: ${BACKUP_INTERVAL:-weekly}
volumes:
- ../backend/backups:/app/backups
- ../backend/restores:/app/restores
networks:
- recipes-network
frontend:
build: ../frontend
container_name: recipes-frontend
restart: unless-stopped
ports:
- "80:80"
environment:
VITE_API_URL: ${VITE_API_URL:-http://backend:8000}
depends_on:
- backend
networks:
- recipes-network
networks:
recipes-network:
driver: bridge

View File

@ -46,7 +46,7 @@ services:
# Backup Schedule
BACKUP_INTERVAL: ${BACKUP_INTERVAL:-weekly}
env_file:
- .env.aws
- ./backend/.env.aws
volumes:
- ./backend/backups:/app/backups
- ./backend/restores:/app/restores