From 2da3dd13d1a54f677a8d21b8dd521842dfe11917 Mon Sep 17 00:00:00 2001 From: Piotr Biernat Date: Thu, 6 Oct 2022 20:40:27 +0200 Subject: [PATCH] update --- .gitignore | 2 + .gitmodules | 15 ------ Makefile | 0 README.md | 4 +- build/ci/.drone.yml | 0 .../001_create_identity_svc_db.sql | 9 ++++ deploy/egommerce-stack.dev.yml | 21 ++++++++ deploy/egommerce-stack.yml | 51 +++++++++++++++++++ deploy/stack-start.sh | 10 ++++ deployments/docker-compose.yml | 0 go.mod | 3 -- services/basket | 1 - services/catalog | 1 - services/identity | 1 - services/notification | 1 - services/ordering | 1 - 16 files changed, 95 insertions(+), 25 deletions(-) delete mode 100644 .gitmodules delete mode 100644 Makefile delete mode 100644 build/ci/.drone.yml create mode 100644 deploy/db_migrations/001_create_identity_svc_db.sql create mode 100644 deploy/egommerce-stack.dev.yml create mode 100644 deploy/egommerce-stack.yml create mode 100644 deploy/stack-start.sh delete mode 100644 deployments/docker-compose.yml delete mode 100644 go.mod delete mode 160000 services/basket delete mode 160000 services/catalog delete mode 160000 services/identity delete mode 160000 services/notification delete mode 160000 services/ordering diff --git a/.gitignore b/.gitignore index 9f11b75..1e8f546 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .idea/ + +deploy/*.local.yml diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 8cc2582..0000000 --- a/.gitmodules +++ /dev/null @@ -1,15 +0,0 @@ -[submodule "services/basket"] - path = services/basket - url = git@git.pbiernat.dev:egommerce/basket-service.git -[submodule "services/catalog"] - path = services/catalog - url = git@git.pbiernat.dev:egommerce/catalog-service.git -[submodule "services/identity"] - path = services/identity - url = git@git.pbiernat.dev:egommerce/identity-service.git -[submodule "services/notification"] - path = services/notification - url = git@git.pbiernat.dev:egommerce/notification-service.git -[submodule "services/ordering"] - path = services/ordering - url = git@git.pbiernat.dev:egommerce/ordering-service.git diff --git a/Makefile b/Makefile deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md index 8fbfae1..c0df4c3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# application +# stack -Main application - includes all microservices \ No newline at end of file +Egommerce docker stack \ No newline at end of file diff --git a/build/ci/.drone.yml b/build/ci/.drone.yml deleted file mode 100644 index e69de29..0000000 diff --git a/deploy/db_migrations/001_create_identity_svc_db.sql b/deploy/db_migrations/001_create_identity_svc_db.sql new file mode 100644 index 0000000..7e244e1 --- /dev/null +++ b/deploy/db_migrations/001_create_identity_svc_db.sql @@ -0,0 +1,9 @@ +-- TODO: Add variables for db, user name, etc... + +CREATE DATABASE svc_identity + WITH + OWNER = postgres + ENCODING = 'UTF8' + CONNECTION LIMIT = -1; + +GRANT ALL ON DATABASE svc_identity TO postgres; diff --git a/deploy/egommerce-stack.dev.yml b/deploy/egommerce-stack.dev.yml new file mode 100644 index 0000000..86c14ae --- /dev/null +++ b/deploy/egommerce-stack.dev.yml @@ -0,0 +1,21 @@ +version: "3.9" + +services: + postgres_svc: + ports: + - '5432:5432' + volumes: + - postgres_data:/var/lib/postgresql/data + environment: + - POSTGRES_PASSWORD=12345678 + + identity_svc: + environment: + - DATABASE_URL=postgres://postgres:12345678@postgres_svc:5432/egommerce + + basket_svc: + environment: + - DATABASE_URL=postgres://postgres:12345678@postgres_svc:5432/egommerce + +volumes: + postgres_data: ~ diff --git a/deploy/egommerce-stack.yml b/deploy/egommerce-stack.yml new file mode 100644 index 0000000..383e45e --- /dev/null +++ b/deploy/egommerce-stack.yml @@ -0,0 +1,51 @@ +version: "3.9" + +services: + postgres_svc: + image: postgres:14.1-alpine + # hostname: postgres + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=SuPerTrudneHasloNaKoniecTrzebaWygenerowac + networks: + - postgres_network + + apigw_svc: + image: git.pbiernat.dev/egommerce/apigw-svc:latest # fixme :stable + networks: + - apigw_network + - identity_network + - basket_network + + identity_svc: + image: git.pbiernat.dev/egommerce/identity-svc:latest # fixme :stable + environment: + - DATABASE_URL=postgres://PROD_IDENTITY_USER:PROD_PASS@postgres_svc:5432/PROD_DATABASE + networks: + - identity_network + - postgres_network + + basket_svc: + image: egommerce_basket:latest + environment: + - DATABASE_URL=postgres://PROD_BASKET_USER:PROD_PASS@postgres_svc:5432/PROD_DATABASE + networks: + - basket_network + - postgres_network + +networks: + postgres_network: + driver: overlay + internal: true + + apigw_network: + driver: overlay + internal: true + + identity_network: + driver: overlay + internal: true + + basket_network: + driver: overlay + internal: true diff --git a/deploy/stack-start.sh b/deploy/stack-start.sh new file mode 100644 index 0000000..5ca1605 --- /dev/null +++ b/deploy/stack-start.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# FIX paths... + +echo "Starting egommerce stack..." +docker stack deploy --with-registry-auth \ + --compose-file deployments/egommerce-stack.yml \ + --compose-file deployments/egommerce-stack.dev.yml \ + --compose-file deployments/egommerce-stack.dev.local.yml \ + egommerce +echo "Done." diff --git a/deployments/docker-compose.yml b/deployments/docker-compose.yml deleted file mode 100644 index e69de29..0000000 diff --git a/go.mod b/go.mod deleted file mode 100644 index 08621d2..0000000 --- a/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module git.pbiernat.dev/egommerce/application - -go 1.18 diff --git a/services/basket b/services/basket deleted file mode 160000 index c4134dc..0000000 --- a/services/basket +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c4134dc7a28956a7124ffbf2891c2762e7d916ce diff --git a/services/catalog b/services/catalog deleted file mode 160000 index cc115fb..0000000 --- a/services/catalog +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cc115fb4c989000b8d056773903787871a95d842 diff --git a/services/identity b/services/identity deleted file mode 160000 index 748b631..0000000 --- a/services/identity +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 748b631d0c805b3a4c082ab5962fec0e4815e643 diff --git a/services/notification b/services/notification deleted file mode 160000 index a939b79..0000000 --- a/services/notification +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a939b791aded01fa14413a6e98eb03cbfe4801e2 diff --git a/services/ordering b/services/ordering deleted file mode 160000 index 508ae5a..0000000 --- a/services/ordering +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 508ae5a554193b98957ef5b66853df5c8986fbc0