-
Notifications
You must be signed in to change notification settings - Fork 533
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
42 changed files
with
2,280 additions
and
1,993 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,41 +1,37 @@ | ||
FROM python:3.6-alpine3.7 | ||
|
||
RUN apk update | ||
RUN apk add supervisor | ||
RUN apk add --update py2-pip | ||
|
||
# Upgrade and install basic Python dependencies | ||
# This block added because of the trouble installing gevent on many systems | ||
# https://hub.docker.com/r/openwhisk/dockerskeleton/~/dockerfile/ | ||
RUN apk add --no-cache bash \ | ||
&& apk add --no-cache --virtual .build-deps \ | ||
bzip2-dev \ | ||
gcc \ | ||
libc-dev | ||
# && pip install --no-cache-dir gevent \ | ||
# && apk del .build-deps | ||
|
||
# reqs layer | ||
ADD requirements.txt . | ||
RUN pip3 install -U -r requirements.txt | ||
RUN pip3 install gunicorn==19.7.1 | ||
|
||
# Bundle app source | ||
ADD . /src | ||
|
||
COPY ./deployment/logging.conf /src/logging.conf | ||
COPY ./deployment/gunicorn.conf /src/gunicorn.conf | ||
|
||
RUN apk update && \ | ||
apk add supervisor && \ | ||
apk add --update py2-pip && \ | ||
apk add --no-cache bash && \ | ||
apk add --no-cache --virtual .build-deps bzip2-dev gcc libc-dev | ||
|
||
# Copy project sources | ||
COPY . /src | ||
|
||
# Set working directory | ||
WORKDIR /src | ||
|
||
# Install app dependencies and create supervisord dirs | ||
RUN pip3 install -U -r requirements.txt && \ | ||
pip3 install gunicorn==19.7.1 && \ | ||
mkdir -p /etc/supervisor/conf.d /var/log/supervisor /var/run/supervisor | ||
|
||
# Copy configuration files | ||
RUN cp /src/deployment/logging.conf /src/logging.conf && \ | ||
cp /src/deployment/gunicorn.conf /src/gunicorn.conf && \ | ||
cp /src/deployment/supervisord.conf /etc/supervisor/supervisord.conf && \ | ||
cp /src/deployment/gunicorn.conf /etc/supervisor/conf.d/gunicorn.conf | ||
|
||
# Fix permissions | ||
RUN chgrp -R 0 /src /var/log/supervisor /var/run/supervisor && \ | ||
chmod -R g=u /src /var/log/supervisor /var/run/supervisor | ||
|
||
# Expose service port | ||
EXPOSE 5000 | ||
|
||
# Setup supervisord | ||
RUN mkdir -p /var/log/supervisor | ||
COPY ./deployment/supervisord.conf /etc/supervisor/supervisord.conf | ||
COPY ./deployment/gunicorn.conf /etc/supervisor/conf.d/gunicorn.conf | ||
|
||
# Start processes | ||
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"] | ||
|
||
|
||
#ENTRYPOINT ["python"] | ||
#CMD ["src/application.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
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,8 +1,15 @@ | ||
[supervisord] | ||
nodaemon=true | ||
logfile=/var/log/supervisor/supervisord.log | ||
pidfile=/var/run/supervisor/supervisord.pid | ||
|
||
[program:gunicorn] | ||
command=/usr/local/bin/gunicorn application:application -w 1 --worker-class eventlet --config /src/gunicorn.conf --log-config /src/logging.conf --bind 0.0.0.0:5000 | ||
directory=/src | ||
stdout_logfile=/var/log/supervisor/stdout.log | ||
stderr_logfile=/var/log/supervisor/stderr.log | ||
# Uncomment the following lines and comment those after if you want to | ||
# save stdout and stderr logs in seperate files. | ||
# stdout_logfile=/var/log/supervisor/elastichq_stdout.log | ||
# stderr_logfile=/var/log/supervisor/elastichq_stderr.log | ||
stdout_logfile=/dev/fd/1 | ||
stdout_logfile_maxbytes=0 | ||
redirect_stderr=true |
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,4 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: fd1e7fa5cfedfe6f8f3e6bb6c5e9d514 | ||
config: 975bbf0704e836cd18ad12bc8c255959 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,82 @@ | ||
{ | ||
"version": 1, | ||
"disable_existing_loggers": false, | ||
"formatters": { | ||
"simple": { | ||
"format": "%(asctime)s \t %(levelname)s \t %(name)s \t %(module)s.%(funcName)s:%(lineno)d \t %(message)s" | ||
} | ||
}, | ||
"handlers": { | ||
"console": { | ||
"class": "logging.StreamHandler", | ||
"level": "DEBUG", | ||
"formatter": "simple", | ||
"stream": "ext://sys.stdout" | ||
}, | ||
"standard_handler": { | ||
"class": "logging.handlers.RotatingFileHandler", | ||
"level": "DEBUG", | ||
"formatter": "simple", | ||
"filename": "application.log", | ||
"maxBytes": 104857600, | ||
"backupCount": 2, | ||
"encoding": "utf8" | ||
} | ||
}, | ||
"loggers": { | ||
"elastichq": { | ||
"level": "DEBUG", | ||
"handlers": [], | ||
"propagate": "no" | ||
}, | ||
"sqlalchemy": { | ||
"level": "DEBUG", | ||
"handlers": [], | ||
"qualname": "sqlalchemy", | ||
"propagate": "no" | ||
}, | ||
"flasklogger": { | ||
"level": "DEBUG", | ||
"handlers": [], | ||
"qualname": "flasklogger", | ||
"propagate": "no" | ||
}, | ||
"werkzeug": { | ||
"level": "DEBUG", | ||
"handlers": [], | ||
"qualname": "werkzeug", | ||
"propagate": "no" | ||
}, | ||
"requests": { | ||
"level": "DEBUG", | ||
"handlers": [], | ||
"qualname": "requests", | ||
"propagate": "no" | ||
}, | ||
"elasticsearch": { | ||
"level": "DEBUG", | ||
"handlers": [], | ||
"qualname": "elasticsearch", | ||
"propagate": "no" | ||
}, | ||
"elasticsearch.trace": { | ||
"level": "DEBUG", | ||
"handlers": [], | ||
"qualname": "elasticsearch", | ||
"propagate": "no" | ||
}, | ||
"urllib3.connectionpool": { | ||
"level": "ERROR", | ||
"handlers": [], | ||
"qualname": "urllib3", | ||
"propagate": "no" | ||
} | ||
}, | ||
"root": { | ||
"level": "DEBUG", | ||
"handlers": [ | ||
"console", | ||
"standard_handler" | ||
] | ||
} | ||
} |
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
Oops, something went wrong.