From 2dc50465cee8099e8c69e970b721416e0e750098 Mon Sep 17 00:00:00 2001 From: Vladislav Date: Wed, 19 Mar 2025 15:53:42 +0500 Subject: [PATCH] feat: add client to supervisord.conf --- .gitignore | 1 + api/api/config/__init__.py | 2 ++ api/api/config/prod.py | 4 ++++ api/api/config/utils.py | 3 ++- client/.env.local | 5 +++++ client/.gitignore | 23 ----------------------- supervisord.conf | 18 +++++++++++++++++- 7 files changed, 31 insertions(+), 25 deletions(-) create mode 100644 api/api/config/prod.py create mode 100644 client/.env.local delete mode 100644 client/.gitignore diff --git a/.gitignore b/.gitignore index 8fabe60..5415a20 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ __pycache__/ *.log *.tmp *.bak +*.pid npm-debug.log* yarn-debug.log* yarn-error.log* diff --git a/api/api/config/__init__.py b/api/api/config/__init__.py index a5dd3fb..3cd97ac 100644 --- a/api/api/config/__init__.py +++ b/api/api/config/__init__.py @@ -1,7 +1,9 @@ from .default import DefaultSettings +from .prod import ProdSettings from .utils import get_settings __all__ = [ "DefaultSettings", + "ProdSettings", "get_settings", ] diff --git a/api/api/config/prod.py b/api/api/config/prod.py new file mode 100644 index 0000000..4a17da4 --- /dev/null +++ b/api/api/config/prod.py @@ -0,0 +1,4 @@ +from api.config.default import DefaultSettings + + +class ProdSettings(DefaultSettings): ... diff --git a/api/api/config/utils.py b/api/api/config/utils.py index c01ab46..cbf4812 100644 --- a/api/api/config/utils.py +++ b/api/api/config/utils.py @@ -1,13 +1,14 @@ from os import environ from api.config.default import DefaultSettings +from api.config.prod import ProdSettings def get_settings() -> DefaultSettings: env = environ.get("ENV", "local") env_settings = { "local": DefaultSettings, - "prod": None, + "prod": ProdSettings, } try: return env_settings[env]() diff --git a/client/.env.local b/client/.env.local new file mode 100644 index 0000000..ea08d60 --- /dev/null +++ b/client/.env.local @@ -0,0 +1,5 @@ +REACT_APP_WEBSOCKET_PROTOCOL=ws +REACT_APP_HTTP_PROTOCOL=http +REACT_APP_API_URL=localhost:8000 +REACT_APP_URL=localhost:3000 +BROWSER=none diff --git a/client/.gitignore b/client/.gitignore deleted file mode 100644 index 4d29575..0000000 --- a/client/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js - -# testing -/coverage - -# production -/build - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/supervisord.conf b/supervisord.conf index 611254c..510ce1e 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -10,7 +10,7 @@ environment= MYSQL_HOST=localhost, MYSQL_USER=connect, MYSQL_PORT=3306, - MYSQL_PASSWORD=%(ENV_MYSQL_PASSWORD)s, + MYSQL_PASSWORD=hackme, BROKER_PROTOCOL=amqp, BROKER_HOST=localhost, BROKER_USER=guest, @@ -25,3 +25,19 @@ stderr_logfile=api.err.log autostart=true autorestart=true startretries=5 + +[program:client] +environment= + REACT_APP_WEBSOCKET_PROTOCOL=ws, + REACT_APP_HTTP_PROTOCOL=http, + REACT_APP_API_URL=localhost:8000, + REACT_APP_URL=localhost:3000 +command=bash -c 'cd client; npm run build; serve -s build' +numprocs=1 +process_name=node-%(process_num)d +stdout_logfile=client.out.log +stderr_logfile=client.err.log +autostart=true +autorestart=true +startretries=5 +