Skip to content

Commit

Permalink
wip dynamic dashboard run using gunicorn
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjwebb committed Oct 31, 2024
1 parent 56921a3 commit 3f012b8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data
out
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM python:3.12-bookworm

WORKDIR /work
WORKDIR /work/IATI-Dashboard/dashboard

COPY requirements.txt /work/IATI-Dashboard/requirements.txt

RUN git config --global --add safe.directory /work/IATI-Stats/data

RUN pip install -r /work/IATI-Dashboard/requirements.txt

COPY . /work/IATI-Dashboard

# 2024-03-20: Emergency fix
# We were seeing cert errors inside the docker container after a new Lets Encrypt was issued.
#
Expand All @@ -17,3 +19,5 @@ RUN pip install -r /work/IATI-Dashboard/requirements.txt
# I tried installing the LE root cert's manually but that didn't work.
# As live is broken for now we need this emergency fix, but we should remove it in the future.
RUN echo "check_certificate=off" > /root/.wgetrc

CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--timeout", "120", "ui.wsgi:application"]
7 changes: 4 additions & 3 deletions git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ mkdir out
echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Fetching data"
./fetch_data.sh &> fetch_data.log || exit 1

cd dashboard

echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Running plots.py"
python plots.py || exit 1
python make_plots.py || exit 1

echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Running make_csv.py"
python make_csv.py || exit 1

echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Running speakers kit.py"
python speakers_kit.py || exit 1

echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Running make_html.py"
python make_html.py $1 $2|| exit 1
cd ..

echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Copying static elements"
cp static/img/favicon.png out/
Expand Down
3 changes: 2 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
django
gunicorn
flask
frozen-flask
jinja2
Expand All @@ -11,4 +12,4 @@ lxml
requests
markupsafe
itsdangerous
tqdm
tqdm
8 changes: 6 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile requirements.in
# pip-compile
#
asgiref==3.8.1
# via django
Expand Down Expand Up @@ -30,6 +30,8 @@ fonttools==4.54.1
# via matplotlib
frozen-flask==1.0.2
# via -r requirements.in
gunicorn==23.0.0
# via -r requirements.in
idna==3.10
# via requests
itsdangerous==2.2.0
Expand All @@ -56,7 +58,9 @@ numpy==2.1.1
# contourpy
# matplotlib
packaging==24.1
# via matplotlib
# via
# gunicorn
# matplotlib
pillow==10.4.0
# via matplotlib
pyparsing==3.1.4
Expand Down
3 changes: 3 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ fonttools==4.54.1
# matplotlib
frozen-flask==1.0.2
# via -r requirements.txt
gunicorn==23.0.0
# via -r requirements.txt
idna==3.10
# via
# -r requirements.txt
Expand Down Expand Up @@ -95,6 +97,7 @@ numpy==2.1.1
packaging==24.1
# via
# -r requirements.txt
# gunicorn
# matplotlib
# pytest
pillow==10.4.0
Expand Down

0 comments on commit 3f012b8

Please sign in to comment.