forked from RockefellerArchiveCenter/scorpio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement cron as separate container #1
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM python:3.10 | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
RUN apt-get update && apt-get install -y cron && which cron && rm -rf /etc/cron.*/* | ||
RUN apt-get -y install python3-pip | ||
RUN pip install --upgrade pip | ||
|
||
RUN mkdir /code | ||
WORKDIR /code | ||
ADD requirements.txt /code/ | ||
RUN pip install --upgrade pip && pip install -r requirements.txt | ||
ADD . /code/ | ||
RUN chmod +x /code | ||
|
||
RUN ln -s /usr/local/bin/python3 /code/scorpio/python | ||
ADD ./cron/scorpio_cron /etc/cron.d/scorpio_cron | ||
RUN chmod 644 /etc/cron.d/scorpio_cron | ||
RUN crontab /etc/cron.d/scorpio_cron | ||
RUN mkdir -p /var/log/scorpio-cron | ||
ENTRYPOINT ["/code/cron/entrypoint.sh"] | ||
CMD ["cron","-f","-l","2"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
env >> environment | ||
|
||
# execute CMD | ||
echo "$@" | ||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Don't remove empty line at end of file. It is required for cron to run. | ||
SCORPIO_ROOT=/code/scorpio | ||
00,30 * * * * $SCORPIO_ROOT/python -u /code/manage.py runcrons "indexer.cron.IndexAgents" >> /var/log/scorpio-cron/scorpio-agents.txt 2>&1 | ||
10,40 * * * * $SCORPIO_ROOT/python -u /code/manage.py runcrons "indexer.cron.IndexCollections" >> /var/log/scorpio-cron/scorpio-collections.txt 2>&1 | ||
20,50 * * * * $SCORPIO_ROOT/python -u /code/manage.py runcrons "indexer.cron.IndexObjects" >> /var/log/scorpio-cron/scorpio-objects.txt 2>&1 | ||
5 0,12 * * * $SCORPIO_ROOT/python -u /code/manage.py runcrons "indexer.cron.CleanUpCompleted" >> /var/log/scorpio-cron/scorpio-cleanupcompleted.txt 2>&1 | ||
|