-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add resource metrics Add psutil memory info metrics
- Loading branch information
Showing
52 changed files
with
1,596 additions
and
32 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
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
File renamed without changes.
File renamed without changes.
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,69 @@ | ||
FROM camptocamp/c2cwsgiutils as base-all | ||
LABEL maintainer Camptocamp "info@camptocamp.com" | ||
SHELL ["/bin/bash", "-o", "pipefail", "-cux"] | ||
|
||
# Used to convert the locked packages by poetry to pip requirements format | ||
# We don't directly use `poetry install` because it force to use a virtual environment. | ||
FROM base-all as poetry | ||
|
||
RUN --mount=type=cache,target=/var/lib/apt/lists \ | ||
--mount=type=cache,target=/var/cache,sharing=locked \ | ||
apt-get update \ | ||
&& apt-get install --assume-yes --no-install-recommends python-is-python3 | ||
|
||
# Install Poetry | ||
WORKDIR /tmp | ||
COPY requirements.txt ./ | ||
RUN python3 -m pip install --disable-pip-version-check --requirement=requirements.txt | ||
|
||
# Do the conversion | ||
COPY poetry.lock pyproject.toml ./ | ||
RUN poetry export --output=requirements.txt \ | ||
&& poetry export --with=dev --output=requirements-dev.txt | ||
|
||
# Base, the biggest thing is to install the Python packages | ||
FROM base-all as base | ||
|
||
WORKDIR /app | ||
|
||
EXPOSE 8080 | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
--mount=type=bind,from=poetry,source=/tmp,target=/poetry \ | ||
python3 -m pip install --disable-pip-version-check --no-deps --requirement=/poetry/requirements.txt | ||
|
||
COPY . /app | ||
|
||
ARG GIT_HASH | ||
|
||
RUN --mount=type=cache,target=/root/.cache \ | ||
python3 -m pip install --disable-pip-version-check --no-deps --editable=. \ | ||
&& python3 -m pip freeze > /requirements.txt | ||
RUN ./models_graph.py > models.dot \ | ||
&& ./models_graph.py Hello > models-hello.dot \ | ||
&& c2cwsgiutils-genversion $GIT_HASH \ | ||
&& python3 -m compileall -q . | ||
|
||
ENV \ | ||
DOCKER_RUN=1 \ | ||
DEVELOPMENT=0 \ | ||
SQLALCHEMY_POOL_RECYCLE=30 \ | ||
SQLALCHEMY_POOL_SIZE=5 \ | ||
SQLALCHEMY_MAX_OVERFLOW=25 \ | ||
SQLALCHEMY_SLAVE_POOL_RECYCLE=30 \ | ||
SQLALCHEMY_SLAVE_POOL_SIZE=5 \ | ||
SQLALCHEMY_SLAVE_MAX_OVERFLOW=25 \ | ||
LOG_TYPE=console \ | ||
OTHER_LOG_LEVEL=WARNING \ | ||
GUNICORN_LOG_LEVEL=WARNING \ | ||
SQL_LOG_LEVEL=WARNING \ | ||
C2CWSGIUTILS_LOG_LEVEL=WARNING \ | ||
LOG_LEVEL=INFO | ||
|
||
RUN mkdir -p /prometheus-metrics \ | ||
&& chmod a+rwx /prometheus-metrics | ||
ENV PROMETHEUS_MULTIPROC_DIR=/prometheus-metrics | ||
|
||
# www-data | ||
USER 33 | ||
|
||
CMD ["/venv/bin/gunicorn", "--paste=/app/application.ini"] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
3 changes: 2 additions & 1 deletion
3
...ce_tests/app/c2cwsgiutils_app/__init__.py → ...gunicorn_app/c2cwsgiutils_app/__init__.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
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
File renamed without changes.
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
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
acceptance_tests/app/models_graph.py → ...ptance_tests/gunicorn_app/models_graph.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
acceptance_tests/app/scripts/wait-db → ...ptance_tests/gunicorn_app/scripts/wait-db
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 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 @@ | ||
[run] | ||
source= | ||
/opt/c2cwsgiutils/c2cwsgiutils | ||
/app/c2cwsgiutils_app | ||
branch=True | ||
omit= | ||
/opt/c2cwsgiutils/c2cwsgiutils/acceptance/* | ||
/opt/c2cwsgiutils/c2cwsgiutils/models_graph.py | ||
/opt/c2cwsgiutils/c2cwsgiutils/coverage_setup.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
**/__pycache__ | ||
Dockerfile | ||
c2cwsgiutils_app.egg-info |
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,8 @@ | ||
# A sample application | ||
|
||
This is a sample application shipped as a Docker Image. | ||
|
||
It's used for testing the library. Because we want to test the currently | ||
checked out version of the library, it is not in the requirements.txt | ||
file. The root Makefile copies the library inline with the application | ||
before building the Docker image. |
Oops, something went wrong.