Skip to content

Commit

Permalink
Chore/ development mode
Browse files Browse the repository at this point in the history
- Allows for the server to be initialized in development mode (using manage.py runserver) via the "RUN_AS_DEVELOPMENT_MODE" environment variable, which is false by default.
- When using the docker-compose.dev.yml file, which mounts the ./bothub folder to the corresponding folder inside the container paired with the development mode, all changes take effect on save, reloading the server.
This allows for faster development, discarding the need to rebuild the image on every code change.
  • Loading branch information
victor-salles committed Jun 22, 2022
1 parent c3cb112 commit 4b29487
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ You can set environment variables in your OS, write on ```.env``` file or pass v
| GUNICORN_WORKERS | ``` int ``` | ``` multiprocessing.cpu_count() * 2 + 1 ``` | Gunicorn number of workers.
| USE_ELASTICSEARCH | ```boolean``` | ```true``` | Change the logic in requirements_to_train to use either elasticsearch or postgres.
| REPOSITORY_BLOCK_USER_LOGS | ```list``` | ```[]``` | List of repository authorization(api bearer) that won't save logs
| RUN_AS_DEVELOPMENT_MODE | ```boolean``` | ```false``` | Specifies how to run the server, in production or development mode.


## Roadmap
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '3.6'

services:
bothub:
volumes:
- ./bothub:/home/app/bothub
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ services:
- ELASTICSEARCH_REPOSITORYNLPLOG_INDEX=${ELASTICSEARCH_REPOSITORYNLPLOG_INDEX:-ai_repositorynlplog}
- ELASTICSEARCH_REPOSITORYNLPLOG_INDEX=${ELASTICSEARCH_REPOSITORYQANLPLOG_INDEX:-ai_repositoryqanlplog}
- ELASTICSEARCH_SIGNAL_PROCESSOR=${ELASTICSEARCH_SIGNAL_PROCESSOR:-celery}
- RUN_AS_DEVELOPMENT_MODE=${RUN_AS_DEVELOPMENT_MODE:-false}

celery:
build:
Expand Down
7 changes: 6 additions & 1 deletion entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@
cd $WORKDIR
python manage.py collectstatic --noinput

gunicorn bothub.wsgi --timeout 999999 -c gunicorn.conf.py
if [ "$RUN_AS_DEVELOPMENT_MODE" = true -o "$RUN_AS_DEVELOPMENT_MODE" = "True" ]
then
python3 manage.py runserver 0.0.0.0:80
else
gunicorn bothub.wsgi --timeout 999999 -c gunicorn.conf.py
fi

0 comments on commit 4b29487

Please sign in to comment.