Skip to content

Commit

Permalink
Merge pull request #185 from paramsingh/cron
Browse files Browse the repository at this point in the history
CB-232: Add support for running cron jobs in prod
  • Loading branch information
paramsingh committed Mar 15, 2018
2 parents 1a3a6ba + 8d24e98 commit c13c7f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ RUN ./node_modules/.bin/gulp
# Compile translations
RUN pybabel compile -d critiquebrainz/frontend/translations

RUN useradd --create-home --shell /bin/bash critiquebrainz

############
# Services #
############
Expand All @@ -63,9 +65,13 @@ COPY ./docker/prod/uwsgi/uwsgi.ini /etc/uwsgi/uwsgi.ini

# cron jobs
ADD ./docker/prod/cron/jobs /tmp/crontab
RUN crontab /tmp/crontab
RUN chmod 0644 /tmp/crontab && crontab -u critiquebrainz /tmp/crontab
RUN rm /tmp/crontab

# Make sure the cron service doesn't start automagically
# http://smarden.org/runit/runsv.8.html
RUN touch /etc/service/cron/down

ARG GIT_COMMIT_SHA
ENV GIT_SHA ${GIT_COMMIT_SHA}

Expand Down
2 changes: 2 additions & 0 deletions docker/prod/uwsgi/uwsgi.service
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh

rm -f /etc/service/cron/down
sv restart cron
exec uwsgi /etc/uwsgi/uwsgi.ini

0 comments on commit c13c7f5

Please sign in to comment.