From df5fec15a91134a8111b149583ac163391624a8e Mon Sep 17 00:00:00 2001 From: yyasha Date: Wed, 31 Jan 2024 10:29:30 +0300 Subject: [PATCH] add app and frontend to docker compose --- Makefile | 4 ++++ config/dev.yaml | 21 ++++++++++++++++++++ docker-compose.yml | 48 +++++++++++++++++++++------------------------- 3 files changed, 47 insertions(+), 26 deletions(-) create mode 100644 config/dev.yaml diff --git a/Makefile b/Makefile index ea4b81a..befe701 100644 --- a/Makefile +++ b/Makefile @@ -14,3 +14,7 @@ generate: go generate ./... test: go test ./internal/... +docker_build: + docker build -t registry.computernetthings.ru/recipes/app . +docker_push: + docker push registry.computernetthings.ru/recipes/app diff --git a/config/dev.yaml b/config/dev.yaml new file mode 100644 index 0000000..f8b4634 --- /dev/null +++ b/config/dev.yaml @@ -0,0 +1,21 @@ +env: "dev" # local / dev / prod + +http-server: + address: "0.0.0.0:4444" + timeout: 4s + idle_timeout: 60s + +postgresql: + db_name: "pguser" + user: "pguser" + password: "password" + address: "192.168.4.4:5432" + +redis: + password: "password" + address: "192.168.4.7:6379" + +minio: + user: "user" + password: "password" + address: "192.168.4.5:9000" diff --git a/docker-compose.yml b/docker-compose.yml index 163935e..8762c8b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,22 +19,22 @@ services: # build: # context: . # dockerfile: Dockerfile - image: recipes:latest + image: registry.computernetthings.ru/recipes/app:latest container_name: app restart: unless-stopped env_file: .env environment: - CONFIG_PATH: ./config/local.yaml + CONFIG_PATH: ./config/dev.yaml depends_on: - app_pg - redis - minio - # labels: - # - "traefik.enable=true" - # - "traefik.http.routers.app.entrypoints=websecure" - # - "traefik.http.routers.app.tls=true" - # - "traefik.http.routers.app.tls.certresolver=production" - # - "traefik.http.routers.app.rule=Host(`$API_HOST`)" + labels: + - "traefik.enable=true" + - "traefik.http.routers.recipes_app.entrypoints=websecure" + - "traefik.http.routers.recipes_app.tls=true" + - "traefik.http.routers.recipes_app.tls.certresolver=production" + - "traefik.http.routers.recipes_app.rule=Host(`$API_HOST`)" networks: microservicesnet: ipv4_address: 192.168.4.3 @@ -65,8 +65,6 @@ services: environment: - MINIO_ROOT_USER=$MINIO_ROOT_USER - MINIO_ROOT_PASSWORD=$MINIO_ROOT_PASSWORD -# volumes: -# - ../docker_data/recipes2_data/minio:/bitnami/minio/data:z ports: - '9000:9000' - '9001:9001' @@ -80,26 +78,24 @@ services: restart: unless-stopped env_file: .env command: redis-server --loglevel warning --requirepass $RDB_PASSWORD # --save 20 1 -# volumes: -# - ../docker_data/recipes2_data/cache:/date networks: microservicesnet: ipv4_address: 192.168.4.7 - # # frontend - # frontend_service: - # image: registry.computernetthings.ru/parallel/frontend:latest - # container_name: frontend_service - # restart: unless-stopped - # labels: - # - "traefik.enable=true" - # - "traefik.http.routers.frontend_service.entrypoints=websecure" - # - "traefik.http.routers.frontend_service.tls=true" - # - "traefik.http.routers.frontend_service.tls.certresolver=production" - # - "traefik.http.routers.frontend_service.rule=Host(`$FRONTEND_HOST`)" - # networks: - # microservicesnet: - # ipv4_address: 192.168.4.6 + # frontend + recipes_frontend: + image: registry.computernetthings.ru/recipes/front:latest + container_name: recipes_frontend + restart: unless-stopped + labels: + - "traefik.enable=true" + - "traefik.http.routers.recipes_frontend.entrypoints=websecure" + - "traefik.http.routers.recipes_frontend.tls=true" + - "traefik.http.routers.recipes_frontend.tls.certresolver=production" + - "traefik.http.routers.recipes_frontend.rule=Host(`$FRONTEND_HOST`)" + networks: + microservicesnet: + ipv4_address: 192.168.4.6 networks: microservicesnet: