From 8a33a10f89c85e33fb6385cc01cee66fce460eb3 Mon Sep 17 00:00:00 2001 From: alphayax Date: Sun, 26 Nov 2023 09:43:19 +0100 Subject: [PATCH] Add docker-compose.yml update config of admin to add a basePath --- .compose/default.conf | 36 ++++++++++++++++++++++++++++ docker-compose.yml | 48 ++++++++++++++++++++++++++++++++++++++ front-admin/vite.config.ts | 1 + 3 files changed, 85 insertions(+) create mode 100644 .compose/default.conf create mode 100644 docker-compose.yml diff --git a/.compose/default.conf b/.compose/default.conf new file mode 100644 index 0000000..ded4b3b --- /dev/null +++ b/.compose/default.conf @@ -0,0 +1,36 @@ +server { + listen 80; + index index.html index.htm; + + location / { + proxy_pass http://front-client/; + proxy_buffering off; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + } + + location /admin/ { + proxy_pass http://front-admin/; + proxy_buffering off; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + } + + location /api-article/ { + proxy_pass http://api-article:8080/; + proxy_buffering off; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + } + + location /api-cart/ { + proxy_pass http://api-cart:8081/; + proxy_buffering off; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..642d185 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,48 @@ +version: '3' +services: + + mongo: + image: mongo:4 + + redis: + image: redis:6 + + api-cart: + #image: alphayax/microservice-demo-cart-service:latest + build: + context: ./cart-service + environment: + REDIS_URI: "redis://redis:6379" + depends_on: + - redis + + api-article: + #image: alphayax/microservice-demo-article-service:latest + build: + context: ./article-service + environment: + MONGODB_URI: "mongodb://mongo:27017" + depends_on: + - mongo + + front-admin: + #image: alphayax/microservice-demo-frontend-admin:latest + build: + context: ./front-admin + + front-client: + #image: alphayax/microservice-demo-frontend-user:latest + build: + context: ./front-user + + ingress: + image: nginx:1.19 + ports: + - "80:80" + volumes: + - ./.compose/default.conf:/etc/nginx/conf.d/default.conf:ro + depends_on: + - api-cart + - api-article + - front-admin + - front-client diff --git a/front-admin/vite.config.ts b/front-admin/vite.config.ts index 484c036..93ab708 100644 --- a/front-admin/vite.config.ts +++ b/front-admin/vite.config.ts @@ -31,6 +31,7 @@ export default defineConfig({ }, }), ], + base: '/admin/', define: { 'process.env': {} }, resolve: { alias: {