generated from RockefellerArchiveCenter/nebula
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #302 from RockefellerArchiveCenter/development
Add GET endpoint for reading room information
- Loading branch information
Showing
19 changed files
with
203 additions
and
20 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,39 @@ | ||
FROM python:3.10 | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
ARG REQUEST_BROKER_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 apt-get -y install cron | ||
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-request_broker.conf /etc/apache2/sites-available/000-request_broker.conf | ||
RUN sed "s/ENV_REQUEST_BROKER_DNS/${REQUEST_BROKER_DNS}/" -i /etc/apache2/sites-available/000-request_broker.conf | ||
RUN sed "s/ENV_REQUEST_BROKER_PORT/${APPLICATION_PORT}/" -i /etc/apache2/sites-available/000-request_broker.conf | ||
ADD ./apache/wsgi.load /etc/apache2/mods-available/wsgi.load | ||
RUN a2ensite 000-request_broker.conf | ||
RUN a2enmod headers | ||
RUN a2enmod rewrite | ||
RUN a2enmod wsgi | ||
|
||
COPY . /var/www/request-broker | ||
WORKDIR /var/www/request-broker | ||
RUN pip install -r requirements.txt | ||
|
||
COPY --chmod=644 crontab /etc/cron.d/crontab | ||
RUN crontab /etc/cron.d/crontab | ||
|
||
EXPOSE ${APPLICATION_PORT} | ||
|
||
ENTRYPOINT ["./entrypoint.prod.sh"] |
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
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,19 @@ | ||
Listen ENV_REQUEST_BROKER_PORT | ||
<VirtualHost *:ENV_REQUEST_BROKER_PORT> | ||
ErrorLog /var/log/apache2/request_broker_error_log | ||
CustomLog /var/log/apache2/request_broker_access_log combined | ||
ServerName ENV_REQUEST_BROKER_DNS | ||
DocumentRoot /var/www/html/ | ||
Alias /static /var/www/request-broker/static | ||
<Directory /var/www/request-broker/static> | ||
Require all granted | ||
</Directory> | ||
<Directory /var/www/request-broker/request_broker> | ||
WSGIProcessGroup request_broker | ||
WSGIApplicationGroup %{GLOBAL} | ||
Require all granted | ||
</Directory> | ||
WSGIDaemonProcess request_broker home=/var/www/request-broker | ||
WSGIProcessGroup request_broker | ||
WSGIScriptAlias / /var/www/request-broker/request_broker/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,2 @@ | ||
*/5 * * * * /usr/local/bin/python3 -u /var/www/request-broker/manage.py runcrons >/proc/1/fd/1 2>/proc/1/fd/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,16 @@ | ||
#!/bin/bash | ||
|
||
./wait-for-it.sh db:${SQL_PORT} -- echo "Apply database migrations" | ||
python manage.py migrate | ||
|
||
# Collect static files | ||
echo "Collecting static files" | ||
python manage.py collectstatic | ||
|
||
#Start cron | ||
echo "Starting cron" | ||
cron | ||
|
||
#Start server | ||
echo "Starting server" | ||
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
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
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
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 @@ | ||
# Generated by Django 4.0.6 on 2023-03-13 17:55 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('process_request', '0003_auto_20211106_1625'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ReadingRoomCache', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('timestamp', models.DateTimeField(auto_now=True)), | ||
('json', models.TextField()), | ||
], | ||
), | ||
] |
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
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
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
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
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,12 @@ | ||
from django_cron import CronJobBase, Schedule | ||
|
||
from process_request.helpers import refresh_reading_room_cache | ||
from request_broker.settings import AEON | ||
|
||
|
||
class RefreshReadingRoomCache(CronJobBase): | ||
schedule = Schedule(run_every_mins=AEON["cache_duration"]) | ||
code = 'request_broker.refresh_reading_room_cache' | ||
|
||
def do(self): | ||
refresh_reading_room_cache() |
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
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
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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
ArchivesSnake~=0.9 | ||
Django~=4.1 | ||
django-cors-headers~=3.12 | ||
django-cors-headers~=3.13 | ||
django-csp~=3.7 | ||
django4-cron~=0.5 | ||
djangorestframework~=3.13 | ||
inflect~=5.6 | ||
inflect~=6.0.0 | ||
ordered-set~=4.1 | ||
psycopg2~=2.9 | ||
requests~=2.28 | ||
shortuuid~=1.0 | ||
vcrpy~=4.2 | ||
shortuuid~=1.0.9 | ||
vcrpy~=5.1 |
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