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
No related branches found
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'
services:
nginx:
image: nginx:1.16
image: test
restart: unless-stopped
ports:
- 443:443
networks:
backoffice:
volumes:
- ./nginx/site.conf:/etc/nginx/conf.d/default.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:
- 8081:8080
- 3306:3306
networks:
backoffice:
depends_on:
- front
links:
- front
environment:
MYSQL_ROOT_PASSWORD: ${DATABASE_PASSWORD}
MYSQL_DATABASE: ${DATABASE_NAME}
healthcheck:
test: mysqladmin ping -h 127.0.0.1 -u root --password=$$MYSQL_ROOT_PASSWORD
interval: 5s
timeout: 10s
retries: 60
front:
image: bayesimpact/react-base
backend:
image: back
networks:
backoffice:
depends_on:
database:
condition: service_healthy
restart: unless-stopped
volumes:
- ./:/usr/app
working_dir: /usr/app
- /etc/localtime:/etc/localtime:ro
- ./configs:/app/configs
- ./letsencrypt_cache:/app/letsencrypt_cache
- ./data:/app/data
ports:
- 3000:3000
networks:
backoffice:
- ${HTTPS_PORT}:${HTTPS_PORT}
- 8090:8090
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:
backoffice:
\ No newline at end of file
backoffice:
worker_processes 1;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
......@@ -20,6 +20,7 @@ http {
#tcp_nopush on;
keepalive_timeout 65;
keepalive_requests 65;
# Gzip conf
gzip on;
......
server {
listen 8080;
server_name localhost;
listen 443 ssl;
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 / {
proxy_pass http://front:3000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
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;
add_header Access-Control-Allow-Origin *;
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
location /api {
proxy_pass https://backend:1443/api;
}
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 @@
height: 100vh;
z-index: 1501;
@media screen and(max-width: $width-phone) {
@media screen and(max-width: $width-tablet) {
width: 0;
display: none;
}
......@@ -35,7 +35,7 @@
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%);
background: $dark-light;
@media screen and(max-width: $width-phone) {
@media screen and(max-width: $width-tablet) {
margin-left: 0;
padding-bottom: $navbar-height;
}
......
......@@ -5,5 +5,6 @@
min-height: 95vh;
.container {
margin: auto;
padding: 2rem;
}
}
......@@ -3,7 +3,7 @@ import axios from 'axios'
import { UserContext } from './userContext'
import { useHistory } from 'react-router-dom'
const _apiUrl: string = 'https://localhost:1443/'
const _apiUrl: string = 'https://localhost:443/'
export interface Auth {
loginUser: () => Promise<void>
......@@ -18,7 +18,7 @@ export const useAuth = (): Auth => {
//login user
const loginUser = async (): Promise<void> => {
try {
await axios.get(`${_apiUrl}OAuth2Login`)
await axios.get(`${_apiUrl}OAuth2Login`, { withCredentials: true })
await setUserContext()
} catch (e) {
setError(e)
......@@ -37,10 +37,11 @@ export const useAuth = (): Auth => {
//set user in context and push them home
const setUserContext = async (): Promise<void> => {
try {
const { data } = await axios.get(`${_apiUrl}api/common/WhoAmI`)
const { data } = await axios.get(`${_apiUrl}api/common/WhoAmI`, {
withCredentials: true,
})
if (data && setUser) {
setUser(data)
console.log('usertoContext', data)
history.push('/editing')
}
} catch (e) {
......
......@@ -5,7 +5,7 @@ import { User } from '../models/user.model'
const useFindUser = () => {
const [user, setUser] = useState<User | null>(null)
const [isLoading, setLoading] = useState<boolean>(true)
const _apiUrl: string = 'https://localhost:1443/'
const _apiUrl: string = 'https://localhost:443/'
useEffect(() => {
async function findUser() {
......
......@@ -5,7 +5,7 @@ import { toast } from 'react-toastify'
export class MonthlyNewsService {
private readonly _apiUrl: string
constructor() {
this._apiUrl = 'https://localhost:1443/'
this._apiUrl = 'https://localhost:443/'
}
/**
* Creates a quotation and header for selected month
......
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