From 38bbfbe8f2ac21a570a494e43998c47d764a3039 Mon Sep 17 00:00:00 2001 From: Alex Harding Date: Wed, 30 Mar 2022 11:37:57 -0400 Subject: [PATCH 1/2] replicating dev in prod --- envs/prod/build-prod.sh | 10 ++++++++++ envs/prod/docker-compose.yml | 13 ++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 envs/prod/build-prod.sh diff --git a/envs/prod/build-prod.sh b/envs/prod/build-prod.sh new file mode 100644 index 00000000..e62b709d --- /dev/null +++ b/envs/prod/build-prod.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +docker-compose down +docker volume rm vol_smart_pgdata vol_smart_data +docker volume create vol_smart_pgdata +docker volume create vol_smart_data +docker-compose build +docker-compose run --rm smart_backend ./migrate.sh +docker-compose run --rm smart_backend ./seed_smart.sh +docker-compose up \ No newline at end of file diff --git a/envs/prod/docker-compose.yml b/envs/prod/docker-compose.yml index a8bfe222..c714eac4 100644 --- a/envs/prod/docker-compose.yml +++ b/envs/prod/docker-compose.yml @@ -20,6 +20,8 @@ services: dockerfile: docker/Dockerfile.prod image: rti/smart-backend-prod:R_0_0_1 restart: always + ports: + - "80:8000" depends_on: - postgres - redis @@ -28,13 +30,10 @@ services: extends: file: ../docker-common.yml service: smart_frontend - build: - context: ../../frontend/ - dockerfile: Dockerfile.prod - image: rti/smart-frontend-prod:R_0_0_1 - ports: - - "${EXTERNAL_FRONTEND_PORT:-8080}:8080" - command: nginx -c /code/nginx.conf -g "daemon off;" + build: ../../frontend/ + image: rti/smart-frontend:R_0_0_1 + command: node_modules/.bin/webpack --watch + volumes: smart_pgdata: From a71d4fdec3d4e13109dc825b344f3b68a33e8886 Mon Sep 17 00:00:00 2001 From: Alex Harding Date: Fri, 1 Apr 2022 15:23:54 -0400 Subject: [PATCH 2/2] updating backend production dockerfile --- backend/docker/Dockerfile.prod | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/docker/Dockerfile.prod b/backend/docker/Dockerfile.prod index 5285331d..4881b7e8 100644 --- a/backend/docker/Dockerfile.prod +++ b/backend/docker/Dockerfile.prod @@ -1,11 +1,12 @@ -FROM python:3.5.7 +FROM python:3.8 ENV PYTHONUNBUFFERED 1 -RUN apt-get update && apt-get install -y netcat-traditional mysql-client +RUN apt-get update && apt-get install -y netcat-traditional WORKDIR /code ADD ./docker/requirements.txt /code/requirements.txt +RUN pip install --upgrade pip RUN pip install -r requirements.txt RUN pip install gunicorn -ADD ./smart/ /code/ +ADD ./django/ /code/ RUN mkdir -p /data/data_files /data/tf_idf /data/model_pickles /data/code_books EXPOSE 8000 CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:8000", "--timeout", "75", "--worker-class", "gevent", "config.wsgi"]