-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #540 from hellohaptik/develop
Develop to Master
- Loading branch information
Showing
6 changed files
with
143 additions
and
18 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 |
---|---|---|
|
@@ -107,3 +107,5 @@ logs/*.log* | |
newman_reports/ | ||
sftp-config.json | ||
dev.json | ||
|
||
!/dev_docker/* |
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,27 @@ | ||
FROM python:3.6.15 | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && \ | ||
apt-get install -y wget build-essential curl nginx supervisor && \ | ||
curl -s https://raw.githubusercontent.com/envkey/envkey-source/master/install.sh | bash | ||
WORKDIR /app | ||
COPY requirements.txt nltk_setup.py /app/ | ||
RUN touch /app/config && \ | ||
pip install --no-cache-dir -U pip && \ | ||
pip install --no-cache-dir -U Cython==0.28.2 newrelic==3.4.0.95 && \ | ||
pip install --no-cache-dir -I uwsgi==2.0.19.1 && \ | ||
pip install --no-cache-dir -r /app/requirements.txt && \ | ||
pip check && \ | ||
python /app/nltk_setup.py | ||
ENV NAME="chatbot_ner" | ||
ENV DJANGODIR=/app | ||
ENV NUM_WORKERS=4 | ||
ENV DJANGO_SETTINGS_MODULE=chatbot_ner.settings | ||
ENV PORT=8081 | ||
ENV TIMEOUT=600 | ||
ENV MAX_REQUESTS=1000 | ||
# ENV ENVKEY= | ||
# ENV NEWRELIC_LICENSE_KEY= | ||
EXPOSE 8081 | ||
ADD . /app | ||
RUN chmod +x /app/entrypoint.sh | ||
CMD /app/entrypoint.sh |
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,35 @@ | ||
version: '3.1' | ||
|
||
services: | ||
chatbot-ner: | ||
image: chatbot_ner:latest | ||
build: | ||
context: . | ||
dockerfile: Dockerfile-python3 | ||
restart: always | ||
env_file: | ||
- .env | ||
volumes: | ||
- .:/app/ | ||
ports: | ||
- 8081:8081 | ||
networks: | ||
- ner | ||
|
||
|
||
neres: | ||
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0 | ||
restart: always | ||
environment: | ||
- "ES_JAVA_OPTS=-Xmx512m -Xms512m" | ||
- "xpack.security.enabled=false" | ||
volumes: | ||
- ./dbdata/esdata/v1:/usr/share/elasticsearch/data | ||
ports: | ||
- 9200:9200 | ||
networks: | ||
- ner | ||
|
||
networks: | ||
ner: | ||
driver: bridge |
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,34 @@ | ||
#!/bin/bash | ||
|
||
export $(envkey-source -f | sed -e 's/\<export\>//g' | sed -e 's/\s\+/\n/g' | xargs) > /dev/null | ||
export ENVKEY="" | ||
|
||
cd $DJANGODIR | ||
|
||
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE | ||
export PYTHONPATH=$DJANGODIR:$PYTHONPATH | ||
|
||
# Create the run directory if it doesn't exist | ||
# RUNDIR=$(dirname $SOCKFILE) | ||
# test -d $RUNDIR || mkdir -p $RUNDIR | ||
|
||
|
||
if [ "$NEWRELIC" == "true" ]; then | ||
|
||
# Define app_name based on the environment to be deployed on. | ||
if [ "$HAPTIK_ENV" == "staging" ]; then | ||
sed -i "s/chatbot_ner/chatbot_ner_staging/g" newrelic.ini | ||
fi | ||
|
||
# Update the license key | ||
sed -i "s/license_value/$NEWRELIC_LICENSE_KEY/g" newrelic.ini | ||
|
||
# Start uwsgi with newrelic agent | ||
export NEW_RELIC_CONFIG_FILE=newrelic.ini | ||
newrelic-admin run-program uwsgi --wsgi-file chatbot_ner/wsgi.py --http :$PORT --strict --need-app --master --workers=$NUM_WORKERS --threads 5 --enable-threads --disable-logging --log-5xx --log-prefix=uwsgi --log-slow=3000 --logto=/app/logs/ner_log.log --logfile-chmod=644 --max-requests=$MAX_REQUESTS --harakiri=$TIMEOUT --reload-mercy=60 --worker-reload-mercy=60 --thunder-lock --http-auto-chunked --http-keepalive --vacuum --single-interpreter --buffer-size=15000 | ||
|
||
else | ||
|
||
uwsgi --wsgi-file chatbot_ner/wsgi.py --http :$PORT --strict --need-app --master --workers=$NUM_WORKERS --threads 5 --enable-threads --disable-logging --log-5xx --log-prefix=uwsgi --log-slow=3000 --logto=/app/logs/ner_log.log --logfile-chmod=644 --max-requests=$MAX_REQUESTS --harakiri=$TIMEOUT --reload-mercy=60 --worker-reload-mercy=60 --thunder-lock --http-auto-chunked --vacuum --single-interpreter --buffer-size=15000 --http-keepalive=1 --http-timeout=600 | ||
|
||
fi |
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