adding nginx
This commit is contained in:
parent
83daad9523
commit
dbc68de5f2
@ -30,9 +30,9 @@ before_install:
|
||||
before_script:
|
||||
- export DATABASE_TEST_URL=postgres://postgres:@localhost:5432/mpwo_test
|
||||
- export APP_SETTINGS=mpwo_api.config.TestingConfig
|
||||
- export REACT_APP_API_URL=http://127.0.0.1:5000/api/
|
||||
- export REACT_APP_API_URL=http://127.0.0.1
|
||||
- export NODE_ENV=development
|
||||
- export TEST_URL=http://127.0.0.1:3000
|
||||
- export TEST_URL=http://127.0.0.1
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
- sleep 3
|
||||
|
@ -2,7 +2,7 @@ HOST = 0.0.0.0
|
||||
API_PORT = 5000
|
||||
CLIENT_PORT = 3000
|
||||
|
||||
export REACT_APP_API_URL = http://$(HOST):$(API_PORT)/api/
|
||||
export REACT_APP_API_URL = http://$(HOST):$(API_PORT)
|
||||
export FLASK_APP = $(PWD)/mpwo_api/server.py
|
||||
export TEST_URL = http://$(HOST):$(CLIENT_PORT)
|
||||
export REQUIREMENTS = $(PWD)/mpwo_api/requirements.txt
|
||||
|
@ -2,8 +2,8 @@ version: '3.3'
|
||||
|
||||
services:
|
||||
|
||||
api-db:
|
||||
container_name: api-db
|
||||
mpwo-db:
|
||||
container_name: mpwo-db
|
||||
build: https://github.com/SamR1/mpwo.git#master:mpwo_api/db
|
||||
ports:
|
||||
- 5435:5432
|
||||
@ -11,8 +11,8 @@ services:
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
|
||||
api:
|
||||
container_name: api
|
||||
mpwo-api:
|
||||
container_name: mpwo-api
|
||||
build: https://github.com/SamR1/mpwo.git#master:mpwo_api
|
||||
ports:
|
||||
- 5001:5000
|
||||
@ -23,12 +23,12 @@ services:
|
||||
- FLASK_DEBUG=1
|
||||
- APP_SETTINGS=mpwo_api.config.TestingConfig
|
||||
depends_on:
|
||||
- api-db
|
||||
- mpwo-db
|
||||
links:
|
||||
- api-db
|
||||
- mpwo-db
|
||||
|
||||
client:
|
||||
container_name: client
|
||||
mpwo-client:
|
||||
container_name: mpwo-client
|
||||
build:
|
||||
context: https://github.com/SamR1/mpwo.git
|
||||
dockerfile: ./mpwo_client/Dockerfile
|
||||
@ -38,6 +38,18 @@ services:
|
||||
ports:
|
||||
- 3007:3000
|
||||
depends_on:
|
||||
- api
|
||||
- mpwo-api
|
||||
links:
|
||||
- api
|
||||
- mpwo-api
|
||||
|
||||
nginx:
|
||||
container_name: nginx
|
||||
build: ./nginx
|
||||
restart: always
|
||||
ports:
|
||||
- 80:80
|
||||
depends_on:
|
||||
- mpwo-api
|
||||
- mpwo-client
|
||||
links:
|
||||
- mpwo-api
|
||||
|
@ -2,8 +2,8 @@ version: '3.3'
|
||||
|
||||
services:
|
||||
|
||||
api-db:
|
||||
container_name: api-db
|
||||
mpwo-db:
|
||||
container_name: mpwo-db
|
||||
build: ./mpwo_api/db
|
||||
ports:
|
||||
- 5435:5432
|
||||
@ -11,8 +11,8 @@ services:
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
|
||||
api:
|
||||
container_name: api
|
||||
mpwo-api:
|
||||
container_name: mpwo-api
|
||||
build: ./mpwo_api
|
||||
ports:
|
||||
- 5001:5000
|
||||
@ -23,12 +23,12 @@ services:
|
||||
- FLASK_DEBUG=1
|
||||
- APP_SETTINGS=mpwo_api.config.DevelopmentConfig
|
||||
depends_on:
|
||||
- api-db
|
||||
- mpwo-db
|
||||
links:
|
||||
- api-db
|
||||
- mpwo-db
|
||||
|
||||
client:
|
||||
container_name: client
|
||||
mpwo-client:
|
||||
container_name: mpwo-client
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./mpwo_client/Dockerfile
|
||||
@ -38,6 +38,18 @@ services:
|
||||
ports:
|
||||
- 3007:3000
|
||||
depends_on:
|
||||
- api
|
||||
- mpwo-api
|
||||
links:
|
||||
- api
|
||||
- mpwo-api
|
||||
|
||||
nginx:
|
||||
container_name: nginx
|
||||
build: ./nginx
|
||||
restart: always
|
||||
ports:
|
||||
- 80:80
|
||||
depends_on:
|
||||
- mpwo-api
|
||||
- mpwo-client
|
||||
links:
|
||||
- mpwo-api
|
||||
|
@ -1,4 +1,4 @@
|
||||
const apiUrl = `${process.env.REACT_APP_API_URL}`
|
||||
const apiUrl = `${process.env.REACT_APP_API_URL}/api/`
|
||||
|
||||
export default class MpwoApi {
|
||||
static login(email, password) {
|
||||
|
4
nginx/Dockerfile
Normal file
4
nginx/Dockerfile
Normal file
@ -0,0 +1,4 @@
|
||||
FROM nginx:1.13.0
|
||||
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
ADD /nginx.conf /etc/nginx/conf.d
|
23
nginx/nginx.conf
Normal file
23
nginx/nginx.conf
Normal file
@ -0,0 +1,23 @@
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
proxy_pass http://mpwo-client:3000;
|
||||
proxy_redirect default;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://mpwo-api:5000;
|
||||
proxy_redirect default;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user