* feat(integrations): new version of backend integrations * feat(integrations): added ingress rule * feat(integrations): fixed a port number * feat(integrations): enabled ingress in values.yaml * feat(integrations): added startup log * feat(integrations): added extra logger for 3 of 4 backend logs integrations. * feat(integrations): removed a logs loop call * feat(integrations): fixed a table name * feat(integrations): disabled extra logger * feat(integrations): made extra logger as an option * feat(integrations): changed contentType for logs file * feat(integrations): bug fix * feat(integrations): struct/string config support for datadog provider * feat(integrations): map config support for datadog provider * feat(integrations): removed unnecessary transformation * feat(integrations): fixed datadog and sentry response format * feat(integrations): added correct creds parser for sentry provider * feat(integrations): removed unnecessary return statement * feat(integrations): added correct creds parser for elastic search * feat(integrations): changed elastic to elasticsearch * feat(integrations): added correct creds parser for dynatrace * feat(integrations): fixed an issue in query request for elasticsearch provider * feat(integrations): made extra logger configurable by env var * feat(integrations): removed debug logs
57 lines
1.5 KiB
Go
57 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
config "openreplay/backend/internal/config/integrations"
|
|
"openreplay/backend/internal/http/server"
|
|
"openreplay/backend/pkg/db/postgres/pool"
|
|
integration "openreplay/backend/pkg/integrations"
|
|
"openreplay/backend/pkg/logger"
|
|
"openreplay/backend/pkg/metrics"
|
|
"openreplay/backend/pkg/metrics/database"
|
|
)
|
|
|
|
func main() {
|
|
ctx := context.Background()
|
|
log := logger.New()
|
|
cfg := config.New(log)
|
|
metrics.New(log, append(database.List()))
|
|
|
|
pgConn, err := pool.New(cfg.Postgres.String())
|
|
if err != nil {
|
|
log.Fatal(ctx, "can't init postgres connection: %s", err)
|
|
}
|
|
defer pgConn.Close()
|
|
|
|
services, err := integration.NewServiceBuilder(log, cfg, pgConn)
|
|
if err != nil {
|
|
log.Fatal(ctx, "can't init services: %s", err)
|
|
}
|
|
|
|
router, err := integration.NewRouter(cfg, log, services)
|
|
if err != nil {
|
|
log.Fatal(ctx, "failed while creating router: %s", err)
|
|
}
|
|
|
|
dataIntegrationServer, err := server.New(router.GetHandler(), cfg.HTTPHost, cfg.HTTPPort, cfg.HTTPTimeout)
|
|
if err != nil {
|
|
log.Fatal(ctx, "failed while creating server: %s", err)
|
|
}
|
|
go func() {
|
|
if err := dataIntegrationServer.Start(); err != nil {
|
|
log.Fatal(ctx, "http server error: %s", err)
|
|
}
|
|
}()
|
|
log.Info(ctx, "server successfully started on port %s", cfg.HTTPPort)
|
|
|
|
// Wait stop signal to shut down server gracefully
|
|
sigchan := make(chan os.Signal, 1)
|
|
signal.Notify(sigchan, syscall.SIGINT, syscall.SIGTERM)
|
|
<-sigchan
|
|
log.Info(ctx, "shutting down the server")
|
|
dataIntegrationServer.Stop()
|
|
}
|