Update env

This commit is contained in:
Piotr Biernat 2023-06-25 00:48:39 +02:00
parent 7e5d3273d8
commit ab2ec6717b
6 changed files with 165 additions and 26 deletions

0
deploy/.env.dist Normal file
View File

4
deploy/.env.local Normal file
View File

@ -0,0 +1,4 @@
API_GATEWAY_PORT=48443
API_GATEWAY_UI_PORT=48444
API_REGISTRY_UI_PORT=48445
API_EVENTBUS_UI_PORT=48446

View File

@ -2,25 +2,39 @@ version: "3.9"
services: services:
api-gateway: api-gateway:
env_file: .env.local
environment: environment:
- APP_DOMAIN=egommerce.local - APP_DOMAIN=egommerce.local
# - APP_PORT=48443
ports: ports:
- '8443:443' - target: 443
- '8888:8080' published: 48443
- '5672:5672' mode: host
- target: 8080
published: 48444
mode: host
# - 48443:443
# - 48444:8080
# - 5672:5672
api-registry: api-registry:
command: ["-ui-content-path=/registry"] command: ["-ui-content-path=/registry"]
env_file: .env.local
environment: environment:
- APP_DOMAIN=registry.egommerce.local - APP_DOMAIN=registry.egommerce.local
# - APP_PORT=48445
ports: ports:
- '8500:8500' - target: 8500
# - '8600:8600' published: 48445
# - '8600:8600/udp' mode: host
# - 48445:8500
# - 8600:8600/udp
api-eventbus: api-eventbus:
env_file: .env.local
environment: environment:
- APP_DOMAIN=eventbus.egommerce.local - APP_DOMAIN=eventbus.egommerce.local
# - APP_PORT=48446
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.tcp.routers.eventbus.rule=HostSNI(`*`) - traefik.tcp.routers.eventbus.rule=HostSNI(`*`)
@ -28,111 +42,124 @@ services:
- traefik.tcp.routers.eventbus.service=eventbus - traefik.tcp.routers.eventbus.service=eventbus
- traefik.tcp.services.eventbus.loadbalancer.server.port=5672 - traefik.tcp.services.eventbus.loadbalancer.server.port=5672
ports: ports:
- '18084:8084' - 48446:8084
- '15672:15672' - 15672:15672
api-cache: api-cache:
env_file: .env.local
environment: environment:
- APP_DOMAIN=redis.egommerce.local - APP_DOMAIN=redis.egommerce.local
command: ["redis-server", "/etc/redis.conf", "--requirepass", "12345678"] command: ["redis-server", "/etc/redis.conf", "--requirepass", "12345678"]
ports: ports:
- '6379:6379' - 6379:6379
api-logger: api-logger:
env_file: .env.local
environment: environment:
- APP_DOMAIN=logger.egommerce.local - APP_DOMAIN=logger.egommerce.local
ports: ports:
- '24224:24224' - 24224:24224
# api-prometheus: # api-prometheus:
# environment: # environment:
# - APP_DOMAIN=prometheus.egommerce.local # - APP_DOMAIN=prometheus.egommerce.local
# ports: # ports:
# - '9090:9090' # - 9090:9090
# api-grafana: # api-grafana:
# environment: # environment:
# - APP_DOMAIN=grafana.egommerce.local # - APP_DOMAIN=grafana.egommerce.local
# ports: # ports:
# - '3000:3000' # - 3000:3000
postgres-db: postgres-db:
env_file: .env.local
environment: environment:
- APP_DOMAIN=postgres.egommerce.local - APP_DOMAIN=postgres.egommerce.local
ports: ports:
- '5432:5432' - 5432:5432
mongo-db: mongo-db:
env_file: .env.local
environment: environment:
- APP_DOMAIN=mongo.egommerce.local - APP_DOMAIN=mongo.egommerce.local
ports: ports:
- '27017:27017' - 27017:27017
identity-svc: identity-svc:
env_file: .env.local
environment: environment:
- APP_DOMAIN=identity.api.egommerce.local - APP_DOMAIN=identity.api.egommerce.local
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017 - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672 - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
ports: ports:
- '8080:80' - 8080:80
basket-svc: basket-svc:
env_file: .env.local
environment: environment:
- APP_DOMAIN=basket.api.egommerce.local - APP_DOMAIN=basket.api.egommerce.local
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017 - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672 - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
ports: ports:
- '8001:80' - 8001:80
catalog-svc: catalog-svc:
env_file: .env.local
environment: environment:
- APP_DOMAIN=catalog.api.egommerce.local - APP_DOMAIN=catalog.api.egommerce.local
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017 - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672 - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
ports: ports:
- '8002:80' - 8002:80
order-svc: order-svc:
env_file: .env.local
environment: environment:
- APP_DOMAIN=order.api.egommerce.local - APP_DOMAIN=order.api.egommerce.local
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017 - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672 - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
ports: ports:
- '8003:80' - 8003:80
pricing-svc: pricing-svc:
env_file: .env.local
environment: environment:
- APP_DOMAIN=pricing.api.egommerce.local - APP_DOMAIN=pricing.api.egommerce.local
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017 - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672 - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
ports: ports:
- '8004:80' - 8004:80
# Workers (EventBus) # Workers (EventBus)
basket-worker: basket-worker:
env_file: .env.local
environment: environment:
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017 - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672 - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
catalog-worker: catalog-worker:
env_file: .env.local
environment: environment:
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017 - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672 - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
pricing-worker: pricing-worker:
env_file: .env.local
environment: environment:
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017 - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672 - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
order-worker: order-worker:
env_file: .env.local
environment: environment:
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017 - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017

View File

@ -13,6 +13,8 @@ services:
environment: environment:
- APP_DOMAIN=api-registry - APP_DOMAIN=api-registry
- CONSUL_HTTP_TOKEN=devop - CONSUL_HTTP_TOKEN=devop
volumes:
- ./certs/api-registry:/consul/data/certs
api-eventbus: api-eventbus:
image: git.pbiernat.dev/egommerce/api-eventbus:dev image: git.pbiernat.dev/egommerce/api-eventbus:dev
@ -47,8 +49,6 @@ services:
environment: environment:
- APP_DOMAIN=postgres-db - APP_DOMAIN=postgres-db
- POSTGRES_PASSWORD=12345678 - POSTGRES_PASSWORD=12345678
# ports:
# - '5432:5432'
mongo-db: mongo-db:
environment: environment:

View File

@ -11,6 +11,7 @@ services:
- APP_DOMAIN - APP_DOMAIN
- API_REGISTRY_REFRESH_INTERVAL=5s - API_REGISTRY_REFRESH_INTERVAL=5s
volumes: volumes:
- ./certs/api-gateway:/etc/traefik/certs
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
networks: networks:
- api-gateway-network - api-gateway-network
@ -25,6 +26,7 @@ services:
- CONSUL_HTTP_TOKEN=VeryS3cr3tTok3N - CONSUL_HTTP_TOKEN=VeryS3cr3tTok3N
volumes: volumes:
- registry_data:/consul/data - registry_data:/consul/data
- ./certs/api-registry:/consul/data/certs
networks: networks:
- api-registry-network - api-registry-network
- api-logger-network - api-logger-network
@ -314,6 +316,7 @@ volumes:
#grafana-db: ~ #grafana-db: ~
networks: networks:
# Infrastructure networks
api-gateway-network: api-gateway-network:
driver: overlay driver: overlay
#internal: true #internal: true
@ -350,7 +353,7 @@ networks:
driver: overlay driver: overlay
#internal: true #internal: true
# api micro-services networks # Micro-services networks
identity-svc-network: identity-svc-network:
driver: overlay driver: overlay
#internal: true #internal: true
@ -372,10 +375,6 @@ networks:
#internal: true #internal: true
# Workers networks # Workers networks
# identity-worker-network:
# driver: overlay
# internal: true
basket-worker-network: basket-worker-network:
driver: overlay driver: overlay
#internal: true #internal: true

View File

@ -0,0 +1,109 @@
upstream egommerce-api-gw {
server 127.0.0.1:48443;
}
upstream egommerce-api-gw-dashboard {
server 127.0.0.1:48444;
}
upstream egommerce-api-registry-ui {
server 127.0.0.1:48445;
}
upstream egommerce-api-eventbus-mngmt {
server 127.0.0.1:48446;
}
server {
listen 443 ssl;
ssl_certificate /home/keedosn/workspace/golang/src/git.pbiernat.dev/egommerce/stack/deploy/certs/api-gateway/localhost.cert;
ssl_certificate_key /home/keedosn/workspace/golang/src/git.pbiernat.dev/egommerce/stack/deploy/certs/api-gateway/localhost.key;
server_name egommerce.local;
# Traefik redirects
location /dashboard {
if ($http_referer ~ (/gateway)) {
proxy_pass http://egommerce-api-gw-dashboard;
}
}
location /api {
if ($http_referer ~ (/gateway)) {
proxy_pass http://egommerce-api-gw-dashboard;
}
}
location /gateway/ {
proxy_pass http://egommerce-api-gw-dashboard/dashboard/;
proxy_pass_header Server;
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-Proto $scheme;
client_max_body_size 0;
}
# Consul redirects
location /ui {
if ($http_referer ~ (/registry)) {
proxy_pass http://egommerce-api-registry-ui;
}
}
location /v1 {
if ($http_referer ~ (/registry)) {
proxy_pass http://egommerce-api-registry-ui;
}
}
location /registry {
proxy_pass http://egommerce-api-registry-ui;
proxy_pass_header Server;
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-Proto $scheme;
client_max_body_size 0;
}
# RabbitMQ Mngmt redirects
location /eventbus {
return 302 /eventbus/;
}
location ~* /eventbus/api/(.*?)/(.*) {
proxy_pass http://egommerce-api-eventbus-mngmt/api/$1/%2F/$2?$query_string;
proxy_buffering off;
proxy_pass_header Server;
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-Proto $scheme;
}
location ~* /eventbus/(.*) {
rewrite ^/eventbus/(.*)$ /$1 break;
proxy_pass http://egommerce-api-eventbus-mngmt;
proxy_buffering off;
proxy_pass_header Server;
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-Proto $scheme;
}
# Pass all requests to the API Gateway
location / {
proxy_pass https://egommerce-api-gw;
proxy_http_version 1.1;
proxy_pass_header Server;
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-Proto $scheme;
client_max_body_size 0;
}
error_log /var/log/nginx/egommerce.local-error.log;
access_log /var/log/nginx/egommerce.local-access.log combined;
}