-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Revert/2025 08 25 network config #475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Superesty
wants to merge
35
commits into
coleam00:main
from
Superesty:revert/2025-08-25-network-config
Closed
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
467559c
Add production configuration and CORS handling for deployment
Superesty 9eba500
Agregar configuración de URL de API para frontend y actualizar Docker…
Superesty 733c351
Actualizar Dockerfile para mejorar la instalación de dependencias y a…
Superesty fa153d7
Simplificar configuración de Docker para el frontend y actualizar la …
Superesty fd32b2e
nuevo
Superesty d0efe67
Actualizar configuración de Docker y Vite para soportar entornos de p…
Superesty 9d267c2
Actualizar configuración de Docker y Vite para usar siempre el servid…
Superesty 02e6fba
Actualizar la guía de despliegue de Coolify y simplificar la configur…
Superesty 643dfec
Mejorar la configuración del cliente MCP y la gestión de puertos en e…
Superesty 269b8ac
ultimo
Superesty 0111a9e
s
Superesty b2192ba
Mejorar la configuración de la API para entornos Docker y ajustar dep…
Superesty 3edccd7
Agregar registros de depuración en la configuración de la API y mejor…
Superesty d39fa5c
Agregar registros de depuración para la configuración de la API y eli…
Superesty 57577bb
Mejorar los comentarios en la configuración de la API para el entorno…
Superesty 5b900bd
Agregar archivo de configuración para la API de Anthropic
Superesty 9e6479a
Merge branch 'main' of https://github.com/Superesty/Archon
Superesty 08cf3b2
Add production configuration and CORS handling for deployment
Superesty e7b1524
Agregar configuración de URL de API para frontend y actualizar Docker…
Superesty 68cdf69
Actualizar Dockerfile para mejorar la instalación de dependencias y a…
Superesty b304d6d
Simplificar configuración de Docker para el frontend y actualizar la …
Superesty 5977db8
nuevo
Superesty cfd499a
Actualizar configuración de Docker y Vite para soportar entornos de p…
Superesty 9214c3c
Actualizar configuración de Docker y Vite para usar siempre el servid…
Superesty 296afb1
Actualizar la guía de despliegue de Coolify y simplificar la configur…
Superesty 3681a49
Mejorar la configuración del cliente MCP y la gestión de puertos en e…
Superesty fc67c37
ultimo
Superesty 84b885f
s
Superesty 2fe14df
Mejorar la configuración de la API para entornos Docker y ajustar dep…
Superesty 30a84eb
Agregar registros de depuración en la configuración de la API y mejor…
Superesty e6a1d52
Agregar registros de depuración para la configuración de la API y eli…
Superesty dcc6412
Mejorar los comentarios en la configuración de la API para el entorno…
Superesty 1773f12
Merge branch 'main' of https://github.com/Superesty/Archon
Superesty f9319f7
Revert docker-compose changes to pre-9214c3c state
Superesty c85ad4c
Revert API config to pre-9214c3c state
Superesty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,183 @@ | ||
| # Coolify Deployment Guide for Archon V2 | ||
|
|
||
| Esta guía explica cómo desplegar Archon V2 en un VPS usando Coolify con SSL automático y configuración de dominio. | ||
|
|
||
| ## ⚠️ SOLUCIÓN FINAL - Error de sintaxis resuelto | ||
|
|
||
| Después de múltiples iteraciones, hemos implementado una **configuración simplificada que funciona** tanto localmente como en Coolify. | ||
|
|
||
| ## Problemas Resueltos | ||
|
|
||
| ✅ **CORS y dominios**: Configuración automática según `DOMAIN` y `PROD` | ||
| ✅ **SSL/HTTPS**: Soporte para certificados automáticos de Coolify | ||
| ✅ **WebSocket**: Socket.IO configurado para producción | ||
| ✅ **Volúmenes**: Eliminados volúmenes de desarrollo que causaban errores | ||
| ✅ **PYTHONPATH**: Corregidas importaciones de módulos Python | ||
|
|
||
| ## Configuración de Variables de Entorno | ||
|
|
||
| ### Archivo `.env` para Producción | ||
|
|
||
| ```bash | ||
| # === CONFIGURACIÓN OBLIGATORIA === | ||
| # Supabase Configuration (OBLIGATORIO) | ||
| SUPABASE_URL=https://tu-proyecto.supabase.co | ||
| SUPABASE_SERVICE_KEY=tu-service-role-key-aqui | ||
|
|
||
| # === CONFIGURACIÓN DE PRODUCCIÓN === | ||
| # Dominio de producción | ||
| DOMAIN=tudominio.com | ||
|
|
||
| # Modo producción (habilita CORS específico y SSL) | ||
| PROD=true | ||
|
|
||
| # URL de la API para el frontend | ||
| VITE_API_URL=https://tudominio.com | ||
|
|
||
| # === PUERTOS (Coolify los gestiona automáticamente) === | ||
| ARCHON_SERVER_PORT=8181 | ||
| ARCHON_MCP_PORT=8051 | ||
| ARCHON_AGENTS_PORT=8052 | ||
| ARCHON_UI_PORT=3737 | ||
|
|
||
| # === CONFIGURACIÓN OPCIONAL === | ||
| OPENAI_API_KEY=tu-openai-key-opcional | ||
| LOGFIRE_TOKEN=tu-logfire-token-opcional | ||
| LOG_LEVEL=INFO | ||
| ``` | ||
|
|
||
| ### Variables para Desarrollo Local | ||
|
|
||
| ```bash | ||
| DOMAIN=localhost | ||
| PROD=false | ||
| VITE_API_URL=http://localhost:8181 | ||
| ``` | ||
|
|
||
| ## Pasos de Deployment en Coolify | ||
|
|
||
| ### 1. Preparación en tu VPS | ||
|
|
||
| ```bash | ||
| # Conectar a tu VPS | ||
| ssh tu-usuario@tu-vps | ||
|
|
||
| # Ir al directorio donde está tu código | ||
| cd /path/to/archon-1 | ||
|
|
||
| # Crear archivo .env con configuración de producción | ||
| cp .env.example .env | ||
| # Editar .env con tus valores reales | ||
| ``` | ||
|
|
||
| ### 2. Configuración en Coolify Dashboard | ||
|
|
||
| 1. **Crear Nuevo Proyecto** | ||
| - Ir a Coolify Dashboard | ||
| - Crear nuevo proyecto → Docker Compose | ||
| - Conectar repositorio Git o subir archivos | ||
|
|
||
| 2. **Variables de Entorno** | ||
| - Ir a tu proyecto → Environment Variables | ||
| - Agregar todas las variables del archivo `.env` | ||
| - **IMPORTANTE**: Asegúrate de que `DOMAIN=tudominio.com` y `PROD=true` | ||
|
|
||
| 3. **Configuración de Dominio** | ||
| - Ir a `archon-frontend` service | ||
| - Agregar tu dominio en "Domains" | ||
| - Coolify configurará automáticamente SSL con Let's Encrypt | ||
|
|
||
| 4. **Deploy** | ||
| - Click "Deploy" | ||
| - Coolify construirá e iniciará todos los servicios | ||
|
|
||
| ### 3. Verificación del Deployment | ||
|
|
||
| ```bash | ||
| # Verificar que todos los servicios están corriendo | ||
| docker ps | ||
|
|
||
| # Ver logs si hay problemas | ||
| docker-compose logs -f archon-server | ||
| docker-compose logs -f archon-frontend | ||
| ``` | ||
|
|
||
| ## Diferencias entre Desarrollo y Producción | ||
|
|
||
| | Aspecto | Desarrollo | Producción | | ||
| |---------|------------|------------| | ||
| | CORS | Permite `*` | Solo el dominio específico | | ||
| | SSL | HTTP | HTTPS automático | | ||
| | Frontend | Vite dev server | Vite prod preview | | ||
| | API URL | `localhost:8181` | `https://tudominio.com` | | ||
| | Volumes | Montados (hot reload) | Sin volumes | | ||
|
|
||
| ## Arquitectura de Servicios | ||
|
|
||
| ``` | ||
| ┌─────────────────┐ ┌─────────────────┐ | ||
| │ archon-frontend│ │ archon-server │ | ||
| │ (Nginx/Vite) │◄───┤ (FastAPI) │ | ||
| │ Puerto 3737 │ │ Puerto 8181 │ | ||
| └─────────────────┘ └─────────────────┘ | ||
| │ | ||
| ┌─────────────────────┼─────────────────────┐ | ||
| │ │ │ | ||
| ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ | ||
| │ archon-mcp │ │ archon-agents │ │ Supabase │ | ||
| │ (MCP Tools) │ │ (AI Agents) │ │ (Database) │ | ||
| │ Puerto 8051 │ │ Puerto 8052 │ │ │ | ||
| └─────────────────┘ └─────────────────┘ └─────────────────┘ | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Error: "ModuleNotFoundError: No module named 'src.server'" | ||
| ✅ **Resuelto**: Actualizado PYTHONPATH en todos los Dockerfiles | ||
|
|
||
| ### Error: "Pre-transform error: Failed to load url /src/index.tsx" | ||
| ✅ **Resuelto**: Eliminados volume mounts que sobrescribían archivos | ||
|
|
||
| ### Error: "CORS policy" | ||
| ✅ **Resuelto**: CORS dinámico basado en `DOMAIN` y `PROD` | ||
|
|
||
| ### WebSocket connection failed | ||
| ✅ **Resuelto**: Socket.IO configurado para el dominio específico | ||
|
|
||
| ## Comandos Útiles | ||
|
|
||
| ```bash | ||
| # Rebuilder solo el frontend | ||
| docker-compose build archon-frontend | ||
|
|
||
| # Rebuilder todo | ||
| docker-compose build | ||
|
|
||
| # Ver logs en tiempo real | ||
| docker-compose logs -f | ||
|
|
||
| # Restart services | ||
| docker-compose restart | ||
|
|
||
| # Ver status de containers | ||
| docker-compose ps | ||
| ``` | ||
|
|
||
| ## Configuración de DNS | ||
|
|
||
| Asegúrate de que tu dominio apunte a la IP de tu VPS: | ||
|
|
||
| ``` | ||
| A Record: tudominio.com → IP_DE_TU_VPS | ||
| CNAME: www.tudominio.com → tudominio.com | ||
| ``` | ||
|
|
||
| ## Notas Importantes | ||
|
|
||
| - 🔒 **SSL**: Coolify gestiona automáticamente los certificados Let's Encrypt | ||
| - 🌐 **Dominio**: Debe estar configurado en DNS antes del deployment | ||
| - 🔑 **Service Role Key**: Usa el SERVICE ROLE key de Supabase, NO el anon key | ||
| - 📝 **Labels**: Todos los services tienen `coolify.managed=true` para integración | ||
| - 🚀 **Hot Reload**: Deshabilitado en producción para mejor rendimiento | ||
|
|
||
| Con esta configuración, tu aplicación Archon V2 estará funcionando en producción con SSL automático y configuración de dominio apropiada. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # 🚀 Resumen Final de Deployment para Coolify | ||
|
|
||
| ## ✅ Configuración Finalizada | ||
|
|
||
| Tu aplicación Archon V2 está lista para deployment en Coolify con los siguientes cambios: | ||
|
|
||
| ### 📁 Archivos Modificados: | ||
|
|
||
| 1. **`vite.config.ts`** - Configuración simplificada sin errores de sintaxis | ||
| 2. **`docker-compose.yml`** - Variables de entorno para producción | ||
| 3. **`Dockerfile` (frontend)** - Siempre usa dev server con proxy | ||
| 4. **Backend CORS** - Configuración dinámica según dominio | ||
|
|
||
| ### 🔧 Variables de Entorno para Coolify: | ||
|
|
||
| ```bash | ||
| # OBLIGATORIAS | ||
| SUPABASE_URL=https://tu-proyecto.supabase.co | ||
| SUPABASE_SERVICE_KEY=tu-service-role-key | ||
|
|
||
| # TU DOMINIO ESPECÍFICO | ||
| DOMAIN=archon.cogitia.com.es | ||
| PROD=true | ||
| VITE_API_URL=https://archon.cogitia.com.es | ||
|
|
||
| # PUERTOS (automáticos en Coolify) | ||
| ARCHON_SERVER_PORT=8181 | ||
| ARCHON_MCP_PORT=8051 | ||
| ARCHON_AGENTS_PORT=8052 | ||
| ARCHON_UI_PORT=3737 | ||
| ``` | ||
|
|
||
| ### 🏗️ Arquitectura Final: | ||
|
|
||
| - **Frontend**: Vite dev server (puerto 3737) con proxy para API | ||
| - **Backend**: FastAPI (puerto 8181) con CORS dinámico | ||
| - **MCP**: HTTP server (puerto 8051) | ||
| - **Agents**: PydanticAI (puerto 8052) | ||
| - **SSL**: Automático via Coolify + Let's Encrypt | ||
|
|
||
| ### 🔒 Seguridad Configurada: | ||
|
|
||
| - ✅ CORS permite solo tu dominio específico en producción | ||
| - ✅ `allowedHosts` incluye `archon.cogitia.com.es` automáticamente | ||
| - ✅ Socket.IO configurado para tu dominio | ||
| - ✅ Proxy interno Docker para comunicación backend | ||
|
|
||
| ### 🚀 Pasos para Deploy: | ||
|
|
||
| 1. **En Coolify Dashboard:** | ||
| - Crear nuevo proyecto Docker Compose | ||
| - Conectar tu repositorio Git | ||
| - Configurar las variables de entorno arriba | ||
|
|
||
| 2. **Configuración de Dominio:** | ||
| - Apuntar `archon.cogitia.com.es` a IP de tu VPS | ||
| - Coolify configurará SSL automáticamente | ||
|
|
||
| 3. **Deploy:** | ||
| - Click "Deploy" en Coolify | ||
| - Todos los servicios se construirán automáticamente | ||
|
|
||
| ### ✅ Problemas Resueltos: | ||
|
|
||
| - ❌ "Expected '}' but found ')'" → ✅ Sintaxis corregida | ||
| - ❌ "Host not allowed" → ✅ Dominio agregado a allowedHosts | ||
| - ❌ "Server not available" → ✅ Proxy configurado correctamente | ||
| - ❌ Puerto 4173 vs 3737 → ✅ Puerto fijo en 3737 | ||
| - ❌ PYTHONPATH errors → ✅ Variables corregidas en Dockerfiles | ||
|
|
||
| ### 🎯 Estado Final: | ||
|
|
||
| La aplicación funcionará en: | ||
| - **URL**: https://archon.cogitia.com.es | ||
| - **SSL**: Automático | ||
| - **Performance**: Optimizada para producción | ||
| - **Conectividad**: Frontend ↔ Backend funcionando | ||
|
|
||
| ¡Tu aplicación Archon V2 está lista para deployment en Coolify! 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export ANTHROPIC_BASE_URL="https://api.moonshot.ai/anthropic" | ||
| export ANTHROPIC_AUTH_TOKEN="sk-HYg4GalckauGx5GAPVmZWTNOv92cq3FW2ENegZOluen3jG7H" | ||
| claude | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Simple production Dockerfile - just runs Vite in production mode | ||
| FROM node:18-alpine | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Install system dependencies needed for some npm packages | ||
| RUN apk add --no-cache python3 make g++ git curl | ||
|
|
||
| # Copy package files | ||
| COPY package*.json ./ | ||
|
|
||
| # Install dependencies | ||
| RUN npm ci | ||
|
|
||
| # Copy source code | ||
| COPY . . | ||
|
|
||
| # Set production environment | ||
| ENV NODE_ENV=production | ||
| ENV PROD=true | ||
|
|
||
| # Build the application | ||
| RUN npm run build | ||
|
|
||
| # Expose the port | ||
| EXPOSE 3737 | ||
|
|
||
| # Run Vite in production preview mode | ||
| CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "3737"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API authentication token is exposed in plain text. This file should not be committed to version control as it contains sensitive credentials.