Skip to content

Commit 4fd9f36

Browse files
t-abdul-basserecruz165Edwin CruzEdwin Cruz
authored
Nginx Reverse Proxy (#43)
* Add necessary changes to launch frontend with Docker. * Add changes to support Docker deployment. * Provide changes to support devContainers, tasks and launch configurations. * Add docker compose file and renamed incidence api folder. * add first version of compose manifest * Change service names * Comment out health checks, depends * Comment out placeholder environment varaibles * Remove superfluous comments * Configured settings to be read from envirnonment. There is no need to exclude config and settings files. * Externalized database properties to be supplied via environment variables. * remove VS Code related files * Add quickstart * Enhanced entry script to check configured datasource is up before starting server. * add CR * Added .env_template and added some instructions what to do to get started. * Minor type for env variable. * Mime type was incorrect for a /ops/health endpoint recently added. * Gruntfile uses _config.json to validate config * Adjusted dockerfile to do multi stage build to install dependencies and build project. * Minor cleanup. * Improved logging to be processed as event stream. * First version of Jenkinsfile * Update Jenkinfile with test values * Fix error in Jenkins file * Enhance Jenkile file to change to target directory, pull test repository, checkout feature branch and startup application services * Fixed curly braces in Jenkins file * Expose traefik dashboard, suppress container restart * Neeeded changes to account for appended prefix for API calls. (#29) Co-authored-by: Edwin Cruz <edc7012@cumc.columbia.edu> * Modify traefik API settings Expose Traafik API on 8080 Stub out SSH script in Jenkins * * Change CRLF --> LF to fix error message 'exec user process caused: no such file or directory' * remove database ping to address ping permission error * *Change name of traefik container to avoid name collision on deployment server * Comment in server dependencies * * Remove unused environment variable * Comment in healthcheck block * Remove whitespaces * Remove healthcheck because it causes the backend routing to fail * Modify configuration to expose application at a port that will not collide with active HTTP port * Remove unused environment varaible * Removed reference to unused environment variable * Change default constant * Modify proxy routing to support 127.0.0.1 or configurable host name. * Add POC version Gitlab CI/CD pipeline * Use nginx as prxoy * Change default port exposed by proxy suppress exposure of fronet end and backend --------- Co-authored-by: edwincruz <ecruz165@yahoo.com> Co-authored-by: Edwin Cruz <edc7012@cumc.columbia.edu> Co-authored-by: Edwin Cruz <edwin@unitedprospects.org>
1 parent a78e979 commit 4fd9f36

4 files changed

Lines changed: 32 additions & 49 deletions

File tree

backend-proxy/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM nginx
2+
COPY nginx.conf /etc/nginx/nginx.conf

backend-proxy/nginx.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
events {}
2+
http {
3+
server{
4+
listen 80;
5+
location /api {
6+
proxy_pass http://backend:5000/;
7+
}
8+
location / {
9+
proxy_pass http://frontend:80/;
10+
}
11+
}
12+
}

client/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"ApiBaseUrl": "http://127.0.0.1:9999/incidence-api",
2+
"ApiBaseUrl": "http://127.0.0.1:9999/api/incidence-api",
33
"VocabBaseUrl": "http://api.ohdsi.org/WebAPI/vocabulary/1PCT"
44
}

docker-compose.yml

Lines changed: 17 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,28 @@
11
version: '3'
2-
2+
33
services:
44

5-
traefik:
6-
image: docker.io/library/traefik:v2.9.4@sha256:4c388f477f5b7aa48420694d90db0ecb96b4ecede60b9b7589c87858abf87b60
7-
container_name: howoften-reverse-proxy
8-
restart: unless-stopped
9-
ipc: none
10-
read_only: true
11-
command:
12-
- "--log.level=INFO"
13-
- "--api"
14-
- "--api.insecure=true"
15-
- "--providers.docker=true"
16-
- "--providers.docker.exposedbydefault=false"
17-
- "--entrypoints.web.address=:80"
18-
labels:
19-
- "traefik.enable=true"
5+
backendproxy:
6+
build: backend-proxy
7+
image: cumc-dbmi/howoften/backendproxy
208
ports:
21-
- "9999:80"
22-
- "8080:8080"
23-
volumes:
24-
- "/var/run/docker.sock:/var/run/docker.sock:ro"
25-
howoften-frontend:
26-
container_name: howoften-frontend
27-
image: ${ACR_SERVER}/cumc-dbmi/howoften-frontend:latest
28-
build: ./client
29-
restart: unless-stopped
30-
ipc: none
31-
privileged: false
32-
depends_on:
33-
- howoften-backend
34-
labels:
35-
- "traefik.enable=true"
36-
- "traefik.http.routers.howoften-frontend.rule=(Host(`127.0.0.1`) && Path(`/`)) || (Host(`${HOWOFTEN_HOST}`) && PathPrefix(`/`))"
37-
- "traefik.http.routers.howoften-frontend.entrypoints=web"
38-
howoften-backend:
39-
container_name: howoften-backend
40-
image: ${ACR_SERVER}/cumc-dbmi/howoften-backend:latest
41-
build: ./incidence-api
42-
restart: unless-stopped
43-
ipc: none
44-
read_only: true
45-
privileged: false
9+
- "9999:80"
10+
11+
backend:
12+
build: incidence-api
13+
image: cumc-dbmi/howoften/backend
4614
environment:
4715
- DATASOURCE_USERNAME=${DATASOURCE_USERNAME}
4816
- DATASOURCE_PASSWORD=${DATASOURCE_PASSWORD}
4917
- DATASOURCE_HOSTNAME=${DATASOURCE_HOSTNAME}
5018
- DATASOURCE_PORT=${DATASOURCE_PORT}
5119
- DATASOURCE_SCHEMA=${DATASOURCE_SCHEMA}
5220
- DATASOURCE_DATABASE=${DATASOURCE_DATABASE}
53-
labels:
54-
- "traefik.enable=true"
55-
- "traefik.http.routers.howoften-backend.rule=(Host(`127.0.0.1`) && Path(`/incidence-api`)) || (Host(`${HOWOFTEN_HOST}`) && PathPrefix(`/incidence-api`))"
56-
- "traefik.http.routers.howoften-backend.entrypoints=web"
57-
- "traefik.http.services.myapp.loadbalancer.server.port=5000"
58-
expose:
59-
- 5000
21+
# ports:
22+
# - "8085:5000"
23+
24+
frontend:
25+
build: client
26+
image: cumc-dbmi/howoften/frontend
27+
# ports:
28+
# - "80:80"

0 commit comments

Comments
 (0)