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

Gunicorn: Configs added. Version: Bumped #46

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/openapi-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
python-version: "3.10"
- name: Install app
run: |
python -m pip install openg2p-fastapi-common==1.0.0
python -m pip install openg2p-g2pconnect-common-lib==1.0.0
python -m pip install openg2p-g2pconnect-mapper-lib==1.0.0
python -m pip install git+https://github.com/openg2p/openg2p-fastapi-common@develop\#subdirectory=openg2p-fastapi-common
python -m pip install git+https://github.com/openg2p/openg2p-g2pconnect-common-lib@develop\#subdirectory=openg2p-g2pconnect-common-lib
python -m pip install git+https://github.com/openg2p/openg2p-g2pconnect-common-lib@develop\#subdirectory=openg2p-g2pconnect-mapper-lib
python -m pip install .
- name: Generate openapi json
run: |
Expand Down
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ USER ${container_user}
ADD --chown=${container_user}:${container_user_group} . /app/src
ADD --chown=${container_user}:${container_user_group} main.py /app

RUN python3 -m venv venv \
&& . ./venv/bin/activate
RUN python3 -m pip install \
openg2p-fastapi-common==1.0.0 \
openg2p-g2pconnect-common-lib==1.0.0 \
openg2p-g2pconnect-mapper-lib==1.0.0 \
git+https://github.com/openg2p/openg2p-fastapi-common@develop\#subdirectory=openg2p-fastapi-common \
git+https://github.com/OpenG2P/openg2p-g2pconnect-common-lib@develop\#subdirectory=openg2p-g2pconnect-common-lib \
git+https://github.com/OpenG2P/openg2p-g2pconnect-common-lib@develop\#subdirectory=openg2p-g2pconnect-mapper-lib \
./src

ENV SPAR_MAPPER_WORKER_TYPE=gunicorn
ENV SPAR_MAPPER_HOST=0.0.0.0
ENV SPAR_MAPPER_PORT=8000
ENV SPAR_MAPPER_NO_OF_WORKERS=3

CMD python3 main.py migrate; \
python3 main.py run
gunicorn "main:app" --workers ${SPAR_MAPPER_NO_OF_WORKERS} --worker-class uvicorn.workers.UvicornWorker --bind ${SPAR_MAPPER_HOST}:{SPAR_MAPPER_PORT}
7 changes: 5 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from openg2p_fastapi_common.ping import PingInitializer

main_init = Initializer()

PingInitializer()
main_init.main()

app = main_init.return_app()

if __name__ == "__main__":
main_init.main()
2 changes: 1 addition & 1 deletion src/openg2p_spar_mapper_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.0"
__version__ = "1.1.0"
6 changes: 3 additions & 3 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pytest-asyncio
pytest-cov
openg2p-fastapi-common==1.0.0
openg2p-g2pconnect-common-lib==1.0.0
openg2p-g2pconnect-mapper-lib==1.0.0
git+https://github.com/openg2p/openg2p-fastapi-common@develop#subdirectory=openg2p-fastapi-common
git+https://github.com/openg2p/openg2p-g2pconnect-common@develop#subdirectory=openg2p-g2pconnect-common-lib
git+https://github.com/OpenG2P/openg2p-g2pconnect-common@develop#subdirectory=openg2p-g2pconnect-mapper-lib
Loading