Skip to content

Commit

Permalink
fix: typo, more visibility for fatal errors, no endless failure loop
Browse files Browse the repository at this point in the history
- Fixed error message when no decent SECRET_KEY is supplied.
- The messages of a fatal errors are surrounded by newlines for better
  visibility.
- The supervisord in the Docker image will fail if the uwsgi can not
  start the application and will not stay in a never ending loop of
  errors.
  • Loading branch information
redimp committed Sep 20, 2024
1 parent f714160 commit acf7b3b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions docker/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
startsecs=0
startsecs=1
autorestart=false
startretries=3

[program:nginx]
command=/usr/sbin/nginx -g 'daemon off;'
Expand All @@ -19,7 +20,7 @@ stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
# Graceful stop would be QUIT, see http://nginx.org/en/docs/control.html
stopsignal=TERM
startsecs=0
startsecs=1
autorestart=false

[eventlistener:quit_on_failure]
Expand Down
2 changes: 1 addition & 1 deletion docker/uwsgi-slim.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ die-on-term = true
single-interpreter = true
# For debugging and testing
show-config = false
vacuum = true
vacuum = false
# fixing WARNING: you are running uWSGI without its master process manager
master = true
# wsgi.file_wrapper is an optimization of the WSGI standard. In some
Expand Down
2 changes: 1 addition & 1 deletion docker/uwsgi.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ die-on-term = true
single-interpreter = true
# For debugging and testing
show-config = false
vacuum = true
vacuum = false
# fixing WARNING: you are running uWSGI without its master process manager
master = true
uid = www-data
Expand Down
2 changes: 1 addition & 1 deletion otterwiki/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def fatal_error(msg):
print("Error: {}".format(msg), file=sys.stderr)
print("\nError: {}\n".format(msg), file=sys.stderr)
sys.exit(1)


Expand Down
2 changes: 1 addition & 1 deletion otterwiki/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

# ensure SECRET_KEY is set
if len(app.config["SECRET_KEY"])<16 or app.config["SECRET_KEY"] == "CHANGE ME":
fatal_error("Please confire a uniq random SECRET_KET of decent length")
fatal_error("Please configure a random SECRET_KEY with a length of at least 16 characters.")

# setup storage
if app.config["REPOSITORY"] is None:
Expand Down

0 comments on commit acf7b3b

Please sign in to comment.