Skip to content

Commit

Permalink
add tests and deployment config
Browse files Browse the repository at this point in the history
  • Loading branch information
jarosenb committed Dec 9, 2021
1 parent edc0ec4 commit 9d5e21a
Show file tree
Hide file tree
Showing 11 changed files with 446 additions and 26 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ EXPOSE 8000
COPY ./requirements.txt requirements.txt
RUN pip install -r requirements.txt

RUN groupadd --gid 816877 G-816877 && \
useradd --uid 458981 --gid G-816877 -m --shell /bin/bash tg458981 -d /home/tg458981

USER tg458981

COPY ./server/ /srv/www/server/

WORKDIR /srv/www/server
11 changes: 11 additions & 0 deletions camino/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!make

.PHONY: deploy-all
deploy-all:
docker-compose stop
docker-compose up -d
docker-compose restart nginx

.PHONY: down
down:
docker-compose down $(service)
37 changes: 37 additions & 0 deletions camino/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: '3.8'
services:
server:
image: wmatacc/ds-download:deploy
command: gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
container_name: ds_download_server
volumes:
- /corral-repl/tacc/NHERI:/corral-repl/tacc/NHERI
logging:
driver: syslog
options:
tag: ds_download_api

nginx:
image: nginx
volumes:
- ../conf/nginx/nginx.conf:/etc/nginx/nginx.conf
- /etc/ssl/certs/designsafe-download01.tacc.utexas.edu.cer.20211206:/etc/ssl/api.crt
- /etc/ssl/private/designsafe-download01.tacc.utexas.edu.key.20211206:/etc/ssl/api.key
- /etc/ssl/dhparam.pem:/etc/ssl/dhparam.pem
ports:
- 80:80
- 443:443
container_name: ds_download_nginx
logging:
driver: syslog
options:
tag: ds_download_nginx

redis:
image: redis:6.2-alpine
container_name: ds_download_redis
hostname: ds_download_redis
logging:
driver: syslog
options:
tag: ds_download_redis
4 changes: 2 additions & 2 deletions conf/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ http {
# Extra slashes matter to Agave
merge_slashes off;

ssl_certificate /etc/ssl/ds-download.test.crt;
ssl_certificate_key /etc/ssl/ds-download.test.key;
ssl_certificate /etc/ssl/api.crt;
ssl_certificate_key /etc/ssl/api.key;
ssl_dhparam /etc/ssl/dhparam.pem;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
Expand Down
13 changes: 8 additions & 5 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@ services:
container_name: ds_download_server
volumes:
- ./server/:/srv/www/server/
- ~/corral-repl/tacc/NHERI:/corral-repl/tacc/NHERI
ports:
- 8000:8000

nginx:
image: nginx
volumes:
- ./conf/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./conf/ssl/ds-download.test.crt:/etc/ssl/ds-download.test.crt
- ./conf/ssl/ds-download.test.key:/etc/ssl/ds-download.test.key
- ./conf/ssl/ds-download.test.crt:/etc/ssl/api.crt
- ./conf/ssl/ds-download.test.key:/etc/ssl/api.key
- ./conf/nginx/dhparam.pem:/etc/ssl/dhparam.pem
ports:
- 80:80
- 443:443
container_name: ds_download_nginx
depends_on:
- cms
- django

redis:
image: redis:6.2-alpine
container_name: ds_download_redis
hostname: ds_download_redis
128 changes: 127 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ python = "3.10.0"
uvicorn = {extras = ["standard"], version = "^0.15.0"}
fastapi = "^0.70.0"
agavepy = "^0.9.5"
redis = "^4.0.2"
zipfly = "^6.0.3"
gunicorn = "^20.1.0"

[tool.poetry.dev-dependencies]
black = "^21.11b1"
pytest = "^6.2.5"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
Loading

0 comments on commit 9d5e21a

Please sign in to comment.