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.
Add Docker production config RockefellerArchiveCenter#175
- Loading branch information
Showing
5 changed files
with
71 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,36 @@ | ||
FROM python:3.10 | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
ARG SCORPIO_DNS | ||
ARG APPLICATION_PORT | ||
RUN apt-get update | ||
RUN apt-get install --yes apache2 apache2-dev | ||
RUN apt-get install --yes postgresql | ||
RUN apt-get -y install python3-pip | ||
RUN pip install --upgrade pip | ||
|
||
RUN wget https://github.com/GrahamDumpleton/mod_wsgi/archive/refs/tags/4.9.0.tar.gz \ | ||
&& tar xvfz 4.9.0.tar.gz \ | ||
&& cd mod_wsgi-4.9.0 \ | ||
&& ./configure --with-apxs=/usr/bin/apxs --with-python=/usr/local/bin/python \ | ||
&& make \ | ||
&& make install \ | ||
&& make clean | ||
|
||
ADD ./apache/000-scorpio.conf /etc/apache2/sites-available/000-scorpio.conf | ||
RUN sed "s/ENV_SCORPIO_DNS/${SCORPIO_DNS}/" -i /etc/apache2/sites-available/000-scorpio.conf | ||
RUN sed "s/ENV_SCORPIO_PORT/${APPLICATION_PORT}/" -i /etc/apache2/sites-available/000-scorpio.conf | ||
ADD ./apache/wsgi.load /etc/apache2/mods-available/wsgi.load | ||
RUN a2dissite 000-default | ||
RUN a2ensite 000-scorpio.conf | ||
RUN a2enmod headers | ||
RUN a2enmod rewrite | ||
RUN a2enmod wsgi | ||
|
||
COPY . /var/www/scorpio | ||
WORKDIR /var/www/scorpio | ||
RUN pip install -r requirements.txt | ||
RUN ./manage.py collectstatic | ||
|
||
EXPOSE ${APPLICATION_PORT} | ||
CMD ["apache2ctl", "-D", "FOREGROUND"] |
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,20 @@ | ||
Listen ENV_SCORPIO_PORT | ||
<VirtualHost *:ENV_SCORPIO_PORT> | ||
ErrorLog /var/log/apache2/scorpio_error_log | ||
CustomLog /var/log/apache2/scorpio_access_log combined | ||
ServerName ENV_SCORPIO_DNS | ||
DocumentRoot /var/www/html | ||
Alias /static /var/www/scorpio/static | ||
<Directory /var/www/scorpio/static> | ||
Options Includes FollowSymLinks MultiViews | ||
Require all granted | ||
</Directory> | ||
<Directory /var/www/scorpio/scorpio> | ||
WSGIProcessGroup scorpio | ||
WSGIApplicationGroup %{GLOBAL} | ||
Require all granted | ||
</Directory> | ||
WSGIDaemonProcess scorpio home=/var/www/scorpio | ||
WSGIProcessGroup scorpio | ||
WSGIScriptAlias / /var/www/scorpio/scorpio/wsgi.py | ||
</VirtualHost> |
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 @@ | ||
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so |
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 | ||
|