Skip to content

Commit

Permalink
(SIO-2356) Fix supervisor.conf template and upgrading info. Add hooks…
Browse files Browse the repository at this point in the history
… for Docker Hub.

Change-Id: I55b1b3da935f4b061642d4188b289115219999cc
  • Loading branch information
arturpragacz committed May 19, 2020
1 parent a40a6c7 commit 3aaf11e
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 46 deletions.
51 changes: 38 additions & 13 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,39 @@
Dockerfile*
docker*
.dockerignore
.git
.github
.idea
*.swp
venv
logs
deployment
extra
# use syntax common to .gitignore and .dockerignore

# /rst/source/sections/modules.rst
/build/
/dist/
# /test_report.html
# /test_report/
# /test_log.txt
# /test_screenshots.tar.gz
/.coverage
/cover/
**/*.egg
**/*.egg-info
**/*.pid
**/.DS_Store
**/*.pyc
**/__pycache__/
**/*.kdev*
**/*~
/.tox/
/.pytest_cache/
/.eggs/
**/*.swp
/deployment/
/venv*/
/.idea/

# docker specific

/Dockerfile*
/docker*
/.dockerignore
/.git
/.gitignore
/.github
/extra/
/test*
*.rst
/rst
/*.rst
/rst/
29 changes: 15 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# use syntax common to .gitignore and .dockerignore

/rst/source/sections/modules.rst
/build/
/dist/
/test_report.html
/test_report/
/.coverage
/cover/
*.egg
*.egg-info
*.pid
.DS_Store
/.vagrant/
*.pyc
*.kdev*
*~
vagrant.yml
/test_log.txt
/test_screenshots.tar.gz
/logs/
/.coverage
/cover/
**/*.egg
**/*.egg-info
**/*.pid
**/.DS_Store
**/*.pyc
**/__pycache__/
**/*.kdev*
**/*~
/.tox/
/.pytest_cache/
/.eggs/
*.swp
**/*.swp
/deployment/
/venv/
/venv*/
/.idea/
49 changes: 38 additions & 11 deletions UPGRADING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -871,16 +871,43 @@ List of changes since the *CONFIG_VERSION* numbering was introduced:
To make sure that your typical production setup (UWSGI + reverse proxy)
keeps working, set this to 'uwsgi'.::

@@ -28,12 +27,20 @@ SITE_NAME = 'OIOIOI'
# including but not limited to the mail notifications.
PUBLIC_ROOT_URL = 'http://localhost'

-# Run uwsgi daemon. Shall be True, False or 'auto'.
-# 'auto' means daemon will be run iff DEBUG is disabled.
-UWSGI_ENABLED = 'auto'
--- a/oioioi/deployment/settings.py.template
+++ b/oioioi/deployment/settings.py.template
@@ -34,0 +38,6 @@
+# The server to be run. Options are:
+# django - django's http server
+# uwsgi - uwsgi daemon
+# uwsgi-http - uwsgi deamon with builtin http server
+# 'django' - django's http server
+# 'uwsgi' - uwsgi daemon
+# 'uwsgi-http' - uwsgi deamon with built-in http server
+# None - nothing will be run
+SERVER = None
+SERVER = 'django'

* Appropriate changes were also made to the supervisor configuration.::

--- a/oioioi/deployment/supervisord.conf.template
+++ b/oioioi/deployment/supervisord.conf.template
@@ -7,17 +7,19 @@ directory={{ PROJECT_DIR }}
identifier=oioioi-supervisor

[program:uwsgi]
-{% if settings.UWSGI_USE_GEVENT %}
-command=uwsgi -s {{ PROJECT_DIR }}/uwsgi.sock --umask=000 --loop=gevent --async=50 --processes=10 -M --max-requests=5000 --disable-logging --need-app --enable-threads --socket-timeout=30 --wsgi-file={{ PROJECT_DIR }}/wsgi.py
-{% else %}
-command=uwsgi -s {{ PROJECT_DIR }}/uwsgi.sock --umask=000 --processes=10 -M --max-requests=5000 --disable-logging --need-app --enable-threads --socket-timeout=30 --wsgi-file={{ PROJECT_DIR }}/wsgi.py
-{% endif %}
+command=uwsgi {% if settings.SERVER == 'uwsgi-http' %}--http :8000 --static-map {{ settings.STATIC_URL }}={{ settings.STATIC_ROOT }} {% else %}-s {{ PROJECT_DIR }}/uwsgi.sock {% endif %}--umask=000 {% if settings.UWSGI_USE_GEVENT %}--loop=gevent --async=50 {% endif %}--processes=10 -M --max-requests=5000 --disable-logging --need-app --enable-threads --socket-timeout=30 --wsgi-file={{ PROJECT_DIR }}/wsgi.py
stopsignal=INT
startretries=0
redirect_stderr=false
stdout_logfile={{ PROJECT_DIR }}/logs/uwsgi.log
stderr_logfile={{ PROJECT_DIR }}/logs/uwsgi-err.log
-{% if settings.UWSGI_ENABLED == False %}exclude=true{% elif settings.UWSGI_ENABLED == 'auto' and settings.DEBUG %}exclude=true{% endif %}
+{% if settings.SERVER|slice:":5" != 'uwsgi' %}exclude=true{% endif %}
+
+[program:django-http]
+command={{ PYTHON }} {{ PROJECT_DIR }}//manage.py runserver 0.0.0.0:8000
+stdout_logfile={{ PROJECT_DIR }}/logs/runserver/out.log
+stderr_logfile={{ PROJECT_DIR }}/logs/runserver/err.log
+{% if settings.SERVER != 'django' %}exclude=true{% endif %}

[program:rankingsd]
command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py rankingsd
4 changes: 2 additions & 2 deletions docker-compose-selenium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
POSTGRES_DB: "oioioi"
stop_grace_period: 1m
web:
image: sio2project/oioioi
image: sio2project/oioioi-selenium
command: ["/sio2/oioioi/selenium_init.sh"]
build:
context: .
Expand All @@ -25,7 +25,7 @@ services:
- db
- broker
worker:
image: sio2project/oioioi
image: sio2project/oioioi-selenium
command: ["/sio2/oioioi/worker_init.sh"]
cap_add:
- ALL
Expand Down
1 change: 1 addition & 0 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker build --add-host=web:127.0.0.1 -f $DOCKERFILE_PATH -t $IMAGE_NAME .
6 changes: 3 additions & 3 deletions oioioi/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
PUBLIC_ROOT_URL = 'http://localhost'

# The server to be run. Options are:
# django - django's http server
# uwsgi - uwsgi daemon
# uwsgi-http - uwsgi deamon with builtin http server
# 'django' - django's http server
# 'uwsgi' - uwsgi daemon
# 'uwsgi-http' - uwsgi deamon with built-in http server
# None - nothing will be run
SERVER = None

Expand Down
2 changes: 1 addition & 1 deletion oioioi/deployment/settings.py.template
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ALLOWED_HOSTS = []
# The server to be run. Options are:
# 'django' - django's http server
# 'uwsgi' - uwsgi daemon
# 'uwsgi-http' - uwsgi deamon with builtin http server
# 'uwsgi-http' - uwsgi deamon with built-in http server
# None - nothing will be run
SERVER = 'django'

Expand Down
4 changes: 2 additions & 2 deletions oioioi/deployment/supervisord.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ stderr_logfile={{ PROJECT_DIR }}/logs/uwsgi-err.log

[program:django-http]
command={{ PYTHON }} {{ PROJECT_DIR }}//manage.py runserver 0.0.0.0:8000
stdout_logfile={{ PROJECT_DIR }}/logs/runserver/out.log
stderr_logfile={{ PROJECT_DIR }}/logs/runserver/err.log
stdout_logfile={{ PROJECT_DIR }}/logs/runserver.log
stderr_logfile={{ PROJECT_DIR }}/logs/runserver-err.log
{% if settings.SERVER != 'django' %}exclude=true{% endif %}

[program:rankingsd]
Expand Down

0 comments on commit 3aaf11e

Please sign in to comment.