mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-08 22:58:01 -05:00
## Summary This PR adds the frontend service to the Docker Compose configuration, enabling `docker compose up` to run the complete stack, including the frontend. It also implements comprehensive environment variable improvements, unified .env file support, and fixes Docker networking issues. ## Key Changes ### 🐳 Docker Compose Improvements - **Added frontend service** to `docker-compose.yml` and `docker-compose.platform.yml` - **Production build**: Uses `pnpm build + serve` instead of dev server for better stability and lower memory usage - **Service dependencies**: Frontend now waits for backend services (`rest_server`, `websocket_server`) to be ready - **YAML anchors**: Implemented DRY configuration to avoid duplicating environment values ### 📁 Unified .env File Support - **Frontend .env loading**: Automatically loads `.env` file during Docker build and runtime - **Backend .env loading**: Optional `.env` file support with fallback to sensible defaults in `settings.py` - **Single source of truth**: All `NEXT_PUBLIC_*` and API keys can be defined in respective `.env` files - **Docker integration**: Updated `.dockerignore` to include `.env` files in build context - **Git tracking**: Frontend and backend `.env` files are now trackable (removed from gitignore) ### 🔧 Environment Variable Architecture - **Dual environment strategy**: - Server-side code uses Docker service names (`http://rest_server:8006/api`) - Client-side code uses localhost URLs (`http://localhost:8006/api`) - **Comprehensive config**: Added build args and runtime environment variables - **Network compatibility**: Fixes connection issues between frontend and backend containers - **Shared backend variables**: Common environment variables (service hosts, auth settings) centralized using YAML anchors ### 🛠️ Code Improvements - **Centralized env-config helper** (`/frontend/src/lib/env-config.ts`) with server-side priority - **Updated all frontend code** to use shared environment helpers instead of direct `process.env` access - **Consistent API**: All environment variable access now goes through helper functions - **Settings.py improvements**: Better defaults for CORS origins and optional .env file loading ### 🔗 Files Changed - `docker-compose.yml` & `docker-compose.platform.yml` - Added frontend service and shared backend env vars - `frontend/Dockerfile` - Simplified build process to use .env files directly - `backend/settings.py` - Optional .env loading and better defaults - `frontend/src/lib/env-config.ts` - New centralized environment configuration - `.dockerignore` - Allow .env files in build context - `.gitignore` - Updated to allow frontend/backend .env files - Multiple frontend files - Updated to use env helpers - Updates to both auto installer scripts to work with the latest setup! ## Benefits - ✅ **Single command deployment**: `docker compose up` now runs everything - ✅ **Better reliability**: Production build reduces memory usage and crashes - ✅ **Network compatibility**: Proper container-to-container communication - ✅ **Maintainable config**: Centralized environment variable management with .env files - ✅ **Development friendly**: Works in both Docker and local development - ✅ **API key management**: Easy configuration through .env files for all services - ✅ **No more manual env vars**: Frontend and backend automatically load their respective .env files ## Testing - ✅ Verified Docker service communication works correctly - ✅ Frontend responds and serves content properly - ✅ Environment variables are correctly resolved in both server and client contexts - ✅ No connection errors after implementing service dependencies - ✅ .env file loading works correctly in both build and runtime phases - ✅ Backend services work with and without .env files present ### Checklist 📋 #### For configuration changes: - [x] `.env.default` is updated or already compatible with my changes - [x] `docker-compose.yml` is updated or already compatible with my changes - [x] I have included a list of my configuration changes in the PR description (under **Changes**) 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Lluis Agusti <hi@llu.lu> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co> Co-authored-by: Claude <claude@users.noreply.github.com> Co-authored-by: Bentlybro <Github@bentlybro.com>
167 lines
5.3 KiB
Plaintext
167 lines
5.3 KiB
Plaintext
# Backend Configuration
|
|
# This file contains environment variables that MUST be set for the AutoGPT platform
|
|
# Variables with working defaults in settings.py are not included here
|
|
|
|
## ===== REQUIRED DATABASE CONFIGURATION ===== ##
|
|
# PostgreSQL Database Connection
|
|
DB_USER=postgres
|
|
DB_PASS=your-super-secret-and-long-postgres-password
|
|
DB_NAME=postgres
|
|
DB_PORT=5432
|
|
DB_HOST=localhost
|
|
DB_CONNECTION_LIMIT=12
|
|
DB_CONNECT_TIMEOUT=60
|
|
DB_POOL_TIMEOUT=300
|
|
DB_SCHEMA=platform
|
|
DATABASE_URL="postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}?schema=${DB_SCHEMA}&connect_timeout=${DB_CONNECT_TIMEOUT}"
|
|
DIRECT_URL="postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}?schema=${DB_SCHEMA}&connect_timeout=${DB_CONNECT_TIMEOUT}"
|
|
PRISMA_SCHEMA="postgres/schema.prisma"
|
|
ENABLE_AUTH=true
|
|
|
|
## ===== REQUIRED SERVICE CREDENTIALS ===== ##
|
|
# Redis Configuration
|
|
REDIS_HOST=localhost
|
|
REDIS_PORT=6379
|
|
REDIS_PASSWORD=password
|
|
|
|
# RabbitMQ Credentials
|
|
RABBITMQ_DEFAULT_USER=rabbitmq_user_default
|
|
RABBITMQ_DEFAULT_PASS=k0VMxyIJF9S35f3x2uaw5IWAl6Y536O7
|
|
|
|
# Supabase Authentication
|
|
SUPABASE_URL=http://localhost:8000
|
|
SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q
|
|
SUPABASE_JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long
|
|
|
|
## ===== REQUIRED SECURITY KEYS ===== ##
|
|
# Generate using: from cryptography.fernet import Fernet;Fernet.generate_key().decode()
|
|
ENCRYPTION_KEY=dvziYgz0KSK8FENhju0ZYi8-fRTfAdlz6YLhdB_jhNw=
|
|
UNSUBSCRIBE_SECRET_KEY=HlP8ivStJjmbf6NKi78m_3FnOogut0t5ckzjsIqeaio=
|
|
|
|
## ===== IMPORTANT OPTIONAL CONFIGURATION ===== ##
|
|
# Platform URLs (set these for webhooks and OAuth to work)
|
|
PLATFORM_BASE_URL=http://localhost:8000
|
|
FRONTEND_BASE_URL=http://localhost:3000
|
|
|
|
# Media Storage (required for marketplace and library functionality)
|
|
MEDIA_GCS_BUCKET_NAME=
|
|
|
|
## ===== API KEYS AND OAUTH CREDENTIALS ===== ##
|
|
# All API keys below are optional - only add what you need
|
|
|
|
# AI/LLM Services
|
|
OPENAI_API_KEY=
|
|
ANTHROPIC_API_KEY=
|
|
GROQ_API_KEY=
|
|
LLAMA_API_KEY=
|
|
AIML_API_KEY=
|
|
OPEN_ROUTER_API_KEY=
|
|
NVIDIA_API_KEY=
|
|
|
|
# OAuth Credentials
|
|
# For the OAuth callback URL, use <your_frontend_url>/auth/integrations/oauth_callback,
|
|
# e.g. http://localhost:3000/auth/integrations/oauth_callback
|
|
|
|
# GitHub OAuth App server credentials - https://github.com/settings/developers
|
|
GITHUB_CLIENT_ID=
|
|
GITHUB_CLIENT_SECRET=
|
|
|
|
# Google OAuth App server credentials - https://console.cloud.google.com/apis/credentials, and enable gmail api and set scopes
|
|
# https://console.cloud.google.com/apis/credentials/consent ?project=<your_project_id>
|
|
# You'll need to add/enable the following scopes (minimum):
|
|
# https://console.developers.google.com/apis/api/gmail.googleapis.com/overview ?project=<your_project_id>
|
|
# https://console.cloud.google.com/apis/library/sheets.googleapis.com/ ?project=<your_project_id>
|
|
GOOGLE_CLIENT_ID=
|
|
GOOGLE_CLIENT_SECRET=
|
|
|
|
# Twitter (X) OAuth 2.0 with PKCE Configuration
|
|
# 1. Create a Twitter Developer Account:
|
|
# - Visit https://developer.x.com/en and sign up
|
|
# 2. Set up your application:
|
|
# - Navigate to Developer Portal > Projects > Create Project
|
|
# - Add a new app to your project
|
|
# 3. Configure app settings:
|
|
# - App Permissions: Read + Write + Direct Messages
|
|
# - App Type: Web App, Automated App or Bot
|
|
# - OAuth 2.0 Callback URL: http://localhost:3000/auth/integrations/oauth_callback
|
|
# - Save your Client ID and Client Secret below
|
|
TWITTER_CLIENT_ID=
|
|
TWITTER_CLIENT_SECRET=
|
|
|
|
# Linear App
|
|
# Make a new workspace for your OAuth APP -- trust me
|
|
# https://linear.app/settings/api/applications/new
|
|
# Callback URL: http://localhost:3000/auth/integrations/oauth_callback
|
|
LINEAR_CLIENT_ID=
|
|
LINEAR_CLIENT_SECRET=
|
|
|
|
# To obtain Todoist API credentials:
|
|
# 1. Create a Todoist account at todoist.com
|
|
# 2. Visit the Developer Console: https://developer.todoist.com/appconsole.html
|
|
# 3. Click "Create new app"
|
|
# 4. Once created, copy your Client ID and Client Secret below
|
|
TODOIST_CLIENT_ID=
|
|
TODOIST_CLIENT_SECRET=
|
|
|
|
NOTION_CLIENT_ID=
|
|
NOTION_CLIENT_SECRET=
|
|
REDDIT_CLIENT_ID=
|
|
REDDIT_CLIENT_SECRET=
|
|
|
|
# Payment Processing
|
|
STRIPE_API_KEY=
|
|
STRIPE_WEBHOOK_SECRET=
|
|
|
|
# Email Service (for sending notifications and confirmations)
|
|
POSTMARK_SERVER_API_TOKEN=
|
|
POSTMARK_SENDER_EMAIL=invalid@invalid.com
|
|
POSTMARK_WEBHOOK_TOKEN=
|
|
|
|
# Error Tracking
|
|
SENTRY_DSN=
|
|
|
|
# Cloudflare Turnstile (CAPTCHA) Configuration
|
|
# Get these from the Cloudflare Turnstile dashboard: https://dash.cloudflare.com/?to=/:account/turnstile
|
|
# This is the backend secret key
|
|
TURNSTILE_SECRET_KEY=
|
|
# This is the verify URL
|
|
TURNSTILE_VERIFY_URL=https://challenges.cloudflare.com/turnstile/v0/siteverify
|
|
|
|
# Feature Flags
|
|
LAUNCH_DARKLY_SDK_KEY=
|
|
|
|
# Content Generation & Media
|
|
DID_API_KEY=
|
|
FAL_API_KEY=
|
|
IDEOGRAM_API_KEY=
|
|
REPLICATE_API_KEY=
|
|
REVID_API_KEY=
|
|
SCREENSHOTONE_API_KEY=
|
|
UNREAL_SPEECH_API_KEY=
|
|
|
|
# Data & Search Services
|
|
E2B_API_KEY=
|
|
EXA_API_KEY=
|
|
JINA_API_KEY=
|
|
MEM0_API_KEY=
|
|
OPENWEATHERMAP_API_KEY=
|
|
GOOGLE_MAPS_API_KEY=
|
|
|
|
# Communication Services
|
|
DISCORD_BOT_TOKEN=
|
|
MEDIUM_API_KEY=
|
|
MEDIUM_AUTHOR_ID=
|
|
SMTP_SERVER=
|
|
SMTP_PORT=
|
|
SMTP_USERNAME=
|
|
SMTP_PASSWORD=
|
|
|
|
# Business & Marketing Tools
|
|
APOLLO_API_KEY=
|
|
AYRSHARE_API_KEY=
|
|
AYRSHARE_JWT_KEY=
|
|
SMARTLEAD_API_KEY=
|
|
ZEROBOUNCE_API_KEY=
|
|
|
|
# Other Services
|
|
AUTOMOD_API_KEY= |