Update
This commit is contained in:
parent
e3173eaecb
commit
b9b8a57a5b
BIN
deploy/bin/register-service
Executable file
BIN
deploy/bin/register-service
Executable file
Binary file not shown.
57
deploy/bin/register-service.go
Normal file
57
deploy/bin/register-service.go
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
addr, port := env("API_REGISTRY_ADDR", "api-registry"), env("API_REGISTRY_PORT", "8501")
|
||||||
|
regUrl := "https://" + addr + ":" + port + "/v1/agent/service/register?replace-existing-checks=true"
|
||||||
|
regData, err := os.ReadFile("/.app.config")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
ip := getIP()
|
||||||
|
strRegData := string(regData)
|
||||||
|
strRegData = strings.Replace(strRegData, "__IP__", ip, -1)
|
||||||
|
|
||||||
|
req, err := http.NewRequest(http.MethodPut, regUrl, strings.NewReader(strRegData))
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := http.DefaultClient.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf(err.Error())
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
var respBody []byte
|
||||||
|
resp.Body.Read(respBody)
|
||||||
|
|
||||||
|
log.Printf("Successfully registered")
|
||||||
|
}
|
||||||
|
|
||||||
|
func env(name, def string) string {
|
||||||
|
val := os.Getenv(name)
|
||||||
|
|
||||||
|
if len(val) == 0 {
|
||||||
|
return def
|
||||||
|
}
|
||||||
|
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
|
||||||
|
func getIP() string {
|
||||||
|
host, _ := os.Hostname()
|
||||||
|
ips, _ := net.LookupIP(host)
|
||||||
|
for _, ip := range ips {
|
||||||
|
return ip.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
return host
|
||||||
|
}
|
9
deploy/bin/update-resolv.sh
Executable file
9
deploy/bin/update-resolv.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# modify /etc/resolv.conf
|
||||||
|
registryIP=$(nslookup -type=A api-registry. | awk '/^Name:/ {c=2;N=$2} !--c {print N,$2}' | awk '{printf "%s", $2}')
|
||||||
|
resolvFile=$(cat /etc/resolv.conf)
|
||||||
|
|
||||||
|
echo -e "nameserver $registryIP" >>/etc/resolv.conf
|
||||||
|
# echo "$registryIP registry.service.ego.io" >> /etc/hosts # Add consul host with static IP (consul register itself as 127.0.0.1)
|
||||||
|
# nslookup api-registry
|
3
deploy/build-register-service.sh
Executable file
3
deploy/build-register-service.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o deploy/bin/register-service deploy/bin/register-service.go
|
179
deploy/docker/stack.dev.local.yml
Normal file
179
deploy/docker/stack.dev.local.yml
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
services:
|
||||||
|
api-registry:
|
||||||
|
env_file: ../.env.local
|
||||||
|
environment:
|
||||||
|
- CONSUL_HTTP_TOKEN=784746ec-0d5d-fb12-1a79-95f912dcaabd
|
||||||
|
- VAULT_TOKEN=hvs.cJE9Qr4PIafDGy0wdx2GoxOb # ROOT TOKEN
|
||||||
|
# - VAULT_TOKEN=hvs.CAESICxuTO_JieCbpMoZ4_qOPIohxSKim_4V8t11JLg93RtKGh4KHGh2cy5VUUFqUm5CdTQ3V3hMQ3BHSDB4dThNZHE
|
||||||
|
volumes:
|
||||||
|
- ../certs/api-registry/registry.local.crt:/etc/certs/registry.local.crt:ro
|
||||||
|
# - ../certs/ca/vault-root.pem:/usr/local/share/ca-certificates/vaultCA.pem:ro
|
||||||
|
|
||||||
|
api-gateway:
|
||||||
|
env_file: ../.env.local
|
||||||
|
environment:
|
||||||
|
- CONSUL_HTTP_TOKEN=784746ec-0d5d-fb12-1a79-95f912dcaabd
|
||||||
|
- VAULT_TOKEN=hvs.cJE9Qr4PIafDGy0wdx2GoxOb # ROOT TOKEN
|
||||||
|
# - VAULT_TOKEN=hvs.CAESICxuTO_JieCbpMoZ4_qOPIohxSKim_4V8t11JLg93RtKGh4KHGh2cy5VUUFqUm5CdTQ3V3hMQ3BHSDB4dThNZHE
|
||||||
|
volumes:
|
||||||
|
- ../certs/api-gateway/gateway.local.crt:/etc/certs/gateway.local.crt:ro
|
||||||
|
# - ../certs/ca/vault-root.pem:/usr/local/share/ca-certificates/vaultCA.pem:ro
|
||||||
|
|
||||||
|
api-vault:
|
||||||
|
env_file: ../.env.local
|
||||||
|
# command: ["vault", "server", "-dev", "-dev-tls", "-dev-listen-address=0.0.0.0:8200", "-dev-root-token-id=dev-vault-token"]
|
||||||
|
environment:
|
||||||
|
- CONSUL_HTTP_TOKEN=784746ec-0d5d-fb12-1a79-95f912dcaabd
|
||||||
|
- VAULT_TOKEN=hvs.G7oo532tREW4MTdWTgq03GtA # ROOT TOKEN
|
||||||
|
# - VAULT_TOKEN=hvs.CAESICxuTO_JieCbpMoZ4_qOPIohxSKim_4V8t11JLg93RtKGh4KHGh2cy5VUUFqUm5CdTQ3V3hMQ3BHSDB4dThNZHE
|
||||||
|
volumes:
|
||||||
|
- ../certs/api-vault/vault.local.crt:/etc/certs/vault.crt:ro
|
||||||
|
# - ../certs/ca/vault-root.pem:/usr/local/share/ca-certificates/vaultCA.pem:ro
|
||||||
|
ports:
|
||||||
|
- 48250:8200
|
||||||
|
|
||||||
|
api-eventbus:
|
||||||
|
env_file: ../.env.local
|
||||||
|
volumes:
|
||||||
|
- ../certs/api-eventbus/eventbus.local.crt:/etc/certs/eventbus.local.crt:ro
|
||||||
|
# - ../certs/api-eventbus/eventbus.key:/etc/certs/eventbus.local.key:ro
|
||||||
|
labels:
|
||||||
|
- traefik.tcp.routers.eventbus.rule=HostSNI(`esb.service.ego.io`)
|
||||||
|
ports:
|
||||||
|
- 48200:15672
|
||||||
|
- 48201:5672
|
||||||
|
|
||||||
|
api-cache:
|
||||||
|
env_file: ../.env.local
|
||||||
|
command: ["redis-server", "/etc/redis.conf", "--requirepass", "12345678"]
|
||||||
|
ports:
|
||||||
|
- 48300:6379
|
||||||
|
|
||||||
|
api-logger:
|
||||||
|
env_file: ../.env.local
|
||||||
|
ports:
|
||||||
|
- 48400:24224
|
||||||
|
|
||||||
|
# api-prometheus:
|
||||||
|
# ports:
|
||||||
|
# - 9090:9090
|
||||||
|
|
||||||
|
# api-grafana:
|
||||||
|
# ports:
|
||||||
|
# - 3000:3000
|
||||||
|
|
||||||
|
db-postgres:
|
||||||
|
env_file: ../.env.local
|
||||||
|
ports:
|
||||||
|
- 48500:5432
|
||||||
|
|
||||||
|
# db-mongo:
|
||||||
|
# env_file: ../.env.local
|
||||||
|
# environment:
|
||||||
|
# - APP_DOMAIN=mongodb.egommerce.local # FIXME
|
||||||
|
# ports:
|
||||||
|
# - 48600:27017
|
||||||
|
|
||||||
|
identity-svc:
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 0
|
||||||
|
env_file: ../.env.local
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
# - EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
|
||||||
|
ports:
|
||||||
|
- 48780:443
|
||||||
|
|
||||||
|
catalog-svc:
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
env_file: ../.env.local
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
|
||||||
|
ports:
|
||||||
|
- 48781:443
|
||||||
|
|
||||||
|
basket-svc:
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 0
|
||||||
|
env_file: ../.env.local
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
|
||||||
|
ports:
|
||||||
|
- 48782:443
|
||||||
|
|
||||||
|
order-svc:
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 0
|
||||||
|
env_file: ../.env.local
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
|
||||||
|
ports:
|
||||||
|
- 48783:443
|
||||||
|
|
||||||
|
pricing-svc:
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 0
|
||||||
|
env_file: ../.env.local
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
|
||||||
|
ports:
|
||||||
|
- 48784:443
|
||||||
|
|
||||||
|
# Workers (EventBus)
|
||||||
|
basket-worker:
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 0
|
||||||
|
env_file: ../.env.local
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
|
||||||
|
|
||||||
|
catalog-worker:
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 0
|
||||||
|
env_file: ../.env.local
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
|
||||||
|
|
||||||
|
pricing-worker:
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 0
|
||||||
|
env_file: ../.env.local
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
|
||||||
|
|
||||||
|
order-worker:
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 0
|
||||||
|
env_file: ../.env.local
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
|
129
deploy/docker/stack.dev.yml
Normal file
129
deploy/docker/stack.dev.yml
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
services:
|
||||||
|
api-registry:
|
||||||
|
image: git.pbiernat.io/egommerce/api-registry:dev
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=registry.service.ego.io
|
||||||
|
- VAULT_ADDR=https://api-vault:8200
|
||||||
|
- VAULT_API_ADDR=https://api-vault:8200
|
||||||
|
# - ENVOY_VERSION_STRING=1.26.3
|
||||||
|
ports:
|
||||||
|
- 48100:8501
|
||||||
|
|
||||||
|
api-gateway:
|
||||||
|
image: git.pbiernat.io/egommerce/api-registry:dev
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=gw.service.ego.io
|
||||||
|
# - VAULT_ADDR=https://api-vault:8200
|
||||||
|
# - VAULT_API_ADDR=https://api-vault:8200
|
||||||
|
# - ENVOY_VERSION_STRING=1.26.3
|
||||||
|
ports:
|
||||||
|
- 48101:8501
|
||||||
|
- 48443:8443 # consul & envoy api gateway port
|
||||||
|
|
||||||
|
api-vault:
|
||||||
|
image: git.pbiernat.io/egommerce/api-vault:dev
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=vault.service.ego.io
|
||||||
|
- CONSUL_HTTP_ADDR=https://api-registry:8501
|
||||||
|
|
||||||
|
api-eventbus:
|
||||||
|
image: git.pbiernat.io/egommerce/api-eventbus:dev
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=esb.service.ego.io
|
||||||
|
# - RABBITMQ_NODENAME=api-eventbus
|
||||||
|
# - RABBITMQ_USE_LONGNAME=true
|
||||||
|
# - RABBITMQ_DEFAULT_USER = admin
|
||||||
|
# - RABBITMQ_DEFAULT_PASS = passw123
|
||||||
|
|
||||||
|
api-cache:
|
||||||
|
image: git.pbiernat.io/egommerce/api-cache:dev
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=cache.service.ego.io
|
||||||
|
- PASSWORD=12345678
|
||||||
|
|
||||||
|
api-logger:
|
||||||
|
image: git.pbiernat.io/egommerce/api-logger:dev
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=logger.service.ego.io
|
||||||
|
|
||||||
|
# api-prometheus:
|
||||||
|
# image: prom/prometheus:latest # FIXME: create private image(prod/dev)...
|
||||||
|
# environment:
|
||||||
|
# - APP_DOMAIN=prometheus.service.ego.io
|
||||||
|
|
||||||
|
# api-grafana:
|
||||||
|
# image: grafana/grafana-oss:latest # FIXME: create private image(prod/dev)...
|
||||||
|
# environment:
|
||||||
|
# - APP_DOMAIN=grafana.service.ego.io
|
||||||
|
|
||||||
|
db-postgres:
|
||||||
|
image: git.pbiernat.io/egommerce/db-postgres:dev
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=postgresdb.service.ego.io
|
||||||
|
- POSTGRESQL_PASSWORD=12345678
|
||||||
|
|
||||||
|
# db-mongo:
|
||||||
|
# environment:
|
||||||
|
# - MONGO_INITDB_ROOT_PASSWORD=12345678
|
||||||
|
|
||||||
|
# API micro-services
|
||||||
|
identity-svc:
|
||||||
|
image: git.pbiernat.io/egommerce/identity-svc:dev
|
||||||
|
environment:
|
||||||
|
# - SERVER_ADDR=basket.service.ego.io
|
||||||
|
- APP_DOMAIN=identity.service.ego.io
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
|
||||||
|
catalog-svc:
|
||||||
|
image: git.pbiernat.io/egommerce/catalog-svc:dev
|
||||||
|
environment:
|
||||||
|
# - REGISTRY_USE_DOMAIN_OVER_IP=false
|
||||||
|
- APP_DOMAIN=catalog.service.ego.io
|
||||||
|
- AUTH_HANDLER_URL=https://identity.service.ego.io/api/v1/traefik
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
|
||||||
|
basket-svc:
|
||||||
|
image: git.pbiernat.io/egommerce/basket-svc:dev
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=basket.service.ego.io
|
||||||
|
- AUTH_HANDLER_URL=https://identity.service.ego.io/api/v1/traefik
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
|
||||||
|
order-svc:
|
||||||
|
image: git.pbiernat.io/egommerce/order-svc:dev
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=order.service.ego.io
|
||||||
|
- AUTH_HANDLER_URL=https://identity.service.ego.io/api/v1/traefik
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
# volumes:
|
||||||
|
# - ../etc/resolv.conf:/etc/resolv.conf
|
||||||
|
|
||||||
|
pricing-svc:
|
||||||
|
image: git.pbiernat.io/egommerce/pricing-svc:dev
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=pricing.service.ego.io
|
||||||
|
- AUTH_HANDLER_URL=https://identity.service.ego.io/api/v1/traefik
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
|
||||||
|
# Workers (Eventbus)
|
||||||
|
basket-worker:
|
||||||
|
image: git.pbiernat.io/egommerce/basket-worker:dev
|
||||||
|
environment:
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
|
||||||
|
catalog-worker:
|
||||||
|
image: git.pbiernat.io/egommerce/catalog-worker:dev
|
||||||
|
environment:
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
|
||||||
|
pricing-worker:
|
||||||
|
image: git.pbiernat.io/egommerce/pricing-worker:dev
|
||||||
|
environment:
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
||||||
|
|
||||||
|
order-worker:
|
||||||
|
image: git.pbiernat.io/egommerce/order-worker:dev
|
||||||
|
environment:
|
||||||
|
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
|
142
deploy/docker/stack.prod.yml
Normal file
142
deploy/docker/stack.prod.yml
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
services:
|
||||||
|
api-registry:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/api-registry:prod
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=registry.service.ego.io
|
||||||
|
|
||||||
|
api-gateway:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/api-registry:prod
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=gw.service.ego.io
|
||||||
|
|
||||||
|
api-vault:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/api-vault:prod
|
||||||
|
command: ["vault", "server", "-config=/vault/config/server.hcl"]
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=vault.service.ego.io
|
||||||
|
- VAULT_API_ADDR=https://localhost:8200
|
||||||
|
- VAULT_ADDR=https://localhost:8200
|
||||||
|
|
||||||
|
api-eventbus:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/api-eventbus:prod
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=esb.service.ego.io
|
||||||
|
|
||||||
|
api-cache:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/api-cache:prod
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=cache.service.ego.io
|
||||||
|
|
||||||
|
api-logger:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/api-logger:prod
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=logger.service.ego.io
|
||||||
|
|
||||||
|
# api-prometheus:
|
||||||
|
# image: prom/prometheus:prod # FIXME: create private image(prod/dev)...
|
||||||
|
# user: root
|
||||||
|
# environment:
|
||||||
|
# - APP_NAME=api-prometheus
|
||||||
|
|
||||||
|
# api-grafana:
|
||||||
|
# image: grafana/grafana-oss:prod # FIXME: create private image(prod/dev)...
|
||||||
|
# environment:
|
||||||
|
# - APP_NAME=api-grafana
|
||||||
|
|
||||||
|
db-postgres:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/db-postgres:prod
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=postgresdb.service.ego.io
|
||||||
|
- POSTGRESQL_USERNAME=egommerce
|
||||||
|
- POSTGRESQL_DATABASE=egommerce
|
||||||
|
|
||||||
|
# db-mongo:
|
||||||
|
# env_file: ../.env.prod
|
||||||
|
# environment:
|
||||||
|
# - APP_NAME=db-mongo
|
||||||
|
# - APP_DOMAIN=mongo-db.service.ego.io
|
||||||
|
# - MONGO_INITDB_ROOT_USERNAME=mongodb
|
||||||
|
|
||||||
|
# API micro-services
|
||||||
|
identity-svc:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/identity-svc:prod
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=identity.service.ego.io
|
||||||
|
- APP_PATH_PREFIX=/identity
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672
|
||||||
|
|
||||||
|
catalog-svc:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/catalog-svc:prod
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=catalog.service.ego.io
|
||||||
|
- APP_PATH_PREFIX=/catalog
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672
|
||||||
|
|
||||||
|
basket-svc:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/basket-svc:prod
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=basket.service.ego.io
|
||||||
|
- APP_PATH_PREFIX=/basket
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672
|
||||||
|
|
||||||
|
pricing-svc:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/pricing-svc:prod
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=pricing.service.ego.io
|
||||||
|
- APP_PATH_PREFIX=/pricing
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672
|
||||||
|
|
||||||
|
order-svc:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/order-svc:prod
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN=order.service.ego.io
|
||||||
|
- APP_PATH_PREFIX=/order
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672
|
||||||
|
|
||||||
|
# Workers (Eventbus)
|
||||||
|
basket-worker:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/basket-worker:prod
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672
|
||||||
|
|
||||||
|
catalog-worker:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/catalog-worker:prod
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672
|
||||||
|
|
||||||
|
pricing-worker:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/pricing-worker:prod
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672
|
||||||
|
|
||||||
|
order-worker:
|
||||||
|
env_file: ../.env.prod
|
||||||
|
image: git.pbiernat.io/egommerce/order-worker:prod
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
|
||||||
|
- EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672
|
486
deploy/docker/stack.yml
Normal file
486
deploy/docker/stack.yml
Normal file
@ -0,0 +1,486 @@
|
|||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
services:
|
||||||
|
api-registry:
|
||||||
|
image: git.pbiernat.io/egommerce/api-registry:latest
|
||||||
|
command: [
|
||||||
|
"consul",
|
||||||
|
"agent",
|
||||||
|
"-config-file=/consul/config/server.hcl",
|
||||||
|
# "-config-dir=/consul/config",
|
||||||
|
"-node=registry",
|
||||||
|
"-bootstrap-expect=1"
|
||||||
|
]
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN
|
||||||
|
- APP_NAME=api-registry
|
||||||
|
- CONSUL_HTTP_ADDR=127.0.0.1:8501
|
||||||
|
- CONSUL_HTTP_SSL=true
|
||||||
|
- CONSUL_CACERT=/usr/share/pki/ca-trust-source/anchors/internalCA.crt
|
||||||
|
- CONSUL_CLIENT_CERT=/etc/certs/registry.crt
|
||||||
|
- CONSUL_CLIENT_KEY=/etc/certs/registry.key
|
||||||
|
volumes:
|
||||||
|
- registry_data:/consul/data
|
||||||
|
- ../certs/api-registry/registry.internal.crt:/etc/certs/registry.crt:ro
|
||||||
|
- ../certs/api-registry/registry.key:/etc/certs/registry.key:ro
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/share/pki/ca-trust-source/anchors/internalCA.crt:ro
|
||||||
|
# - ../bin/register-service:/bin/register-service
|
||||||
|
# - ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
api-gateway: # consul client running as api-gateway
|
||||||
|
image: git.pbiernat.io/egommerce/api-registry:latest
|
||||||
|
command: [
|
||||||
|
"consul",
|
||||||
|
"agent",
|
||||||
|
"-config-file=/consul/config/gateway.hcl",
|
||||||
|
# "-config-file=/consul/config/gateway-config.hcl",
|
||||||
|
# "-config-file=/consul/config/gateway-routes.hcl",
|
||||||
|
# "-config-dir=/consul/config",
|
||||||
|
"-node=gateway",
|
||||||
|
"-retry-join=api-registry"
|
||||||
|
]
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN
|
||||||
|
- APP_NAME=api-gateway
|
||||||
|
- CONSUL_HTTP_ADDR=127.0.0.1:8501
|
||||||
|
- CONSUL_HTTP_SSL=true
|
||||||
|
- CONSUL_CACERT=/usr/share/pki/ca-trust-source/anchors/internalCA.crt
|
||||||
|
- CONSUL_CLIENT_CERT=/etc/certs/gateway.crt
|
||||||
|
- CONSUL_CLIENT_KEY=/etc/certs/gateway.key
|
||||||
|
volumes:
|
||||||
|
- gateway_data:/consul/data
|
||||||
|
- ../certs/api-gateway/gateway.internal.crt:/etc/certs/gateway.crt:ro
|
||||||
|
- ../certs/api-gateway/gateway.key:/etc/certs/gateway.key:ro
|
||||||
|
- ../certs/catalog-svc/catalog-svc.crt:/etc/certs/catalog.crt:ro
|
||||||
|
- ../certs/catalog-svc/catalog-svc.key:/etc/certs/catalog.key:ro
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/share/pki/ca-trust-source/anchors/internalCA.crt:ro
|
||||||
|
# - ../bin/register-service:/bin/register-service
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
depends_on:
|
||||||
|
- api-registry
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
api-vault:
|
||||||
|
image: git.pbiernat.io/egommerce/api-vault:latest
|
||||||
|
command: ["vault", "server", "-config=/vault/config/server.hcl"]
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN
|
||||||
|
- APP_NAME=api-vault
|
||||||
|
- API_REGISTRY_ADDR=api-registry
|
||||||
|
volumes:
|
||||||
|
- vault_data:/vault/data
|
||||||
|
- ../certs/api-vault/vault.internal.crt:/etc/certs/vault.crt:ro
|
||||||
|
- ../certs/api-vault/vault.key:/etc/certs/vault.key:ro
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../bin/register-service:/bin/register-service
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
depends_on:
|
||||||
|
- api-registry
|
||||||
|
cap_add:
|
||||||
|
- IPC_LOCK
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
# cap_add:
|
||||||
|
# - IPC_LOCK
|
||||||
|
|
||||||
|
api-eventbus:
|
||||||
|
image: git.pbiernat.io/egommerce/api-eventbus:latest
|
||||||
|
environment:
|
||||||
|
# - RABBITMQ_NODENAME=api-eventbus
|
||||||
|
- RABBITMQ_ERLANG_COOKIE=rabbitmq
|
||||||
|
- APP_DOMAIN
|
||||||
|
- APP_NAME=api-eventbus
|
||||||
|
- API_REGISTRY_ADDR=api-registry
|
||||||
|
# labels:
|
||||||
|
# - traefik.enable=true
|
||||||
|
# - traefik.tcp.routers.eventbus.tls=true
|
||||||
|
# - traefik.tcp.routers.eventbus.rule=HostSNI(`*`)
|
||||||
|
# - traefik.tcp.routers.eventbus.entrypoints=rabbitmq
|
||||||
|
# - traefik.tcp.routers.eventbus.service=eventbus
|
||||||
|
# - traefik.tcp.services.eventbus.loadbalancer.server.port=5672
|
||||||
|
volumes:
|
||||||
|
- eventbus_data:/var/lib/rabbitmq
|
||||||
|
- eventbus_logs:/var/log/rabbitmq
|
||||||
|
- ../certs/api-eventbus/eventbus.internal.crt:/etc/certs/eventbus.crt:ro
|
||||||
|
- ../certs/api-eventbus/eventbus.key:/etc/certs/eventbus.key:ro
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../bin/register-service:/bin/register-service
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
depends_on:
|
||||||
|
- api-registry
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
api-cache:
|
||||||
|
image: git.pbiernat.io/egommerce/api-cache:latest
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN
|
||||||
|
- APP_NAME=api-cache
|
||||||
|
- API_REGISTRY_ADDR=api-registry
|
||||||
|
volumes:
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../bin/register-service:/bin/register-service
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
depends_on:
|
||||||
|
- api-registry
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
api-logger:
|
||||||
|
image: git.pbiernat.io/egommerce/api-logger:latest
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN
|
||||||
|
- APP_NAME=api-logger
|
||||||
|
- API_REGISTRY_ADDR=api-registry
|
||||||
|
volumes:
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../bin/register-service:/bin/register-service
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
depends_on:
|
||||||
|
- api-registry
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
# api-prometheus:
|
||||||
|
# image: prom/prometheus:latest # FIXME: create private image(prod/dev)...
|
||||||
|
# user: root
|
||||||
|
# environment:
|
||||||
|
# - APP_DOMAIN
|
||||||
|
# - APP_NAME=api-prometheus
|
||||||
|
# - API_REGISTRY_ADDR=api-registry
|
||||||
|
# volumes:
|
||||||
|
# - ../etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||||
|
# - ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
# - ../bin/register-service:/bin/register-service
|
||||||
|
# - ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
# - /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
# depends_on:
|
||||||
|
# - api-registry
|
||||||
|
# networks:
|
||||||
|
# - egommerce-network
|
||||||
|
|
||||||
|
# api-grafana:
|
||||||
|
# image: grafana/grafana-oss:latest # FIXME: create private image(prod/dev)...
|
||||||
|
# environment:
|
||||||
|
# - APP_DOMAIN
|
||||||
|
# - APP_NAME=api-grafana
|
||||||
|
# - API_REGISTRY_ADDR=api-registry
|
||||||
|
# volumes:
|
||||||
|
# - grafana-db:/var/lib/grafana
|
||||||
|
# - ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
# - ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
# - ../bin/register-service:/bin/register-service
|
||||||
|
# depends_on:
|
||||||
|
# - api-registry
|
||||||
|
# networks:
|
||||||
|
# - egommerce-network
|
||||||
|
|
||||||
|
db-postgres:
|
||||||
|
image: git.pbiernat.io/egommerce/db-postgres:latest
|
||||||
|
environment:
|
||||||
|
- APP_DOMAIN
|
||||||
|
- APP_NAME=db-postgres
|
||||||
|
- API_REGISTRY_ADDR=api-registry
|
||||||
|
- POSTGRESQL_USERNAME=postgres
|
||||||
|
- POSTGRESQL_DATABASE=postgres
|
||||||
|
- POSTGRESQL_PASSWORD=H5Gd7^37*Hka*a72
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
# - ./db_migrations/init/:/docker-entrypoint-initdb.d/
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../bin/register-service:/bin/register-service
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
depends_on:
|
||||||
|
- api-registry
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
# db-mongo:
|
||||||
|
# image: mongo:5.0.14
|
||||||
|
# environment:
|
||||||
|
# - APP_DOMAIN
|
||||||
|
# - APP_NAME=mongo-db
|
||||||
|
# - API_REGISTRY_ADDR=api-registry
|
||||||
|
# - MONGO_INITDB_ROOT_USERNAME=mongodb
|
||||||
|
# - MONGO_INITDB_ROOT_PASSWORD
|
||||||
|
# volumes:
|
||||||
|
# - mongodb_data:/data/db
|
||||||
|
# - ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
# - ../bin/register-service:/bin/register-service
|
||||||
|
# - ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
# depends_on:
|
||||||
|
# - api-registry
|
||||||
|
# deploy:
|
||||||
|
# mode: replicated
|
||||||
|
# replicas: 1
|
||||||
|
# extra_hosts:
|
||||||
|
# - "host.docker.internal:host-gateway"
|
||||||
|
# networks:
|
||||||
|
# - egommerce-network
|
||||||
|
|
||||||
|
# API micro-services
|
||||||
|
identity-svc:
|
||||||
|
image: git.pbiernat.io/egommerce/identity-svc:latest
|
||||||
|
environment:
|
||||||
|
- APP_NAME=identity-svc
|
||||||
|
- APP_PATH_PREFIX=/identity
|
||||||
|
- API_REGISTRY_ADDR=api-gateway
|
||||||
|
- APP_DOMAIN
|
||||||
|
- APP_KV_NAMESPACE
|
||||||
|
- DATABASE_URL
|
||||||
|
- MONGODB_URL
|
||||||
|
- EVENTBUS_URL
|
||||||
|
volumes:
|
||||||
|
- ../certs/identity-svc/identity-svc.crt:/certs/client.crt:ro
|
||||||
|
- ../certs/identity-svc/identity-svc.key:/certs/client.key:ro
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../db_migrations/identity-svc:/migrations
|
||||||
|
- ../bin/register-service:/bin/register-service
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
depends_on:
|
||||||
|
- api-registry
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
catalog-svc:
|
||||||
|
image: git.pbiernat.io/egommerce/catalog-svc:latest
|
||||||
|
environment:
|
||||||
|
- APP_NAME=catalog-svc
|
||||||
|
- APP_PATH_PREFIX=/catalog
|
||||||
|
- API_REGISTRY_ADDR=api-gateway
|
||||||
|
- APP_DOMAIN
|
||||||
|
- APP_KV_NAMESPACE
|
||||||
|
- AUTH_HANDLER_URL
|
||||||
|
- DATABASE_URL
|
||||||
|
- MONGODB_URL
|
||||||
|
- EVENTBUS_URL
|
||||||
|
volumes:
|
||||||
|
- ../certs/catalog-svc/catalog-svc.crt:/certs/client.crt:ro
|
||||||
|
- ../certs/catalog-svc/catalog-svc.key:/certs/client.key:ro
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../db_migrations/catalog-svc:/migrations
|
||||||
|
- ../bin/register-service:/bin/register-service
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
depends_on:
|
||||||
|
- api-registry
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
basket-svc:
|
||||||
|
image: git.pbiernat.io/egommerce/basket-svc:latest
|
||||||
|
environment:
|
||||||
|
- APP_NAME=basket-svc
|
||||||
|
- APP_PATH_PREFIX=/basket
|
||||||
|
- API_REGISTRY_ADDR=api-gateway
|
||||||
|
- APP_DOMAIN
|
||||||
|
- APP_KV_NAMESPACE
|
||||||
|
- AUTH_HANDLER_URL
|
||||||
|
- DATABASE_URL
|
||||||
|
- MONGODB_URL
|
||||||
|
- EVENTBUS_URL
|
||||||
|
volumes:
|
||||||
|
- ../certs/basket-svc/basket-svc.crt:/certs/client.crt:ro
|
||||||
|
- ../certs/basket-svc/basket-svc.key:/certs/client.key:ro
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../db_migrations/basket-svc:/migrations
|
||||||
|
- ../bin/register-service:/bin/register-service
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
depends_on:
|
||||||
|
- api-registry
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
order-svc:
|
||||||
|
image: git.pbiernat.io/egommerce/order-svc:latest
|
||||||
|
environment:
|
||||||
|
- APP_NAME=order-svc
|
||||||
|
- APP_PATH_PREFIX=/order
|
||||||
|
- API_REGISTRY_ADDR=api-gateway
|
||||||
|
- APP_DOMAIN
|
||||||
|
- APP_KV_NAMESPACE
|
||||||
|
- AUTH_HANDLER_URL
|
||||||
|
- DATABASE_URL
|
||||||
|
- MONGODB_URL
|
||||||
|
- EVENTBUS_URL
|
||||||
|
volumes:
|
||||||
|
- ../certs/order-svc/order-svc.crt:/certs/client.crt:ro
|
||||||
|
- ../certs/order-svc/order-svc.key:/certs/client.key:ro
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../db_migrations/order-svc:/migrations
|
||||||
|
- ../bin/register-service:/bin/register-service
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
depends_on:
|
||||||
|
- api-registry
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
pricing-svc:
|
||||||
|
image: git.pbiernat.io/egommerce/pricing-svc:latest
|
||||||
|
environment:
|
||||||
|
- APP_NAME=pricing-svc
|
||||||
|
- APP_PATH_PREFIX=/pricing
|
||||||
|
- API_REGISTRY_ADDR=api-gateway
|
||||||
|
- APP_DOMAIN
|
||||||
|
- APP_KV_NAMESPACE
|
||||||
|
- AUTH_HANDLER_URL
|
||||||
|
- DATABASE_URL
|
||||||
|
- MONGODB_URL
|
||||||
|
- EVENTBUS_URL
|
||||||
|
volumes:
|
||||||
|
- ../certs/pricing-svc/pricing-svc.crt:/certs/client.crt:ro
|
||||||
|
- ../certs/pricing-svc/pricing-svc.key:/certs/client.key:ro
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../db_migrations/pricing-svc:/migrations
|
||||||
|
- ../bin/register-service:/bin/register-service
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
depends_on:
|
||||||
|
- api-registry
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
# Workers (Eventbus)
|
||||||
|
basket-worker:
|
||||||
|
image: git.pbiernat.io/egommerce/basket-worker:latest
|
||||||
|
environment:
|
||||||
|
- APP_NAME=basket-worker
|
||||||
|
- APP_KV_NAMESPACE
|
||||||
|
- DATABASE_URL
|
||||||
|
- MONGODB_URL
|
||||||
|
- EVENTBUS_URL
|
||||||
|
volumes:
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
catalog-worker:
|
||||||
|
image: git.pbiernat.io/egommerce/catalog-worker:latest
|
||||||
|
environment:
|
||||||
|
- APP_NAME=catalog-worker
|
||||||
|
- DATABASE_URL
|
||||||
|
- MONGODB_URL
|
||||||
|
- EVENTBUS_URL
|
||||||
|
volumes:
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
pricing-worker:
|
||||||
|
image: git.pbiernat.io/egommerce/pricing-worker:latest
|
||||||
|
environment:
|
||||||
|
- APP_NAME=pricing-worker
|
||||||
|
- DATABASE_URL
|
||||||
|
- MONGODB_URL
|
||||||
|
- EVENTBUS_URL
|
||||||
|
volumes:
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
order-worker:
|
||||||
|
image: git.pbiernat.io/egommerce/order-worker:latest
|
||||||
|
environment:
|
||||||
|
- APP_NAME=order-worker
|
||||||
|
- DATABASE_URL
|
||||||
|
- MONGODB_URL
|
||||||
|
- EVENTBUS_URL
|
||||||
|
volumes:
|
||||||
|
- ../certs/ca/internalCA.crt:/usr/local/share/ca-certificates/internalCA.crt:ro
|
||||||
|
- ../bin/update-resolv.sh:/bin/update-resolv
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
networks:
|
||||||
|
- egommerce-network
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data: ~
|
||||||
|
mongodb_data: ~
|
||||||
|
registry_data: ~
|
||||||
|
gateway_data: ~
|
||||||
|
vault_data: ~
|
||||||
|
eventbus_data: ~
|
||||||
|
eventbus_logs: ~
|
||||||
|
# grafana-db: ~
|
||||||
|
|
||||||
|
networks:
|
||||||
|
# Infrastructure networks
|
||||||
|
egommerce-network:
|
||||||
|
driver: overlay
|
0
deploy/k8s/stack.dev.local.yml
Normal file
0
deploy/k8s/stack.dev.local.yml
Normal file
48
deploy/k8s/stack.dev.yml
Normal file
48
deploy/k8s/stack.dev.yml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: api-registry
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: api-registry
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: api-registry
|
||||||
|
image: git.pbiernat.io/egommerce/api-registry:dev
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: "1"
|
||||||
|
memory: 512M
|
||||||
|
ports:
|
||||||
|
- containerPort: 8501
|
||||||
|
name: api-registry-ui
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: api-registry
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: api-registry
|
||||||
|
ports:
|
||||||
|
- name: api-registry-ui
|
||||||
|
protocol: TCP
|
||||||
|
port: 8501
|
||||||
|
targetPort: api-registry-ui
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: api-registry
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: api-registry
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: api-registry
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: api-registry
|
||||||
|
image: git.pbiernat.io/egommerce/api-registry:dev
|
28
deploy/k8s/stack.prod.yml
Normal file
28
deploy/k8s/stack.prod.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: api-registry
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: api-registry
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: api-registry
|
||||||
|
image: git.pbiernat.io/egommerce/api-registry:prod
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: api-registry
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: api-registry
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: api-registry
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: api-registry
|
||||||
|
image: git.pbiernat.io/egommerce/api-registry:prod
|
78
deploy/k8s/stack.yml
Normal file
78
deploy/k8s/stack.yml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# kind: Namespace
|
||||||
|
# apiVersion: v1
|
||||||
|
# metadata:
|
||||||
|
# name: egommerce
|
||||||
|
# labels:
|
||||||
|
# name: egommerce
|
||||||
|
# ---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: docker-credentials
|
||||||
|
data:
|
||||||
|
.dockerconfigjson: ewoJImF1dGhzIjogewoJCSJnaXQucGJpZXJuYXQuaW8iOiB7CgkJCSJhdXRoIjogImEyVmxaRzl6YmpwWGIyeHVaVFZQY0hKdlozSmhiVzkzWVc1cFpVQT0iCgkJfSwKCQkiaHR0cHM6Ly9pbmRleC5kb2NrZXIuaW8vdjEvIjogewoJCQkiYXV0aCI6ICJhMlZsWkc5emJqcGtiMk5yWlhKdmQyVTFiMkp5WVhwNSIKCQl9Cgl9Cn0=
|
||||||
|
type: kubernetes.io/dockerconfigjson
|
||||||
|
---
|
||||||
|
# apiVersion: v1
|
||||||
|
# kind: Pod
|
||||||
|
# metadata:
|
||||||
|
# name: api-registry
|
||||||
|
# labels:
|
||||||
|
# app.kubernetes.io/name: api-registry
|
||||||
|
# spec:
|
||||||
|
# hostNetwork: true
|
||||||
|
# containers:
|
||||||
|
# - name: api-registry
|
||||||
|
# image: git.pbiernat.dev/egommerce/api-registry:dev
|
||||||
|
# resources:
|
||||||
|
# limits:
|
||||||
|
# cpu: "1"
|
||||||
|
# memory: 512M
|
||||||
|
# ports:
|
||||||
|
# - containerPort: 8501
|
||||||
|
# name: api-registry-ui
|
||||||
|
# ---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: api-registry
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: api-registry
|
||||||
|
ports:
|
||||||
|
- name: api-registry-ui
|
||||||
|
protocol: TCP
|
||||||
|
port: 8501
|
||||||
|
targetPort: api-registry-ui
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: api-registry
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: api-registry
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: api-registry
|
||||||
|
spec:
|
||||||
|
hostNetwork: true
|
||||||
|
hostAliases:
|
||||||
|
- ip: "127.0.0.1"
|
||||||
|
hostnames:
|
||||||
|
- "git.pbiernat.io"
|
||||||
|
dnsPolicy: ClusterFirstWithHostNet
|
||||||
|
restartPolicy: Always
|
||||||
|
containers:
|
||||||
|
- name: api-registry
|
||||||
|
image: git.pbiernat.dev/egommerce/api-registry:dev
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: "1"
|
||||||
|
memory: 512M
|
||||||
|
ports:
|
||||||
|
- containerPort: 53
|
||||||
|
- containerPort: 8501
|
13
deploy/start-docker.sh
Normal file
13
deploy/start-docker.sh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# RUN IT FORM THE REPO ROOT DIR
|
||||||
|
|
||||||
|
echo "Starting egommerce docker stack..."
|
||||||
|
docker stack deploy --with-registry-auth \
|
||||||
|
--detach=true \
|
||||||
|
--compose-file deploy/docker/stack.yml \
|
||||||
|
--compose-file deploy/docker/stack.prod.yml \
|
||||||
|
--compose-file deploy/docker/stack.dev.yml \
|
||||||
|
--compose-file deploy/docker/stack.dev.local.yml \
|
||||||
|
egommerce
|
||||||
|
|
||||||
|
echo "Done."
|
12
deploy/start-k8s.sh
Normal file
12
deploy/start-k8s.sh
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# RUN IT FORM THE REPO ROOT DIR
|
||||||
|
|
||||||
|
echo "Starting egommerce k8s stack..."
|
||||||
|
|
||||||
|
kubectl apply -f deploy/k8s/stack.yml
|
||||||
|
# kubectl apply -f deploy/k8s/stack.prod.yml
|
||||||
|
# kubectl apply -f deploy/k8s/stack.dev.yml
|
||||||
|
# kubectl apply -f deploy/k8s/stack.dev.local.yml
|
||||||
|
|
||||||
|
|
||||||
|
echo "Done."
|
0
deploy/volumes-restart.sh
Normal file
0
deploy/volumes-restart.sh
Normal file
Loading…
Reference in New Issue
Block a user