Skip to content

Commit

Permalink
HOTFIX halloumi migratation
Browse files Browse the repository at this point in the history
log to stdout stderr
  • Loading branch information
Kareeeeem committed Sep 18, 2017
1 parent 82e0f94 commit 53b6149
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
2 changes: 1 addition & 1 deletion spynl/cli/ops/docker/Dockerfile
Expand Up @@ -12,4 +12,4 @@ COPY run.sh run.sh

EXPOSE 6543

ENTRYPOINT ["/run.sh"]
CMD ["/run.sh"]
15 changes: 7 additions & 8 deletions spynl/cli/ops/docker/run.sh
Expand Up @@ -3,15 +3,15 @@
# This script adapts /production.ini from environmental variables,
# potentially configures NewRelic and starts gunicorn via supervisord.

printf "======================= \nRUNNING SPYNL APPLICATION ...\n========================= \n\n" >> /logs/spynl.log
printf "======================= \nRUNNING SPYNL APPLICATION ...\n========================= \n\n"

# this should be pre-filled by a script
SPYNL_DEV_DOMAIN=

source /venv/bin/activate

# let repos have their say before running
spynl ops.prepare_docker_run 1>> /logs/spynl.log 2>> /logs/spynl.log
spynl ops.prepare_docker_run

# Spynl number of workers
if [[ "$WEB_CONCURRENCY" == "" ]]; then
Expand All @@ -36,10 +36,9 @@ sed -e 's#^\(spynl.domain =\).*$#\1 '$DOMAIN'#' /production.ini > /production.in
# set SPYNL_ENVIRONMENT in production.ini
sed -e 's#^\(spynl.ops.environment =\).*$#\1 '$SPYNL_ENVIRONMENT'#' /production.ini > /production.ini.tmp && mv /production.ini.tmp /production.ini

# this can be handy when looking at /logs/spynl.log from outside a container
printf "======================= \nOUTPUTTING production.ini ...\n========================= \n\n" >> /logs/spynl.log
cat production.ini >> /logs/spynl.log
printf "======================= \nEND OF production.ini ...\n========================= \n\n" >> /logs/spynl.log
printf "======================= \nOUTPUTTING production.ini ...\n========================= \n\n"
cat production.ini
printf "======================= \nEND OF production.ini ...\n========================= \n\n"

if [[ "$NEWRELIC" == "true" ]]; then
pip install raven
Expand All @@ -58,9 +57,9 @@ if [[ "$NEWRELIC" == "true" ]]; then
newrelic-admin generate-config $NEWRELIC_KEY /newrelic.ini
#NEW_RELIC_CONFIG_FILE=/newrelic.ini
sed -e 's#app_name = Python Application#app_name = SPYNL ['$SPYNL_ENVIRONMENT'-'$SPYNL_FUNCTION']#' /newrelic.ini > /newrelic.ini.tmp && mv /newrelic.ini.tmp /newrelic.ini
COMMAND="command=/venv/bin/newrelic-admin run-program /venv/bin/gunicorn --paste /production.ini --error-logfile /logs/gerr.log"
COMMAND="command=/venv/bin/newrelic-admin run-program /venv/bin/gunicorn --paste /production.ini"
else
COMMAND="command=/venv/bin/gunicorn --paste /production.ini --error-logfile /logs/gerr.log"
COMMAND="command=/venv/bin/gunicorn --paste /production.ini"
fi

# configure the command supervisord should run
Expand Down
33 changes: 22 additions & 11 deletions spynl/cli/ops/docker/supervisord.conf
Expand Up @@ -16,9 +16,13 @@ username=root ;
password=rootpass ;

[supervisord]
logfile=/logs/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
; logfile=/logs/supervisord.log ; (main log file;default $CWD/supervisord.log)
; logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
; logfile_backups=10 ; (num of main logfile rotation backups;default 10)

logfile=/dev/stdout
logfile_maxbytes=0

loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
Expand Down Expand Up @@ -61,14 +65,21 @@ exitcodes=0,2
stopsignal=QUIT
stopwaitsecs=10
redirect_stderr=false
stdout_logfile=/logs/spynl.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile=/logs/spynlerr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB

stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

; stdout_logfile=/logs/spynl.log
; stdout_logfile_maxbytes=1MB
; stdout_logfile_backups=10
; stdout_capture_maxbytes=1MB
; stderr_logfile=/logs/spynlerr.log
; stderr_logfile_maxbytes=1MB
; stderr_logfile_backups=10
; stderr_capture_maxbytes=1MB

;Standard Environment variables
environment=A=1,B=2
serverurl=AUTO
Expand Down

0 comments on commit 53b6149

Please sign in to comment.