macrdel commited on
Commit
09e89a6
1 Parent(s): 1e26229

update workflow

Browse files
Files changed (4) hide show
  1. Dockerfile +1 -1
  2. Dockerfile.Test +1 -1
  3. docker-compose.yml +14 -8
  4. nginx/nginx.conf +8 -22
Dockerfile CHANGED
@@ -17,4 +17,4 @@ COPY --chown=user . .
17
 
18
  ENV PYTHONPATH=/home/user/app
19
 
20
- CMD ["sh", "-c", "service nginx start && uvicorn app.api:app --host 0.0.0.0 --port 8000"]
 
17
 
18
  ENV PYTHONPATH=/home/user/app
19
 
20
+ # CMD ["sh", "-c", "service nginx start && uvicorn app.api:app --host 0.0.0.0 --port 8000"]
Dockerfile.Test CHANGED
@@ -17,4 +17,4 @@ COPY --chown=user . .
17
 
18
  ENV PYTHONPATH=/home/user/app
19
 
20
- CMD ["pytest", "tests"]
 
17
 
18
  ENV PYTHONPATH=/home/user/app
19
 
20
+ # CMD ["pytest", "tests"]
docker-compose.yml CHANGED
@@ -3,31 +3,37 @@ version: '3.7'
3
  services:
4
  app:
5
  build: .
6
- container_name: sentiment-summarize-youtube-comments-1
 
7
  ports:
8
- - "8001:8000"
9
  volumes:
10
- - .:/home/user/app
 
 
11
  depends_on:
12
  - prometheus
13
 
14
  app2:
15
  build: .
16
- container_name: sentiment-summarize-youtube-comments-2
 
17
  ports:
18
- - "8002:8000"
19
  volumes:
20
  - .:/home/user/app
 
 
21
  depends_on:
22
  - prometheus
23
 
24
  nginx:
25
  image: nginx:latest
26
- container_name: nginx
27
  ports:
28
- - "8000:80"
29
  volumes:
30
- - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
31
  depends_on:
32
  - app
33
  - app2
 
3
  services:
4
  app:
5
  build: .
6
+ command: uvicorn app.api:app --reload --host 0.0.0.0 --port 8000
7
+ container_name: "app"
8
  ports:
9
+ - 8001:8000
10
  volumes:
11
+ - .:/home/user/app
12
+ environment:
13
+ - PYTHONPATH=/home/user/app
14
  depends_on:
15
  - prometheus
16
 
17
  app2:
18
  build: .
19
+ command: uvicorn app.api:app --reload --host 0.0.0.0 --port 8000
20
+ container_name: "app2"
21
  ports:
22
+ - 8002:8000
23
  volumes:
24
  - .:/home/user/app
25
+ environment:
26
+ - PYTHONPATH=/home/user/app
27
  depends_on:
28
  - prometheus
29
 
30
  nginx:
31
  image: nginx:latest
32
+ container_name: "nginx"
33
  ports:
34
+ - "8080:8080"
35
  volumes:
36
+ - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
37
  depends_on:
38
  - app
39
  - app2
nginx/nginx.conf CHANGED
@@ -1,27 +1,13 @@
1
- upstream app1 {
2
- server sentiment-summarize-youtube-comments-1:8000;
3
- }
4
 
5
- upstream app2 {
6
- server sentiment-summarize-youtube-comments-2:8000;
7
- }
8
 
9
- server {
10
- listen 80;
 
11
 
12
- location / {
13
- proxy_pass http://app1;
14
- proxy_set_header Host $host;
15
- proxy_set_header X-Real-IP $remote_addr;
16
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
17
- proxy_set_header X-Forwarded-Proto $scheme;
18
- }
19
 
20
- location /app2 {
21
- proxy_pass http://app2;
22
- proxy_set_header Host $host;
23
- proxy_set_header X-Real-IP $remote_addr;
24
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
25
- proxy_set_header X-Forwarded-Proto $scheme;
26
- }
27
  }
 
1
+ server {
 
 
2
 
3
+ listen 8080;
 
 
4
 
5
+ location / {
6
+ proxy_pass http://app:8000;
7
+ }
8
 
9
+ location / {
10
+ proxy_pass http://app2:8000;
11
+ }
 
 
 
 
12
 
 
 
 
 
 
 
 
13
  }