-
Notifications
You must be signed in to change notification settings - Fork 17
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
Feat/al2 updates #421
Merged
+225
−532
Merged
Feat/al2 updates #421
Changes from 44 commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
6f6feb5
(PPS-710): use new branches of gen3datamodel and related repos
george42-ctds 1e8c563
(PPS-710): replace 'gdcdatamodel' with 'gen3datamodel'
george42-ctds 4d291f9
(PPS-710): replace 'gdcdatamodel' with 'gen3datamodel'
george42-ctds 5d36356
(PPS-710): replace 'gdcdatamodel' with 'gen3datamodel'
george42-ctds 0504877
(PPS-710): replace 'gdcdatamodel' with 'gen3datamodel'
george42-ctds 643b424
adding nginx and gunicorn to sheepdog image
EliseCastle23 b608fa7
Update settings.py
jawadqur 33e328f
adding nginx and gunicorn to sheepdog image
jawadqur 31ae1de
Update nginx.conf
jawadqur eb0c9d8
(PPS-710): re-lock to pick up changes in datamodelutils
george42-ctds 691bd70
Stagger start of gunicorn workers, flip nginx/gunicorn starts
george42-ctds 8a7ef28
Set preload_app = False
george42-ctds b5df998
Merge branch 'chore/update-gen3datamodel' into feat/al2-updates
george42-ctds dcc5856
adding updates to pyproject.toml file
EliseCastle23 9f34a8d
updating case in dockerfile
EliseCastle23 e23f689
Merge branch 'master' into feat/al2-updates
EliseCastle23 138e2b9
re-lock
george42-ctds 0da46be
updating base image to python nginx
EliseCastle23 52d331d
Merge branch 'feat/al2-updates' of https://github.com/uc-cdis/sheepdo…
EliseCastle23 a68808c
updating lock file
EliseCastle23 077de4d
modifying settings.py
EliseCastle23 fb71416
updating lock file
EliseCastle23 769e392
fixing build error
EliseCastle23 fcb68f9
updating poetry lock
EliseCastle23 da2df89
testing installing packages to fix build error
EliseCastle23 62055f0
moving command
EliseCastle23 fef6157
moving command again
EliseCastle23 bea25df
test
EliseCastle23 43a1e6b
test adding gcc only
EliseCastle23 fc144e4
testing
EliseCastle23 cbd124a
testing python devel and gcc
EliseCastle23 a618457
python3-devel postgresql-devel gcc
EliseCastle23 4e534bd
sheepdog app init updates
EliseCastle23 3e779c0
updating settings
EliseCastle23 d6c3203
adding extra import
EliseCastle23 dda2860
pinning versions and updating variable syntax
EliseCastle23 3d2bf6a
adding "postgresql-libs" to ensure the "libpq.so.5" library is added
EliseCastle23 e8bb8de
making suggested updates
EliseCastle23 b8085df
removing commented command
EliseCastle23 5fc125f
editing nginx command
EliseCastle23 375eee9
adding back sleep
EliseCastle23 2e562ba
fixing syntax error
EliseCastle23 b52a6d9
adding comment
EliseCastle23 7308e9e
Update dockerrun.bash
EliseCastle23 ed548c4
Necessary for flask apps internally. Kept per Alex VanTol's recommend…
piotrsenkow b7ccea1
Merge branch 'master' into feat/al2-updates
piotrsenkow cfa0e33
adding newly generate poetry.lock file after modifying pyproject.toml…
piotrsenkow 53bf9d5
Merge branch 'feat/al2-updates' of github.com:uc-cdis/sheepdog into f…
piotrsenkow ca423d4
ran Resolving dependencies... to fix breaking unit test
piotrsenkow 3f286ee
loading in flask_secret_key from the settings after line was removed
piotrsenkow 67e9ac8
Merge branch 'master' into feat/al2-updates
piotrsenkow 6abe669
regenerated poetry.lock file
piotrsenkow 7189130
verbose poetry install flag fix
piotrsenkow faf4b6e
fixing docker file after previous merge conflict
piotrsenkow 74ca1de
psycopg2 binary 2.9a
piotrsenkow be7ce80
reverting psycopg2-binary version
piotrsenkow a54d85f
regenerating lock file
piotrsenkow 4a1845e
adding --no-root flag to poetry install command in dockerfile
piotrsenkow 6d87998
trying to fix breaking build due to this poetry command
piotrsenkow effeba6
adding sheepdog package to pyproject.toml so that package is included
piotrsenkow 3ab090f
copying over entire project before poetry install
piotrsenkow c0ccb5f
installing postgresql-devel before installing poetry
piotrsenkow b2272e2
installing libpq too
piotrsenkow d175b6b
hoping this resolves the postgresql binary issue
piotrsenkow 3eea853
still wont build, trying to dnf clean
piotrsenkow d8ad4b8
Maybe if I pip install psycopg2-binary or yum install the pg librarie…
piotrsenkow f62495f
forgot to capitalize RUN
piotrsenkow ad4c8f2
removing yum install
piotrsenkow ddef5ba
lets try installing dependencies with yum
piotrsenkow 10a6825
setting psycopg2-binary = ">=2.8.2,<2.9.0" in pyproject.toml and tryi…
piotrsenkow 230bef1
rolling sheepdog version forward
piotrsenkow 91fd164
bumping up a version
piotrsenkow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,65 +1,43 @@ | ||
# To run: | ||
# - Create and fill out `creds.json`: | ||
# { | ||
# "fence_host": "", | ||
# "fence_username": "", | ||
# "fence_password": "", | ||
# "fence_database": "", | ||
# "db_host": "", | ||
# "db_username": "", | ||
# "db_password": "", | ||
# "db_database": "", | ||
# "gdcapi_secret_key": "", | ||
# "indexd_password": "", | ||
# "hostname": "" | ||
# } | ||
# - Build the image: `docker build . -t sheepdog -f Dockerfile` | ||
# - Run: `docker run -v /full/path/to/creds.json:/var/www/sheepdog/creds.json -p 81:80 sheepdog` | ||
# To check running container: `docker exec -it sheepdog /bin/bash` | ||
|
||
FROM quay.io/cdis/python:python3.9-buster-2.0.0 | ||
ARG AZLINUX_BASE_VERSION=master | ||
|
||
# Base stage with python-build-base | ||
FROM quay.io/cdis/python-nginx-al:${AZLINUX_BASE_VERSION} AS base | ||
|
||
ENV appname=sheepdog | ||
|
||
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 chown -R gen3:gen3 /${appname} | ||
|
||
# Builder stage | ||
FROM base AS builder | ||
|
||
RUN dnf install -y python3-devel postgresql-devel gcc | ||
|
||
USER gen3 | ||
|
||
COPY poetry.lock pyproject.toml /${appname}/ | ||
|
||
RUN poetry install -vv --without dev --no-interaction | ||
|
||
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 | ||
COPY --chown=gen3:gen3 . /${appname} | ||
|
||
EXPOSE 80 | ||
# Run poetry again so this app itself gets installed too | ||
RUN poetry install --without dev --no-interaction | ||
|
||
WORKDIR /$appname | ||
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 | ||
|
||
# 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 | ||
# Final stage | ||
FROM base | ||
|
||
# copy source code ONLY after installing dependencies | ||
COPY . /$appname | ||
COPY ./deployment/uwsgi/uwsgi.ini /etc/uwsgi/uwsgi.ini | ||
COPY ./bin/settings.py /var/www/$appname/settings.py | ||
COPY ./bin/confighelper.py /var/www/$appname/confighelper.py | ||
RUN yum install -y postgresql-libs | ||
|
||
# install sheepdog | ||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install -vv --no-dev --no-interaction \ | ||
&& poetry show -v | ||
COPY --from=builder /${appname} /${appname} | ||
|
||
RUN COMMIT=`git rev-parse HEAD` && echo "COMMIT=\"${COMMIT}\"" >$appname/version_data.py \ | ||
&& VERSION=`git describe --always --tags` && echo "VERSION=\"${VERSION}\"" >>$appname/version_data.py | ||
# Switch to non-root user 'gen3' for the serving process | ||
USER gen3 | ||
|
||
WORKDIR /var/www/$appname | ||
WORKDIR /${appname} | ||
|
||
RUN ls | ||
CMD /dockerrun.sh | ||
CMD ["/sheepdog/dockerrun.bash"] |
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
This file was deleted.
Oops, something went wrong.
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,9 @@ | ||
wsgi_app = "bin.settings:application" | ||
bind = "0.0.0.0:8000" | ||
workers = 1 | ||
preload_app = True | ||
user = "gen3" | ||
group = "gen3" | ||
timeout = 300 | ||
keepalive = 2 | ||
keepalive_timeout = 5 |
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,4 @@ | ||
#!/bin/bash | ||
|
||
nginx | ||
poetry run gunicorn -c "/sheepdog/deployment/wsgi/gunicorn.conf.py" |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see
os.environ.get
andenviron.get
both being used. Wanted to make sure this is intentional and not an oversight.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that was intentional and I believe a step Alex mentioned that we needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @nss10 is speaking to the inconsistency here. You don't need to import os and use os.environ in the "host" line, you could have just reused the imported environ like the previous code.
It's not a huge deal, we can have a separate PR to clean this up after we merge this