Skip to content

Commit

Permalink
Merge pull request #162 from RTIInternational/devlike-prod-deployment
Browse files Browse the repository at this point in the history
replicating dev in prod
  • Loading branch information
rjruizes authored Apr 17, 2023
2 parents b4dace2 + a71d4fd commit 174b178
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
7 changes: 4 additions & 3 deletions backend/docker/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -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"]
10 changes: 10 additions & 0 deletions envs/prod/build-prod.sh
Original file line number Diff line number Diff line change
@@ -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
13 changes: 6 additions & 7 deletions envs/prod/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 174b178

Please sign in to comment.