From 2d3f4602de1fc732669d83ee966c26e64500b304 Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Sun, 4 Jan 2026 23:14:32 +0200 Subject: [PATCH] update --- .env | 39 +++++++++++++++++++++++ aws/.env | 39 +++++++++++++++++++++++ aws/README.md | 70 +++++++++++++++++++++++++++++++++++++++++ aws/docker-compose.yaml | 69 ++++++++++++++++++++++++++++++++++++++++ docker-compose.yaml | 2 +- 5 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 .env create mode 100644 aws/.env create mode 100644 aws/README.md create mode 100644 aws/docker-compose.yaml diff --git a/.env b/.env new file mode 100644 index 0000000..5d8967c --- /dev/null +++ b/.env @@ -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 diff --git a/aws/.env b/aws/.env new file mode 100644 index 0000000..5d8967c --- /dev/null +++ b/aws/.env @@ -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 diff --git a/aws/README.md b/aws/README.md new file mode 100644 index 0000000..fb5c184 --- /dev/null +++ b/aws/README.md @@ -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/` diff --git a/aws/docker-compose.yaml b/aws/docker-compose.yaml new file mode 100644 index 0000000..5eca4d6 --- /dev/null +++ b/aws/docker-compose.yaml @@ -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 diff --git a/docker-compose.yaml b/docker-compose.yaml index bf9abe8..12c077f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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