Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding gunicorn instead of uwsgi and modifying the base image. #362

Open
wants to merge 57 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
21eac2b
adding gunicorn instead of uwsgi and modifying the base image to use …
EliseCastle23 Jul 17, 2023
a306bbe
resetting the lock and toml files as I changed to try an resolve a po…
EliseCastle23 Jul 17, 2023
d436084
changing workers to 1 and adding the Docker cmd
EliseCastle23 Jul 17, 2023
e76088f
changed the format of the CMD in the Dockerfile, changed the port fro…
EliseCastle23 Jul 18, 2023
a441e9a
removing comment and re-building image
EliseCastle23 Jul 25, 2023
c121d94
Changing the user to "nobody" so the container doesn't run as root. A…
EliseCastle23 Jul 26, 2023
ffc63f8
changing the Dockerfile to use user "appuser" instead of "nobody" as …
EliseCastle23 Aug 7, 2023
03ecf41
did a mutli-stage Dockerbuild to reduce image size
EliseCastle23 Aug 8, 2023
f2d7006
changing to port 8000 for testing
EliseCastle23 Aug 9, 2023
03223c2
changing back to port 80 for Jenkins testing
EliseCastle23 Aug 11, 2023
3751d38
changing back to port 8000 and will modify the indexd service
EliseCastle23 Aug 11, 2023
56fdfba
made changes to the Dockerfile to fix error with indexd being install…
EliseCastle23 Aug 15, 2023
e8eff00
removing the dockerrun from the indexd_setup script
EliseCastle23 Aug 15, 2023
8deb1bc
increasing timeouts for testing
EliseCastle23 Sep 19, 2023
72e163e
adding a worker class for better concurrency
EliseCastle23 Sep 20, 2023
d97fe2b
testing gevent
EliseCastle23 Sep 20, 2023
453c861
removing gevent as it is no longer needed.
EliseCastle23 Sep 21, 2023
d3f403e
changing the base image for indexd as I moved the python3.9 image to …
EliseCastle23 Sep 22, 2023
cfe4742
changing the image indexd is based on
EliseCastle23 Sep 26, 2023
86ff8dd
updating the image that the runtime iamge is based on
EliseCastle23 Oct 5, 2023
7092eec
feat: update to new base image
m0nhawk Oct 6, 2023
79fb97e
Merge pull request #369 from uc-cdis/feat/base-image
EliseCastle23 Nov 10, 2023
f58c38b
Add gunicorn
jawadqur Nov 28, 2023
45efbe2
Change Dockerfile to use gen3 user
jawadqur Nov 29, 2023
7fd7b7e
adding nginx to indexd
EliseCastle23 Aug 9, 2024
64e536e
dummy commit
EliseCastle23 Aug 12, 2024
54ff527
fixing case issue
EliseCastle23 Aug 12, 2024
db11bff
pushing up pyproject.toml changes
EliseCastle23 Sep 4, 2024
8c65220
Merge branch 'master' into feat/GPE-788
EliseCastle23 Sep 4, 2024
8bb67cf
pushing up poetry lock change
EliseCastle23 Sep 4, 2024
0befafb
adding comment and changing localhost to ip address
EliseCastle23 Sep 4, 2024
4db16ed
setting to only amd
EliseCastle23 Sep 5, 2024
3dd7ba4
changing the startup command
EliseCastle23 Sep 6, 2024
30b5941
Merge branch 'master' into feat/GPE-788
EliseCastle23 Oct 16, 2024
c829195
updating gunicorn
EliseCastle23 Oct 16, 2024
e9b4ae9
Update indexd_setup.sh
EliseCastle23 Oct 21, 2024
2ebde68
adding docker compose file for unit testing.
EliseCastle23 Oct 22, 2024
9f6243f
adding fix for docker compose file
EliseCastle23 Oct 22, 2024
4e792a5
updating pyproject
EliseCastle23 Oct 22, 2024
1090ed5
updating dockerfile to consolidate
EliseCastle23 Oct 24, 2024
82ee91e
adding suggested updates
EliseCastle23 Oct 24, 2024
f0146e6
making suggested updates
EliseCastle23 Oct 24, 2024
49e07fd
adding update to number of workers
EliseCastle23 Oct 24, 2024
f223caa
fixing base image ref
EliseCastle23 Oct 24, 2024
d7b9b86
testing change to pyproject
EliseCastle23 Oct 31, 2024
11ad9b3
removing comment
EliseCastle23 Nov 1, 2024
b255010
adding "poetry run" to "gunicorn" command
EliseCastle23 Nov 1, 2024
d12ad68
updating pyproject dependencies
EliseCastle23 Nov 1, 2024
7a86165
updating poetry install command
EliseCastle23 Nov 1, 2024
6f93e8d
update poetry install cmd
MaribelleHGomez Nov 1, 2024
aa0502d
removing source command
EliseCastle23 Nov 1, 2024
78634f6
updating base image
EliseCastle23 Nov 1, 2024
69e82d7
updating "AS"
EliseCastle23 Nov 1, 2024
c537faa
Update Dockerfile
EliseCastle23 Nov 1, 2024
2be1a74
fixing variable syntax
EliseCastle23 Nov 12, 2024
d5e4578
updating workflow to include arm images
EliseCastle23 Nov 13, 2024
783b95a
removing unneeded file
EliseCastle23 Nov 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 27 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,40 @@
# To run: docker run -v /path/to/wsgi.py:/var/www/indexd/wsgi.py --name=indexd -p 81:80 indexd
# To check running container: docker exec -it indexd /bin/bash
ARG AZLINUX_BASE_VERSION=master

FROM quay.io/cdis/python:python3.9-buster-2.0.0
# Base stage with python-build-base
FROM quay.io/cdis/python-nginx-al:${AZLINUX_BASE_VERSION} AS base

ENV appname=indexd

RUN pip install --upgrade pip poetry
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential libffi-dev musl-dev gcc libxml2-dev libxslt-dev \
curl bash git vim
WORKDIR /${appname}

RUN mkdir -p /var/www/$appname \
&& mkdir -p /var/www/.cache/Python-Eggs/ \
&& mkdir /run/nginx/ \
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& chown nginx -R /var/www/.cache/Python-Eggs/ \
&& chown nginx /var/www/$appname
RUN chown -R gen3:gen3 /${appname}

EXPOSE 80
# Builder stage
FROM base AS builder

WORKDIR /$appname
USER gen3

# copy ONLY poetry artifact, install the dependencies but not indexd
# this will make sure than the dependencies is cached
COPY poetry.lock pyproject.toml /$appname/
RUN poetry config virtualenvs.create false \
&& poetry install -vv --no-root --no-dev --no-interaction \
&& poetry show -v
COPY poetry.lock pyproject.toml /${appname}/

# copy source code ONLY after installing dependencies
COPY . /$appname
COPY ./deployment/uwsgi/uwsgi.ini /etc/uwsgi/uwsgi.ini
COPY ./deployment/uwsgi/wsgi.py /$appname/wsgi.py
COPY clear_prometheus_multiproc /$appname/clear_prometheus_multiproc
RUN poetry install -vv --without dev --no-interaction

# install indexd
RUN poetry config virtualenvs.create false \
&& poetry install -vv --no-dev --no-interaction \
&& poetry show -v
COPY --chown=gen3:gen3 . /${appname}
COPY --chown=gen3:gen3 ./deployment/wsgi/wsgi.py /${appname}/wsgi.py

RUN COMMIT=`git rev-parse HEAD` && echo "COMMIT=\"${COMMIT}\"" >$appname/index/version_data.py \
&& VERSION=`git describe --always --tags` && echo "VERSION=\"${VERSION}\"" >>$appname/index/version_data.py
# Run poetry again so this app itself gets installed too
RUN poetry install --without dev --no-interaction

# directory where the app can find Alembic files
WORKDIR /indexd
RUN git config --global --add safe.directory /${appname} && COMMIT=`git rev-parse HEAD` && echo "COMMIT=\"${COMMIT}\"" > /${appname}/version_data.py \
&& VERSION=`git describe --always --tags` && echo "VERSION=\"${VERSION}\"" >> /${appname}/version_data.py

CMD ["/dockerrun.sh"]
# Final stage
FROM base

COPY --from=builder /${appname} /${appname}

# Switch to non-root user 'gen3' for the serving process
USER gen3

WORKDIR /${appname}

CMD ["/bin/bash", "-c", "/indexd/dockerrun.bash"]
14 changes: 0 additions & 14 deletions deployment/scripts/indexd/indexd_setup.sh

This file was deleted.

36 changes: 0 additions & 36 deletions deployment/uwsgi/uwsgi.ini

This file was deleted.

9 changes: 9 additions & 0 deletions deployment/wsgi/gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
wsgi_app = "deployment.wsgi.wsgi:application"
bind = "0.0.0.0:8000"
workers = 1
preload_app = True
user = "gen3"
group = "gen3"
timeout = 300
keepalive = 2
keepalive_timeout = 5
File renamed without changes.
4 changes: 4 additions & 0 deletions dockerrun.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

nginx
poetry run gunicorn -c "/indexd/deployment/wsgi/gunicorn.conf.py"
Loading
Loading