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

Merge branch 'https-test' into 'dev'

Https test

See merge request web-et-numerique/llle_project/backoffice-client!5
parents 4364dd76 ff475dc9
Branches
No related tags found
2 merge requests!7feat: add front office,!5Https test
Pipeline #15450 passed
{
"Key": "IZOEJFgX0z/Bfx403KdRjfA6FTMcJiOtUb9a4vMWhlU="
}
\ No newline at end of file
version: '3.7'
services:
nginx:
image: nginx:1.16
restart: unless-stopped
volumes:
- ./nginx/site.conf:/etc/nginx/conf.d/default.conf
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
command: ["nginx", "-g", "daemon off;"]
ports:
- 8081:8080
networks:
backoffice:
depends_on:
- front
links:
- front
front:
image: bayesimpact/react-base
restart: unless-stopped
volumes:
- ./:/usr/app
working_dir: /usr/app
ports:
- 3000:3000
networks:
backoffice:
networks:
backoffice:
\ No newline at end of file
version: '3.7'
services:
nginx:
image: backoffice #TODO: replace with forge image tag
build:
context: .
restart: unless-stopped
ports:
- 8080:80
version: '3.7' version: '3.7'
services: services:
nginx: nginx:
image: nginx:1.16 image: test
restart: unless-stopped restart: unless-stopped
ports:
- 443:443
networks:
backoffice:
volumes: volumes:
- ./nginx/site.conf:/etc/nginx/conf.d/default.conf - ./nginx/site.conf:/etc/nginx/conf.d/default.conf
- ./nginx/nginx.conf:/etc/nginx/nginx.conf - ./nginx/nginx.conf:/etc/nginx/nginx.conf
command: ["nginx", "-g", "daemon off;"] - ./cert.pem:/etc/nginx/cert.pem
- ./key.pem:/etc/nginx/key.pem
database:
image: mysql:5
ports: ports:
- 8081:8080 - 3306:3306
networks: networks:
backoffice: backoffice:
depends_on: environment:
- front MYSQL_ROOT_PASSWORD: ${DATABASE_PASSWORD}
links: MYSQL_DATABASE: ${DATABASE_NAME}
- front healthcheck:
test: mysqladmin ping -h 127.0.0.1 -u root --password=$$MYSQL_ROOT_PASSWORD
interval: 5s
timeout: 10s
retries: 60
front: backend:
image: bayesimpact/react-base image: back
networks:
backoffice:
depends_on:
database:
condition: service_healthy
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- ./:/usr/app - /etc/localtime:/etc/localtime:ro
working_dir: /usr/app - ./configs:/app/configs
- ./letsencrypt_cache:/app/letsencrypt_cache
- ./data:/app/data
ports: ports:
- 3000:3000 - ${HTTPS_PORT}:${HTTPS_PORT}
networks: - 8090:8090
backoffice: environment:
- HOSTNAME=${HOSTNAME}
- HTTPS_PORT=${HTTPS_PORT}
- ADMIN_ROLE=${ADMIN_ROLE}
- REDIRECT_URL=${REDIRECT_URL}
- CLIENT_ID=${CLIENT_ID}
- CLIENT_SECRET=${CLIENT_SECRET}
- AUTH_URL=${AUTH_URL}
- TOKEN_URL=${TOKEN_URL}
- USERINFO_URL=${USERINFO_URL}
- DEBUG_MODE=${DEBUG_MODE}
- DATABASE_USER=${DATABASE_USER}
- DATABASE_NAME=${DATABASE_NAME}
- DATABASE_PASSWORD=${DATABASE_PASSWORD}
- DATABASE_HOST=database
networks: networks:
backoffice: backoffice:
\ No newline at end of file
worker_processes 1; worker_processes auto;
error_log /var/log/nginx/error.log warn; error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid; pid /var/run/nginx.pid;
...@@ -20,6 +20,7 @@ http { ...@@ -20,6 +20,7 @@ http {
#tcp_nopush on; #tcp_nopush on;
keepalive_timeout 65; keepalive_timeout 65;
keepalive_requests 65;
# Gzip conf # Gzip conf
gzip on; gzip on;
......
server { server {
listen 8080; listen 443 ssl;
server_name localhost; server_name localhost;
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 / { location / {
proxy_pass http://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; location /api {
proxy_set_header X-Real-IP $remote_addr; proxy_pass https://backend:1443/api;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
add_header Access-Control-Allow-Origin *; location /OAuth2Login {
proxy_pass https://backend:1443/OAuth2Login;
}
location /OAuth2Callback {
proxy_pass https://backend:1443/OAuth2Callback;
}
location /Logout {
proxy_pass https://backend:1443/Logout;
} }
} }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
height: 100vh; height: 100vh;
z-index: 1501; z-index: 1501;
@media screen and(max-width: $width-phone) { @media screen and(max-width: $width-tablet) {
width: 0; width: 0;
display: none; display: none;
} }
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
box-shadow: 0px 5px 5px rgb(0 0 0 / 20%), 0px 3px 14px rgb(0 0 0 / 12%), box-shadow: 0px 5px 5px rgb(0 0 0 / 20%), 0px 3px 14px rgb(0 0 0 / 12%),
0px 8px 10px rgb(0 0 0 / 14%); 0px 8px 10px rgb(0 0 0 / 14%);
background: $dark-light; background: $dark-light;
@media screen and(max-width: $width-phone) { @media screen and(max-width: $width-tablet) {
margin-left: 0; margin-left: 0;
padding-bottom: $navbar-height; padding-bottom: $navbar-height;
} }
......
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
min-height: 95vh; min-height: 95vh;
.container { .container {
margin: auto; margin: auto;
padding: 2rem;
} }
} }
...@@ -3,7 +3,7 @@ import axios from 'axios' ...@@ -3,7 +3,7 @@ import axios from 'axios'
import { UserContext } from './userContext' import { UserContext } from './userContext'
import { useHistory } from 'react-router-dom' import { useHistory } from 'react-router-dom'
const _apiUrl: string = 'https://localhost:1443/' const _apiUrl: string = 'https://localhost:443/'
export interface Auth { export interface Auth {
loginUser: () => Promise<void> loginUser: () => Promise<void>
...@@ -18,7 +18,7 @@ export const useAuth = (): Auth => { ...@@ -18,7 +18,7 @@ export const useAuth = (): Auth => {
//login user //login user
const loginUser = async (): Promise<void> => { const loginUser = async (): Promise<void> => {
try { try {
await axios.get(`${_apiUrl}OAuth2Login`) await axios.get(`${_apiUrl}OAuth2Login`, { withCredentials: true })
await setUserContext() await setUserContext()
} catch (e) { } catch (e) {
setError(e) setError(e)
...@@ -37,10 +37,11 @@ export const useAuth = (): Auth => { ...@@ -37,10 +37,11 @@ export const useAuth = (): Auth => {
//set user in context and push them home //set user in context and push them home
const setUserContext = async (): Promise<void> => { const setUserContext = async (): Promise<void> => {
try { try {
const { data } = await axios.get(`${_apiUrl}api/common/WhoAmI`) const { data } = await axios.get(`${_apiUrl}api/common/WhoAmI`, {
withCredentials: true,
})
if (data && setUser) { if (data && setUser) {
setUser(data) setUser(data)
console.log('usertoContext', data)
history.push('/editing') history.push('/editing')
} }
} catch (e) { } catch (e) {
......
...@@ -5,7 +5,7 @@ import { User } from '../models/user.model' ...@@ -5,7 +5,7 @@ import { User } from '../models/user.model'
const useFindUser = () => { const useFindUser = () => {
const [user, setUser] = useState<User | null>(null) const [user, setUser] = useState<User | null>(null)
const [isLoading, setLoading] = useState<boolean>(true) const [isLoading, setLoading] = useState<boolean>(true)
const _apiUrl: string = 'https://localhost:1443/' const _apiUrl: string = 'https://localhost:443/'
useEffect(() => { useEffect(() => {
async function findUser() { async function findUser() {
......
...@@ -5,7 +5,7 @@ import { toast } from 'react-toastify' ...@@ -5,7 +5,7 @@ import { toast } from 'react-toastify'
export class MonthlyNewsService { export class MonthlyNewsService {
private readonly _apiUrl: string private readonly _apiUrl: string
constructor() { constructor() {
this._apiUrl = 'https://localhost:1443/' this._apiUrl = 'https://localhost:443/'
} }
/** /**
* Creates a quotation and header for selected month * Creates a quotation and header for selected month
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment