basharin_sevastyan_lab_3 #25
43
basharin_sevastyan_lab_3/docker-compose.yaml
Normal file
43
basharin_sevastyan_lab_3/docker-compose.yaml
Normal file
@ -0,0 +1,43 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
ports:
|
||||
- 80:80
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||
restart: always
|
||||
depends_on:
|
||||
- product-service
|
||||
- order-service
|
||||
networks:
|
||||
- mynetwork
|
||||
|
||||
db:
|
||||
image: postgres:latest
|
||||
ports:
|
||||
- 5432:5432
|
||||
environment:
|
||||
POSTGRES_PASSWORD: admin
|
||||
POSTGRES_USER: admin
|
||||
POSTGRES_DB: message-api
|
||||
volumes:
|
||||
- ./database.sql:/docker-entrypoint-initdb.d/database.sql
|
||||
restart: always
|
||||
networks:
|
||||
- mynetwork
|
||||
|
||||
user_app:
|
||||
build:
|
||||
context: /user_app
|
||||
dockerfile: Dockerfile
|
||||
|
||||
message_app:
|
||||
build:
|
||||
context: /message_app
|
||||
dockerfile: Dockerfile
|
||||
|
||||
networks:
|
||||
mynetwork:
|
||||
driver: bridge
|
8
basharin_sevastyan_lab_3/message_app/Dockerfile
Normal file
8
basharin_sevastyan_lab_3/message_app/Dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
FROM python:3.9
|
||||
WORKDIR /app
|
||||
COPY requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
COPY . .
|
||||
COPY var/data /var/data
|
||||
COPY var/result /var/result
|
||||
CMD ["python", "main.py"]
|
0
basharin_sevastyan_lab_3/message_app/main.py
Normal file
0
basharin_sevastyan_lab_3/message_app/main.py
Normal file
2
basharin_sevastyan_lab_3/message_app/requirements.txt
Normal file
2
basharin_sevastyan_lab_3/message_app/requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
Flask==3.0.0
|
||||
Werkzeug==3.0.1
|
28
basharin_sevastyan_lab_3/nginx.conf
Normal file
28
basharin_sevastyan_lab_3/nginx.conf
Normal file
@ -0,0 +1,28 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
upstream user-service {
|
||||
server product-service:8080;
|
||||
}
|
||||
upstream message-service {
|
||||
server order-service:8081;
|
||||
}
|
||||
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name localhost;
|
||||
|
||||
location /user-service/ {
|
||||
proxy_pass http://user-service/;
|
||||
}
|
||||
|
||||
location /message-service/ {
|
||||
proxy_pass http://message-service/;
|
||||
}
|
||||
}
|
||||
}
|
8
basharin_sevastyan_lab_3/user_app/Dockerfile
Normal file
8
basharin_sevastyan_lab_3/user_app/Dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
FROM python:3.9
|
||||
WORKDIR /app
|
||||
COPY requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
COPY . .
|
||||
COPY var/data /var/data
|
||||
COPY var/result /var/result
|
||||
CMD ["python", "main.py"]
|
6
basharin_sevastyan_lab_3/user_app/main.py
Normal file
6
basharin_sevastyan_lab_3/user_app/main.py
Normal file
@ -0,0 +1,6 @@
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=5000)
|
2
basharin_sevastyan_lab_3/user_app/requirements.txt
Normal file
2
basharin_sevastyan_lab_3/user_app/requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
Flask==3.0.0
|
||||
Werkzeug==3.0.1
|
Loading…
Reference in New Issue
Block a user