-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
30 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
FROM python:3.8.3-alpine3.12 as base | ||
FROM base as builder | ||
RUN apk --no-cache --update-cache add gcc python3 python3-dev py-pip build-base wget | ||
RUN apk --no-cache --update-cache add gcc python3 python3-dev py-pip build-base wget libffi-dev | ||
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h | ||
RUN pip install pipenv | ||
RUN pip install pipenv gunicorn gevent | ||
RUN mkdir -p /src/ngsi-timeseries-api | ||
COPY Pipfile /src/ngsi-timeseries-api/Pipfile | ||
COPY Pipfile.lock /src/ngsi-timeseries-api/Pipfile.lock | ||
RUN cd /src/ngsi-timeseries-api && { pipenv lock -r > /requirements.txt; } | ||
RUN pip install -r /requirements.txt | ||
|
||
FROM base | ||
RUN apk --no-cache add curl | ||
RUN apk --no-cache add curl supervisor | ||
COPY --from=builder /usr/local /usr/local | ||
COPY . /src/ngsi-timeseries-api/ | ||
WORKDIR /src/ngsi-timeseries-api/src | ||
ENV PYTHONPATH=$PWD:$PYTHONPATH | ||
COPY conf/supervisord.conf /etc/supervisord.conf | ||
|
||
CMD python app.py | ||
EXPOSE 8668 | ||
|
||
CMD ["supervisord", "-c", "/etc/supervisord.conf"] |
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,10 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:quantumleap] | ||
command=gunicorn -b 0.0.0.0:8668 uwsgi --log-level DEBUG --worker-class gevent --worker-connections 10000 --config gunicorn.conf.py | ||
directory=/src/ngsi-timeseries-api/src | ||
autostart=true | ||
autorestart=true | ||
startsecs=10 | ||
startretries=3 |
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,3 @@ | ||
import multiprocessing | ||
|
||
workers = multiprocessing.cpu_count() * 4 + 1 |
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 @@ | ||
import connexion | ||
app = connexion.FlaskApp(__name__, port=8668, specification_dir='../specification/') | ||
app.add_api('quantumleap.yml', | ||
arguments={'title': 'QuantumLeap V2 API'}, | ||
pythonic_params=True, | ||
# validate_responses=True, strict_validation=True | ||
) | ||
application = app.app |