Skip to content

Commit

Permalink
Add startup script to run uwsgi in standalone mode without consul
Browse files Browse the repository at this point in the history
  • Loading branch information
alastair committed Jun 28, 2022
1 parent dd51951 commit 438d0d2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ COPY ./docker/uwsgi/uwsgi.ini /etc/uwsgi/uwsgi.ini
COPY ./docker/uwsgi/consul-template-uwsgi.conf /etc/consul-template-uwsgi.conf
RUN touch /etc/service/uwsgi/down

# Standalone version of uwsgi that doesn't require consul
COPY ./docker/uwsgistandalone/uwsgi.service /etc/service/uwsgistandalone/run
COPY ./docker/uwsgistandalone/uwsgi.ini /etc/uwsgi/uwsgi.ini
RUN touch /etc/service/uwsgistandalone/down

# hl_extractor service files
COPY ./docker/hl_extractor/hl_extractor.service /etc/service/hl_extractor/run
COPY docker/hl_extractor/consul-template-hl-extractor.conf /etc/consul-template-hl-extractor.conf
Expand Down
6 changes: 6 additions & 0 deletions docker/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
# All services contain a name and an environment (e.g. acousticbrainz-web-prod).
# Set DEPLOY_ENV to 'prod' or 'beta' to indicate this

if [ "${CONTAINER_ROLE}" = "acousticbrainz-standalone" ]
then
rm -f /etc/service/uwsgistandalone/down
exit 0
fi

if [ "${CONTAINER_ROLE}" = "acousticbrainz-web-${DEPLOY_ENV}" ]
then
rm -f /etc/service/uwsgi/down
Expand Down
10 changes: 10 additions & 0 deletions docker/uwsgistandalone/uwsgi.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[uwsgi]
master = true
http = 0.0.0.0:3031
module = server
callable = application
chdir = /code
enable-threads = true
processes = 100
log-x-forwarded-for = true
disable-logging = true
3 changes: 3 additions & 0 deletions docker/uwsgistandalone/uwsgi.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

exec chpst -uacousticbrainz:acousticbrainz uwsgi --die-on-term /etc/uwsgi/uwsgi.ini

0 comments on commit 438d0d2

Please sign in to comment.