diff --git a/autogpt_platform/autogpt_libs/autogpt_libs/auth/config.py b/autogpt_platform/autogpt_libs/autogpt_libs/auth/config.py index c143c78e6d..216aefc37d 100644 --- a/autogpt_platform/autogpt_libs/autogpt_libs/auth/config.py +++ b/autogpt_platform/autogpt_libs/autogpt_libs/auth/config.py @@ -7,9 +7,5 @@ class Settings: self.ENABLE_AUTH: bool = os.getenv("ENABLE_AUTH", "false").lower() == "true" self.JWT_ALGORITHM: str = "HS256" - @property - def is_configured(self) -> bool: - return bool(self.JWT_SECRET_KEY) - settings = Settings() diff --git a/autogpt_platform/backend/backend/notification.py b/autogpt_platform/backend/backend/notification.py new file mode 100644 index 0000000000..4a349a4929 --- /dev/null +++ b/autogpt_platform/backend/backend/notification.py @@ -0,0 +1,15 @@ +from backend.app import run_processes +from backend.notifications.notifications import NotificationManager + + +def main(): + """ + Run the AutoGPT-server Notification Service. + """ + run_processes( + NotificationManager(), + ) + + +if __name__ == "__main__": + main() diff --git a/autogpt_platform/backend/backend/notifications/notifications.py b/autogpt_platform/backend/backend/notifications/notifications.py index 67327d2985..f99e860f32 100644 --- a/autogpt_platform/backend/backend/notifications/notifications.py +++ b/autogpt_platform/backend/backend/notifications/notifications.py @@ -185,7 +185,7 @@ class NotificationManager(AppService): @property def rabbit(self) -> rabbitmq.AsyncRabbitMQ: """Access the RabbitMQ service. Will raise if not configured.""" - if not self.rabbitmq_service: + if not hasattr(self, "rabbitmq_service") or not self.rabbitmq_service: raise RuntimeError("RabbitMQ not configured for this service") return self.rabbitmq_service diff --git a/autogpt_platform/backend/backend/scheduler.py b/autogpt_platform/backend/backend/scheduler.py index b42e32c2d9..c22faf31af 100644 --- a/autogpt_platform/backend/backend/scheduler.py +++ b/autogpt_platform/backend/backend/scheduler.py @@ -1,6 +1,5 @@ from backend.app import run_processes from backend.executor.scheduler import Scheduler -from backend.notifications.notifications import NotificationManager def main(): @@ -8,7 +7,6 @@ def main(): Run all the processes required for the AutoGPT-server Scheduling System. """ run_processes( - NotificationManager(), Scheduler(), ) diff --git a/autogpt_platform/backend/pyproject.toml b/autogpt_platform/backend/pyproject.toml index bf2c317b9c..4aa2cfdc8a 100644 --- a/autogpt_platform/backend/pyproject.toml +++ b/autogpt_platform/backend/pyproject.toml @@ -101,6 +101,7 @@ rest = "backend.rest:main" db = "backend.db:main" ws = "backend.ws:main" scheduler = "backend.scheduler:main" +notification = "backend.notification:main" executor = "backend.exec:main" cli = "backend.cli:main" format = "linter:format" diff --git a/autogpt_platform/docker-compose.platform.yml b/autogpt_platform/docker-compose.platform.yml index 12a1ffc647..74ad5e1856 100644 --- a/autogpt_platform/docker-compose.platform.yml +++ b/autogpt_platform/docker-compose.platform.yml @@ -73,8 +73,6 @@ services: condition: service_completed_successfully rabbitmq: condition: service_healthy - # scheduler_server: - # condition: service_healthy environment: - SUPABASE_URL=http://kong:8000 - SUPABASE_JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long @@ -92,7 +90,7 @@ services: - PYRO_HOST=0.0.0.0 - SCHEDULER_HOST=scheduler_server - EXECUTIONMANAGER_HOST=executor - - NOTIFICATIONMANAGER_HOST=rest_server + - NOTIFICATIONMANAGER_HOST=notification_server - CLAMAV_SERVICE_HOST=clamav - NEXT_PUBLIC_FRONTEND_BASE_URL=http://localhost:3000 - BACKEND_CORS_ALLOW_ORIGINS=["http://localhost:3000"] @@ -100,7 +98,6 @@ services: - UNSUBSCRIBE_SECRET_KEY=HlP8ivStJjmbf6NKi78m_3FnOogut0t5ckzjsIqeaio= # DO NOT USE IN PRODUCTION!! ports: - "8006:8006" - - "8007:8007" networks: - app-network @@ -143,7 +140,7 @@ services: - ENABLE_AUTH=true - PYRO_HOST=0.0.0.0 - AGENTSERVER_HOST=rest_server - - NOTIFICATIONMANAGER_HOST=rest_server + - NOTIFICATIONMANAGER_HOST=notification_server - CLAMAV_SERVICE_HOST=clamav - ENCRYPTION_KEY=dvziYgz0KSK8FENhju0ZYi8-fRTfAdlz6YLhdB_jhNw= # DO NOT USE IN PRODUCTION!! ports: @@ -167,8 +164,6 @@ services: condition: service_healthy redis: condition: service_healthy - # rabbitmq: - # condition: service_healthy migrate: condition: service_completed_successfully database_manager: @@ -257,7 +252,7 @@ services: # retries: 5 environment: - DATABASEMANAGER_HOST=database_manager - - NOTIFICATIONMANAGER_HOST=rest_server + - NOTIFICATIONMANAGER_HOST=notification_server - SUPABASE_JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long - DATABASE_URL=postgresql://postgres:your-super-secret-and-long-postgres-password@db:5432/postgres?connect_timeout=60&schema=platform - DIRECT_URL=postgresql://postgres:your-super-secret-and-long-postgres-password@db:5432/postgres?connect_timeout=60&schema=platform @@ -277,6 +272,44 @@ services: networks: - app-network + notification_server: + build: + context: ../ + dockerfile: autogpt_platform/backend/Dockerfile + target: server + command: ["python", "-m", "backend.notification"] + develop: + watch: + - path: ./ + target: autogpt_platform/backend/ + action: rebuild + depends_on: + db: + condition: service_healthy + rabbitmq: + condition: service_healthy + migrate: + condition: service_completed_successfully + database_manager: + condition: service_started + environment: + - DATABASEMANAGER_HOST=database_manager + - REDIS_HOST=redis + - REDIS_PORT=6379 + - REDIS_PASSWORD=password + - RABBITMQ_HOST=rabbitmq + - RABBITMQ_PORT=5672 + - RABBITMQ_DEFAULT_USER=rabbitmq_user_default + - RABBITMQ_DEFAULT_PASS=k0VMxyIJF9S35f3x2uaw5IWAl6Y536O7 + - ENABLE_AUTH=true + - PYRO_HOST=0.0.0.0 + - BACKEND_CORS_ALLOW_ORIGINS=["http://localhost:3000"] + + ports: + - "8007:8007" + networks: + - app-network + # frontend: # build: # context: ../ diff --git a/autogpt_platform/docker-compose.yml b/autogpt_platform/docker-compose.yml index 5eb1e2928d..1c14863a65 100644 --- a/autogpt_platform/docker-compose.yml +++ b/autogpt_platform/docker-compose.yml @@ -70,6 +70,12 @@ services: file: ./docker-compose.platform.yml service: scheduler_server + notification_server: + <<: *agpt-services + extends: + file: ./docker-compose.platform.yml + service: notification_server + clamav: <<: *agpt-services image: clamav/clamav-debian:latest