mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-09 15:17:59 -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>
124 lines
3.4 KiB
Plaintext
124 lines
3.4 KiB
Plaintext
############
|
|
# Secrets
|
|
# YOU MUST CHANGE THESE BEFORE GOING INTO PRODUCTION
|
|
############
|
|
|
|
POSTGRES_PASSWORD=your-super-secret-and-long-postgres-password
|
|
JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long
|
|
ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE
|
|
SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q
|
|
DASHBOARD_USERNAME=supabase
|
|
DASHBOARD_PASSWORD=this_password_is_insecure_and_should_be_updated
|
|
SECRET_KEY_BASE=UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
|
|
VAULT_ENC_KEY=your-encryption-key-32-chars-min
|
|
|
|
|
|
############
|
|
# Database - You can change these to any PostgreSQL database that has logical replication enabled.
|
|
############
|
|
|
|
POSTGRES_HOST=db
|
|
POSTGRES_DB=postgres
|
|
POSTGRES_PORT=5432
|
|
# default user is postgres
|
|
|
|
|
|
############
|
|
# Supavisor -- Database pooler
|
|
############
|
|
POOLER_PROXY_PORT_TRANSACTION=6543
|
|
POOLER_DEFAULT_POOL_SIZE=20
|
|
POOLER_MAX_CLIENT_CONN=100
|
|
POOLER_TENANT_ID=your-tenant-id
|
|
|
|
|
|
############
|
|
# API Proxy - Configuration for the Kong Reverse proxy.
|
|
############
|
|
|
|
KONG_HTTP_PORT=8000
|
|
KONG_HTTPS_PORT=8443
|
|
|
|
|
|
############
|
|
# API - Configuration for PostgREST.
|
|
############
|
|
|
|
PGRST_DB_SCHEMAS=public,storage,graphql_public
|
|
|
|
|
|
############
|
|
# Auth - Configuration for the GoTrue authentication server.
|
|
############
|
|
|
|
## General
|
|
SITE_URL=http://localhost:3000
|
|
ADDITIONAL_REDIRECT_URLS=
|
|
JWT_EXPIRY=3600
|
|
DISABLE_SIGNUP=false
|
|
API_EXTERNAL_URL=http://localhost:8000
|
|
|
|
## Mailer Config
|
|
MAILER_URLPATHS_CONFIRMATION="/auth/v1/verify"
|
|
MAILER_URLPATHS_INVITE="/auth/v1/verify"
|
|
MAILER_URLPATHS_RECOVERY="/auth/v1/verify"
|
|
MAILER_URLPATHS_EMAIL_CHANGE="/auth/v1/verify"
|
|
|
|
## Email auth
|
|
ENABLE_EMAIL_SIGNUP=true
|
|
ENABLE_EMAIL_AUTOCONFIRM=false
|
|
SMTP_ADMIN_EMAIL=admin@example.com
|
|
SMTP_HOST=supabase-mail
|
|
SMTP_PORT=2500
|
|
SMTP_USER=fake_mail_user
|
|
SMTP_PASS=fake_mail_password
|
|
SMTP_SENDER_NAME=fake_sender
|
|
ENABLE_ANONYMOUS_USERS=false
|
|
|
|
## Phone auth
|
|
ENABLE_PHONE_SIGNUP=true
|
|
ENABLE_PHONE_AUTOCONFIRM=true
|
|
|
|
|
|
############
|
|
# Studio - Configuration for the Dashboard
|
|
############
|
|
|
|
STUDIO_DEFAULT_ORGANIZATION=Default Organization
|
|
STUDIO_DEFAULT_PROJECT=Default Project
|
|
|
|
STUDIO_PORT=3000
|
|
# replace if you intend to use Studio outside of localhost
|
|
SUPABASE_PUBLIC_URL=http://localhost:8000
|
|
|
|
# Enable webp support
|
|
IMGPROXY_ENABLE_WEBP_DETECTION=true
|
|
|
|
# Add your OpenAI API key to enable SQL Editor Assistant
|
|
OPENAI_API_KEY=
|
|
|
|
|
|
############
|
|
# Functions - Configuration for Functions
|
|
############
|
|
# NOTE: VERIFY_JWT applies to all functions. Per-function VERIFY_JWT is not supported yet.
|
|
FUNCTIONS_VERIFY_JWT=false
|
|
|
|
|
|
############
|
|
# Logs - Configuration for Logflare
|
|
# Please refer to https://supabase.com/docs/reference/self-hosting-analytics/introduction
|
|
############
|
|
|
|
LOGFLARE_LOGGER_BACKEND_API_KEY=your-super-secret-and-long-logflare-key
|
|
|
|
# Change vector.toml sinks to reflect this change
|
|
LOGFLARE_API_KEY=your-super-secret-and-long-logflare-key
|
|
|
|
# Docker socket location - this value will differ depending on your OS
|
|
DOCKER_SOCKET_LOCATION=/var/run/docker.sock
|
|
|
|
# Google Cloud Project details
|
|
GOOGLE_PROJECT_ID=GOOGLE_PROJECT_ID
|
|
GOOGLE_PROJECT_NUMBER=GOOGLE_PROJECT_NUMBER
|