Skip to content
Snippets Groups Projects
Commit f4c5db70 authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Add working local conf

parent 09a627c6
No related branches found
No related tags found
2 merge requests!8local- conf,!7feat: add front office
version: '3.7' version: '3.7'
services: services:
nginx: front:
image: nginx:1.16 container_name: front
restart: unless-stopped build:
context: .
dockerfile: Dockerfile
depends_on:
database:
condition: service_healthy
volumes: volumes:
- ./nginx/site.conf:/etc/nginx/conf.d/default.conf - '/app'
- '/app/node_modules'
- ./nginx/nginx.conf:/etc/nginx/nginx.conf - ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/site.conf:/etc/nginx/conf.d/default.conf
- ./cert.pem:/etc/nginx/cert.pem - ./cert.pem:/etc/nginx/cert.pem
- ./key.pem:/etc/nginx/key.pem - ./key.pem:/etc/nginx/key.pem
command: ['nginx', '-g', 'daemon off;']
ports: ports:
- 8080:8080 - 8080:8080
# depends_on: - 443:443
# front:
# condition: service_healthy
links:
- front
front:
image: bayesimpact/react-base
restart: unless-stopped
volumes:
- ./:/usr/app
working_dir: /usr/app
ports:
- 3000:3000
healthcheck:
test: curl localhost:3000
interval: 5s
timeout: 10s
retries: 60
database: database:
image: mysql:5 image: mysql:5
......
server { server {
listen 8080 ; listen 8080;
server_name localhost; server_name local;
location / { location / {
proxy_pass https://front:3000; root /usr/share/nginx/html;
proxy_set_header Upgrade $http_upgrade; index index.html index.htm;
proxy_set_header Connection $http_connection; try_files $uri $uri/ /index.html =404;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} }
location /api { location /api {
proxy_pass https://backend:1443/api; proxy_pass https://backend:1443/api;
...@@ -23,7 +19,23 @@ server { ...@@ -23,7 +19,23 @@ server {
location /Logout { location /Logout {
proxy_pass https://backend:1443/Logout; proxy_pass https://backend:1443/Logout;
} }
location /swagger {
proxy_pass https://backend:1443/swagger;
}
} }
server {
listen 443 ssl;
server_name local;
ssl_certificate /etc/nginx/cert.pem;
ssl_certificate_key /etc/nginx/key.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
proxy_pass http://localhost:8080;
}
location /OAuth2Callback {
proxy_pass https://backend:1443/OAuth2Callback;
}
}
\ No newline at end of file
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"docker-local-up" : "docker-compose -f docker-compose.local.yml up",
"docker-local-down" : "docker-compose -f docker-compose.local.yml down",
"docker": "docker run -it --rm -p 3000:3000 front-backoffice", "docker": "docker run -it --rm -p 3000:3000 front-backoffice",
"lint": "eslint .", "lint": "eslint .",
"lint:fix": "eslint --fix .", "lint:fix": "eslint --fix .",
......
...@@ -11,7 +11,12 @@ const Routes: React.FC = () => { ...@@ -11,7 +11,12 @@ const Routes: React.FC = () => {
return ( return (
<Switch> <Switch>
{user && <Redirect path="/login" to="/editing" />} {user && (
<>
<Redirect path="/" to="/editing" />
<Redirect path="/login" to="/editing" />
</>
)}
<Route path="/login" component={Login} /> <Route path="/login" component={Login} />
<PrivateRoute path="/editing" component={Editing} exact /> <PrivateRoute path="/editing" component={Editing} exact />
<PrivateRoute path="/settings" component={Settings} exact /> <PrivateRoute path="/settings" component={Settings} exact />
......
/// <reference types="react-scripts" />
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment