Skip to content

Commit

Permalink
use uwsgi instead of python built-in server, disable debug mode by de…
Browse files Browse the repository at this point in the history
…fault in config
  • Loading branch information
alex-phillips committed Nov 22, 2018
1 parent 5a0566d commit 4ef36b2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Expand Up @@ -22,7 +22,9 @@ RUN \
zlib-dev && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
python3 && \
python3 \
uwsgi \
uwsgi-python3 && \
echo "**** install healthchecks ****" && \
mkdir -p /app/healthchecks && \
if [ -z ${HEALTHCHECKS_RELEASE+x} ]; then \
Expand Down
10 changes: 10 additions & 0 deletions root/defaults/uwsgi.ini
@@ -0,0 +1,10 @@
[uwsgi]
http-socket = :8000
enable-threads
plugin = python3
module = hc.wsgi:application
static-map = /static=static-collected
static-gzip-dir = static-collected/CACHE
hook-pre-app = exec:/usr/bin/python3 ./manage.py collectstatic --noinput
hook-pre-app = exec:/usr/bin/python3 ./manage.py compress
attach-daemon = /usr/bin/python3 ./manage.py sendalerts
3 changes: 3 additions & 0 deletions root/etc/cont-init.d/30-config
Expand Up @@ -2,6 +2,7 @@

# set default values for variables
declare -A HC_CONF
HC_CONF[DEBUG]=${DEBUG:-False}
HC_CONF[SITE_ROOT]=${SITE_ROOT:-https://healthchecks.example.com}
HC_CONF[SITE_NAME]=${SITE_NAME:-healthchecks}
HC_CONF[DEFAULT_FROM_EMAIL]=${DEFAULT_FROM_EMAIL:-noreply@example.com}
Expand Down Expand Up @@ -33,6 +34,8 @@ if [ ! -d "/config/img" ]; then
mkdir /config/img
fi

mv /defaults/uwsgi.ini /app/healthchecks/uwsgi.ini > /dev/null 2>&1

# copy over configurable logo files
FILES="favicon.ico
apple-touch-180.png
Expand Down
Expand Up @@ -3,4 +3,4 @@
cd /app/healthchecks || exit

exec \
s6-setuidgid abc /usr/bin/python3 ./manage.py sendalerts
s6-setuidgid abc /usr/sbin/uwsgi uwsgi.ini
6 changes: 0 additions & 6 deletions root/etc/services.d/healthchecks_server/run

This file was deleted.

0 comments on commit 4ef36b2

Please sign in to comment.