This commit is contained in:
Piotr Biernat 2024-12-05 16:59:08 +01:00
parent 13073daa38
commit ac19e766cf
10 changed files with 18 additions and 15 deletions

View File

@ -9,6 +9,8 @@
}, },
"Check": { "Check": {
"TCP": "__IP__:443", "TCP": "__IP__:443",
"Interval": "5s",
"Timeout": "1s",
"DeregisterCriticalServiceAfter": "10s" "DeregisterCriticalServiceAfter": "10s"
} }
} }

View File

@ -7,7 +7,7 @@ APP_PATH_PREFIX=/identity
APP_KV_NAMESPACE=dev.egommerce/service/identity-svc APP_KV_NAMESPACE=dev.egommerce/service/identity-svc
LOGGER_ADDR=api-logger:24224 LOGGER_ADDR=api-logger:24224
REGISTRY_ADDR=api-registry:8500 REGISTRY_ADDR=api-registry:8501
DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
CACHE_ADDR=api-cache:6379 CACHE_ADDR=api-cache:6379
CACHE_PASSWORD=12345678 CACHE_PASSWORD=12345678

View File

@ -17,8 +17,11 @@ waitForService()
update-resolv # provided by stack - better approach - single copy update-resolv # provided by stack - better approach - single copy
update-ca-certificates update-ca-certificates
waitForService "postgres-db:5432" waitForService "api-registry:8501"
waitForService "api-logger:24224" waitForService "api-logger:24224"
waitForService "db-postgres:5432"
register-service
# run migrations # run migrations
migrate.sh migrate.sh

View File

@ -29,7 +29,7 @@ func main() {
} }
func healthCheck() bool { func healthCheck() bool {
run, err := os.Open("/app.run") run, err := os.Open("./app.run")
if err != nil { if err != nil {
return false return false
} }

View File

@ -25,7 +25,7 @@ func main() {
a.RegisterPlugin(app.CachePlugin(cArr)) a.RegisterPlugin(app.CachePlugin(cArr))
a.RegisterPlugin(app.DatabasePlugin(cArr)) a.RegisterPlugin(app.DatabasePlugin(cArr))
// a.RegisterPlugin(app.EventbusPlugin(cArr)) // a.RegisterPlugin(app.EventbusPlugin(cArr))
a.RegisterPlugin(app.RegistryPlugin(cArr)) // a.RegisterPlugin(app.RegistryPlugin(cArr))
while := make(chan struct{}) while := make(chan struct{})
err := a.Start(while) err := a.Start(while)

View File

@ -4,7 +4,7 @@ go 1.18
require ( require (
git.pbiernat.io/egommerce/api-entities v0.2.3 git.pbiernat.io/egommerce/api-entities v0.2.3
git.pbiernat.io/egommerce/go-api-pkg v0.3.18 git.pbiernat.io/egommerce/go-api-pkg v0.3.24
github.com/go-pg/migrations/v8 v8.1.0 github.com/go-pg/migrations/v8 v8.1.0
github.com/go-pg/pg/v10 v10.11.1 github.com/go-pg/pg/v10 v10.11.1
github.com/go-redis/redis/v8 v8.11.5 github.com/go-redis/redis/v8 v8.11.5

View File

@ -7,8 +7,8 @@ cloud.google.com/go/iam v1.1.1 h1:lW7fzj15aVIXYHREOqjRBV9PsH0Z6u8Y46a1YGvQP4Y=
cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU=
git.pbiernat.io/egommerce/api-entities v0.2.3 h1:mR6EYfZkAzh4teydb7KXDBWoxwVW3qasnmmH5J3mnas= git.pbiernat.io/egommerce/api-entities v0.2.3 h1:mR6EYfZkAzh4teydb7KXDBWoxwVW3qasnmmH5J3mnas=
git.pbiernat.io/egommerce/api-entities v0.2.3/go.mod h1:INXAG5x4+i+vNwg1NpfPHiDW8nY1kn1K7pgLOtX+/I0= git.pbiernat.io/egommerce/api-entities v0.2.3/go.mod h1:INXAG5x4+i+vNwg1NpfPHiDW8nY1kn1K7pgLOtX+/I0=
git.pbiernat.io/egommerce/go-api-pkg v0.3.18 h1:0+C9BMsllrNvRbh4kb7dJ5lrzP1Lc7J4pb+KV76YrXk= git.pbiernat.io/egommerce/go-api-pkg v0.3.24 h1:if6xsFOStckWdGm7kcgKWOhOGOe6iIBOOr+3DjgX5tM=
git.pbiernat.io/egommerce/go-api-pkg v0.3.18/go.mod h1:XIy2mmvRNIzQmYIUAcDZafhRPxTQFS2HDmsK7ZQ6980= git.pbiernat.io/egommerce/go-api-pkg v0.3.24/go.mod h1:XIy2mmvRNIzQmYIUAcDZafhRPxTQFS2HDmsK7ZQ6980=
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU=
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
github.com/Azure/go-autorest/autorest v0.11.28 h1:ndAExarwr5Y+GaHE6VCaY1kyS/HwwGGyuimVhWsHOEM= github.com/Azure/go-autorest/autorest v0.11.28 h1:ndAExarwr5Y+GaHE6VCaY1kyS/HwwGGyuimVhWsHOEM=

View File

@ -21,7 +21,7 @@ const (
defNetAddr = ":443" defNetAddr = ":443"
defMongoDbURL = "mongodb://mongodb:12345678@mongo-db:27017" defMongoDbURL = "mongodb://mongodb:12345678@mongo-db:27017"
defPathPrefix = "/identity" defPathPrefix = "/identity"
defRegistryAddr = "api-registry:8500" defRegistryAddr = "api-registry:8501"
defEbEventsExchange = "api-events" defEbEventsExchange = "api-events"
defEbEventsQueue = "identity-svc" defEbEventsQueue = "identity-svc"
) )

View File

@ -1,8 +1,6 @@
package server package server
import ( import (
"strings"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"git.pbiernat.io/egommerce/go-api-pkg/fluentd" "git.pbiernat.io/egommerce/go-api-pkg/fluentd"
@ -18,10 +16,10 @@ func SetupMiddleware(s *Server) {
func LoggingMiddleware(log *fluentd.Logger) func(c *fiber.Ctx) error { func LoggingMiddleware(log *fluentd.Logger) func(c *fiber.Ctx) error {
return func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error {
path := string(c.Request().URI().Path()) // path := string(c.Request().URI().Path())
if strings.Contains(path, "/health") { // if strings.Contains(path, "/health") {
return c.Next() // return c.Next()
} // }
log.Log("Request: %s, remote: %s, via: %s", log.Log("Request: %s, remote: %s, via: %s",
c.Request().URI().String(), c.Request().URI().String(),

View File

@ -68,7 +68,7 @@ func (s *Server) RegisterHandler(name string, fn func() any) {
func (s *Server) OnShutdown() { func (s *Server) OnShutdown() {
// s.GetLogger().Log("Server %s is going down...", s.ID) // s.GetLogger().Log("Server %s is going down...", s.ID)
s.GetRegistry().Unregister() // s.GetRegistry().Unregister()
// a.clearMetadataCache() // a.clearMetadataCache()
// s.GetEventBus().Close() // s.GetEventBus().Close()
s.GetDatabase().Close() s.GetDatabase().Close()