From 4bc70db7cc4f3d832b8185f669336017f23a8352 Mon Sep 17 00:00:00 2001 From: b1ackd0t Date: Mon, 31 Jul 2023 15:38:35 +0300 Subject: [PATCH] NOISSUE - Sync Env Veriables With Docker Deployment (#1841) * Initial Commit: Sync Env Veriables With Docker Deployment Signed-off-by: rodneyosodo * Sync Env Vars With Master Signed-off-by: rodneyosodo * Remove Altprefix Signed-off-by: rodneyosodo * Rename HttpPort to HTTPPort Signed-off-by: rodneyosodo * Fix envPrefixDB After Rebase Signed-off-by: rodneyosodo * Remove Server Parse Signed-off-by: rodneyosodo * Add Provision For TLS on CoAP Signed-off-by: rodneyosodo * Fix Exit After Defer Signed-off-by: rodneyosodo * Remove Unused Function Signed-off-by: rodneyosodo * Document Undocumentated Env Variables Signed-off-by: rodneyosodo --------- Signed-off-by: rodneyosodo Co-authored-by: Drasko DRASKOVIC --- bootstrap/README.md | 109 ++--- certs/README.md | 4 + cmd/bootstrap/main.go | 50 +-- cmd/cassandra-reader/main.go | 34 +- cmd/cassandra-writer/main.go | 31 +- cmd/certs/main.go | 47 +- cmd/coap/main.go | 33 +- cmd/http/main.go | 25 +- cmd/influxdb-reader/main.go | 36 +- cmd/influxdb-writer/main.go | 31 +- cmd/lora/main.go | 29 +- cmd/mongodb-reader/main.go | 38 +- cmd/mongodb-writer/main.go | 24 +- cmd/mqtt/main.go | 70 ++- cmd/opcua/main.go | 30 +- cmd/postgres-reader/main.go | 34 +- cmd/postgres-writer/main.go | 25 +- cmd/provision/main.go | 11 +- cmd/smpp-notifier/main.go | 25 +- cmd/smtp-notifier/main.go | 26 +- cmd/things/main.go | 38 +- cmd/timescale-reader/main.go | 33 +- cmd/timescale-writer/main.go | 29 +- cmd/twins/main.go | 31 +- cmd/users/main.go | 35 +- cmd/ws/main.go | 25 +- coap/README.md | 53 ++- consumers/notifiers/smpp/README.md | 64 +-- consumers/notifiers/smtp/README.md | 65 +-- consumers/writers/cassandra/README.md | 51 ++- consumers/writers/influxdb/README.md | 71 +-- consumers/writers/mongodb/README.md | 43 +- consumers/writers/postgres/README.md | 65 +-- consumers/writers/timescale/README.md | 67 +-- docker/.env | 406 +++++++++++------- docker/addons/bootstrap/docker-compose.yml | 30 +- .../cassandra-reader/docker-compose.yml | 21 +- .../cassandra-writer/docker-compose.yml | 18 +- docker/addons/certs/docker-compose.yml | 39 +- .../addons/influxdb-reader/docker-compose.yml | 31 +- .../addons/influxdb-writer/docker-compose.yml | 25 +- docker/addons/lora-adapter/docker-compose.yml | 13 +- .../addons/mongodb-reader/docker-compose.yml | 22 +- .../addons/mongodb-writer/docker-compose.yml | 18 +- .../addons/opcua-adapter/docker-compose.yml | 22 +- .../addons/postgres-reader/docker-compose.yml | 32 +- .../addons/postgres-writer/docker-compose.yml | 34 +- docker/addons/provision/docker-compose.yml | 1 - .../addons/smpp-notifier/docker-compose.yml | 30 +- .../addons/smtp-notifier/docker-compose.yml | 31 +- .../timescale-reader/docker-compose.yml | 32 +- .../timescale-writer/docker-compose.yml | 34 +- docker/addons/twins/docker-compose.yml | 31 +- docker/docker-compose.yml | 169 +++++--- docker/nginx/entrypoint.sh | 3 +- docker/nginx/nginx-key.conf | 2 +- docker/nginx/nginx-x509.conf | 2 +- http/README.md | 40 +- internal/clients/cassandra/cassandra.go | 10 +- internal/clients/grpc/auth/client.go | 4 +- internal/clients/grpc/things/client.go | 4 +- internal/clients/influxdb/influxdb.go | 8 +- internal/clients/mongo/mongo.go | 4 +- internal/clients/postgres/postgres.go | 18 +- internal/env/load.go | 10 - internal/env/parser.go | 85 +--- internal/env/parser_test.go | 97 +---- internal/server/coap/coap.go | 24 +- lora/README.md | 2 +- mqtt/README.md | 65 ++- opcua/README.md | 2 +- pkg/sdk/go/certs.go | 2 +- pkg/sdk/go/groups.go | 10 +- pkg/sdk/go/users.go | 4 +- readers/cassandra/README.md | 76 ++-- readers/influxdb/README.md | 106 +++-- readers/mongodb/README.md | 67 +-- readers/postgres/README.md | 100 +++-- readers/timescale/README.md | 93 ++-- scripts/run.sh | 2 +- things/README.md | 97 +++-- things/clients/service.go | 1 - twins/README.md | 74 ++-- users/README.md | 105 ++--- ws/README.md | 43 +- 85 files changed, 2009 insertions(+), 1572 deletions(-) delete mode 100644 internal/env/load.go diff --git a/bootstrap/README.md b/bootstrap/README.md index 1dc3bc930a8..27ac2113454 100644 --- a/bootstrap/README.md +++ b/bootstrap/README.md @@ -2,9 +2,9 @@ New devices need to be configured properly and connected to the Mainflux. Bootstrap service is used in order to accomplish that. This service provides the following features: - 1) Creating new Mainflux Things - 2) Providing basic configuration for the newly created Things - 3) Enabling/disabling Things +1. Creating new Mainflux Things +2. Providing basic configuration for the newly created Things +3. Enabling/disabling Things Pre-provisioning a new Thing is as simple as sending Configuration data to the Bootstrap service. Once the Thing is online, it sends a request for initial config to Bootstrap service. Bootstrap service provides an API for enabling and disabling Things. Only enabled Things can exchange messages over Mainflux. Bootstrapping does not implicitly enable Things, it has to be done manually. @@ -14,18 +14,18 @@ In order to bootstrap successfully, the Thing needs to send bootstrapping reques Thing Configuration consists of two logical parts: the custom configuration that can be interpreted by the Thing itself and Mainflux-related configuration. Mainflux config contains: - 1) corresponding Mainflux Thing ID - 2) corresponding Mainflux Thing key - 3) list of the Mainflux channels the Thing is connected to +1. corresponding Mainflux Thing ID +2. corresponding Mainflux Thing key +3. list of the Mainflux channels the Thing is connected to ->Note: list of channels contains IDs of the Mainflux channels. These channels are _pre-provisioned_ on the Mainflux side and, unlike corresponding Mainflux Thing, Bootstrap service is not able to create Mainflux Channels. +> Note: list of channels contains IDs of the Mainflux channels. These channels are _pre-provisioned_ on the Mainflux side and, unlike corresponding Mainflux Thing, Bootstrap service is not able to create Mainflux Channels. Enabling and disabling Thing (adding Thing to/from whitelist) is as simple as connecting corresponding Mainflux Thing to the given list of Channels. Configuration keeps _state_ of the Thing: -| State | What it means | -|----------|--------------------------------------------------------| -| Inactive | Thing is created, but isn't enabled | -| Active | Thing is able to communicate using Mainflux | +| State | What it means | +| -------- | ------------------------------------------- | +| Inactive | Thing is created, but isn't enabled | +| Active | Thing is able to communicate using Mainflux | Switching between states `Active` and `Inactive` enables and disables Thing, respectively. @@ -35,40 +35,39 @@ Thing configuration also contains the so-called `external ID` and `external key` The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -|-------------------------------|-------------------------------------------------------------------------|----------------------------------| -| MF_BOOTSTRAP_LOG_LEVEL | Log level for Bootstrap (debug, info, warn, error) | info | -| MF_BOOTSTRAP_DB_HOST | Database host address | localhost | -| MF_BOOTSTRAP_DB_PORT | Database host port | 5432 | -| MF_BOOTSTRAP_DB_USER | Database user | mainflux | -| MF_BOOTSTRAP_DB_PASS | Database password | mainflux | -| MF_BOOTSTRAP_DB | Name of the database used by the service | bootstrap | -| MF_BOOTSTRAP_DB_SSL_MODE | Database connection SSL mode (disable, require, verify-ca, verify-full) | disable | -| MF_BOOTSTRAP_DB_SSL_CERT | Path to the PEM encoded certificate file | | -| MF_BOOTSTRAP_DB_SSL_KEY | Path to the PEM encoded key file | | -| MF_BOOTSTRAP_DB_SSL_ROOT_CERT | Path to the PEM encoded root certificate file | | -| MF_BOOTSTRAP_ENCRYPT_KEY | Secret key for secure bootstrapping encryption | 12345678910111213141516171819202 | -| MF_BOOTSTRAP_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | -| MF_BOOTSTRAP_CA_CERTS | Path to trusted CAs in PEM format | | -| MF_BOOTSTRAP_PORT | Bootstrap service HTTP port | 9013 | -| MF_BOOTSTRAP_SERVER_CERT | Path to server certificate in pem format | | -| MF_BOOTSTRAP_SERVER_KEY | Path to server key in pem format | | -| MF_THINGS_URL | Base url for Mainflux Things | http://localhost:9000 | -| MF_THINGS_ES_URL | Things service event source URL | localhost:6379 | -| MF_THINGS_ES_PASS | Things service event source password | | -| MF_THINGS_ES_DB | Things service event source database | 0 | -| MF_BOOTSTRAP_ES_URL | Bootstrap service event source URL | localhost:6379 | -| MF_BOOTSTRAP_ES_PASS | Bootstrap service event source password | | -| MF_BOOTSTRAP_ES_DB | Bootstrap service event source database | 0 | -| MF_BOOTSTRAP_EVENT_CONSUMER | Bootstrap service event source consumer name | bootstrap | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | -| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| ----------------------------- | ----------------------------------------------------------------------- | -------------------------------------------------- | +| MF_BOOTSTRAP_LOG_LEVEL | Log level for Bootstrap (debug, info, warn, error) | info | +| MF_BOOTSTRAP_DB_HOST | Database host address | localhost | +| MF_BOOTSTRAP_DB_PORT | Database host port | 5432 | +| MF_BOOTSTRAP_DB_USER | Database user | mainflux | +| MF_BOOTSTRAP_DB_PASS | Database password | mainflux | +| MF_BOOTSTRAP_DB_NAME | Name of the database used by the service | bootstrap | +| MF_BOOTSTRAP_DB_SSL_MODE | Database connection SSL mode (disable, require, verify-ca, verify-full) | disable | +| MF_BOOTSTRAP_DB_SSL_CERT | Path to the PEM encoded certificate file | | +| MF_BOOTSTRAP_DB_SSL_KEY | Path to the PEM encoded key file | | +| MF_BOOTSTRAP_DB_SSL_ROOT_CERT | Path to the PEM encoded root certificate file | | +| MF_BOOTSTRAP_ENCRYPT_KEY | Secret key for secure bootstrapping encryption | v7aT0HGxJxt2gULzr3RHwf4WIf6DusPphG5Ftm2bNCWD8mTpyr | +| MF_BOOTSTRAP_HTTP_HOST | Bootstrap service HTTP host | | +| MF_BOOTSTRAP_HTTP_PORT | Bootstrap service HTTP port | 9013 | +| MF_BOOTSTRAP_HTTP_SERVER_CERT | Path to server certificate in pem format | | +| MF_BOOTSTRAP_HTTP_SERVER_KEY | Path to server key in pem format | | +| MF_BOOTSTRAP_EVENT_CONSUMER | Bootstrap service event source consumer name | bootstrap | +| MF_BOOTSTRAP_ES_URL | Bootstrap service event source URL | localhost:6379 | +| MF_BOOTSTRAP_ES_PASS | Bootstrap service event source password | | +| MF_BOOTSTRAP_ES_DB | Bootstrap service event source database | 0 | +| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | +| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | +| MF_AUTH_GRPC_CLIENT_TLS | Enable TLS for gRPC client | false | +| MF_AUTH_GRPC_CA_CERTS | CA certificates for gRPC client | | +| MF_THINGS_URL | Base url for Mainflux Things | http://localhost:9000 | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_BOOTSTRAP_INSTANCE_ID | Bootstrap service instance ID | | ## Deployment -The service itself is distributed as Docker container. Check the [`boostrap`](https://github.com/mainflux/mainflux/blob/master/docker/addons/bootstrap/docker-compose.yml#L32-L56) service section in +The service itself is distributed as Docker container. Check the [`boostrap`](https://github.com/mainflux/mainflux/blob/master/docker/addons/bootstrap/docker-compose.yml#L32-L56) service section in docker-compose to see how service is deployed. To start the service outside of the container, execute the following shell script: @@ -87,26 +86,32 @@ make install # set the environment variables and run the service MF_BOOTSTRAP_LOG_LEVEL=[Bootstrap log level] \ +MF_BOOTSTRAP_ENCRYPT_KEY=[Hex-encoded encryption key used for secure bootstrap] \ +MF_BOOTSTRAP_EVENT_CONSUMER=[Bootstrap service event source consumer name] \ +MF_BOOTSTRAP_ES_URL=[Bootstrap service event source URL] \ +MF_BOOTSTRAP_ES_PASS=[Bootstrap service event source password] \ +MF_BOOTSTRAP_ES_DB=[Bootstrap service event source database] \ +MF_BOOTSTRAP_HTTP_HOST=[Bootstrap service HTTP host] \ +MF_BOOTSTRAP_HTTP_PORT=[Bootstrap service HTTP port] \ +MF_BOOTSTRAP_HTTP_SERVER_CERT=[Path to HTTP server certificate in pem format] \ +MF_BOOTSTRAP_HTTP_SERVER_KEY=[Path to HTTP server key in pem format] \ MF_BOOTSTRAP_DB_HOST=[Database host address] \ MF_BOOTSTRAP_DB_PORT=[Database host port] \ MF_BOOTSTRAP_DB_USER=[Database user] \ MF_BOOTSTRAP_DB_PASS=[Database password] \ -MF_BOOTSTRAP_DB=[Name of the database used by the service] \ +MF_BOOTSTRAP_DB_NAME=[Name of the database used by the service] \ MF_BOOTSTRAP_DB_SSL_MODE=[SSL mode to connect to the database with] \ MF_BOOTSTRAP_DB_SSL_CERT=[Path to the PEM encoded certificate file] \ MF_BOOTSTRAP_DB_SSL_KEY=[Path to the PEM encoded key file] \ MF_BOOTSTRAP_DB_SSL_ROOT_CERT=[Path to the PEM encoded root certificate file] \ -MF_BOOTSTRAP_ENCRYPT_KEY=[Hex-encoded encryption key used for secure bootstrap] \ -MF_BOOTSTRAP_CLIENT_TLS=[Boolean value to enable/disable client TLS] \ -MF_BOOTSTRAP_CA_CERTS=[Path to trusted CAs in PEM format] \ -MF_BOOTSTRAP_PORT=[Service HTTP port] \ -MF_BOOTSTRAP_SERVER_CERT=[Path to server certificate] \ -MF_BOOTSTRAP_SERVER_KEY=[Path to server key] \ -MF_SDK_BASE_URL=[Base SDK URL for the Mainflux services] \ -MF_SDK_THINGS_PREFIX=[SDK prefix for Things service] \ -MF_JAEGER_URL=[Jaeger server URL] \ MF_AUTH_GRPC_URL=[Users service gRPC URL] \ MF_AUTH_GRPC_TIMEOUT=[Users service gRPC request timeout in seconds] \ +MF_AUTH_GRPC_CLIENT_TLS=[Boolean value to enable/disable client TLS] \ +MF_AUTH_GRPC_CA_CERT=[Path to trusted CAs in PEM format] \ +MF_THINGS_URL=[Base url for Mainflux Things] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_BOOTSTRAP_INSTANCE_ID=[Bootstrap instance ID] \ $GOBIN/mainflux-bootstrap ``` diff --git a/certs/README.md b/certs/README.md index 05493d0540f..7a4eeaab7cc 100644 --- a/certs/README.md +++ b/certs/README.md @@ -1,13 +1,17 @@ # Certs Service + Issues certificates for things. `Certs` service can create certificates to be used when `Mainflux` is deployed to support mTLS. Certificate service can create certificates in two modes: + 1. Development mode - to be used when no PKI is deployed, this works similar to the [make thing_cert](../docker/ssl/Makefile) 2. PKI mode - certificates issued by PKI, when you deploy `Vault` as PKI certificate management `cert` service will proxy requests to `Vault` previously checking access rights and saving info on successfully created certificate. ## Development mode + If `MF_CERTS_VAULT_HOST` is empty than Development mode is on. To issue a certificate: + ```bash TOK=`curl -s --insecure -S -X POST http://localhost/tokens -H 'Content-Type: application/json' -d '{"email":"edge@email.com","password":"12345678"}' | jq -r '.token'` diff --git a/cmd/bootstrap/main.go b/cmd/bootstrap/main.go index 8e948fb09b7..44b678b82aa 100644 --- a/cmd/bootstrap/main.go +++ b/cmd/bootstrap/main.go @@ -10,10 +10,12 @@ import ( "log" "os" + "github.com/go-redis/redis/v8" + "github.com/jmoiron/sqlx" chclient "github.com/mainflux/callhome/pkg/client" "github.com/mainflux/mainflux" - "go.opentelemetry.io/otel/trace" - + "github.com/mainflux/mainflux/bootstrap" + "github.com/mainflux/mainflux/bootstrap/api" bootstrapPg "github.com/mainflux/mainflux/bootstrap/postgres" rediscons "github.com/mainflux/mainflux/bootstrap/redis/consumer" redisprod "github.com/mainflux/mainflux/bootstrap/redis/producer" @@ -31,21 +33,17 @@ import ( mfsdk "github.com/mainflux/mainflux/pkg/sdk/go" "github.com/mainflux/mainflux/pkg/uuid" "github.com/mainflux/mainflux/users/policies" + "go.opentelemetry.io/otel/trace" "golang.org/x/sync/errgroup" - - "github.com/go-redis/redis/v8" - "github.com/jmoiron/sqlx" - "github.com/mainflux/mainflux/bootstrap" - "github.com/mainflux/mainflux/bootstrap/api" ) const ( svcName = "bootstrap" - envPrefix = "MF_BOOTSTRAP_" + envPrefixDB = "MF_BOOTSTRAP_DB_" envPrefixES = "MF_BOOTSTRAP_ES_" - envPrefixHttp = "MF_BOOTSTRAP_HTTP_" + envPrefixHTTP = "MF_BOOTSTRAP_HTTP_" defDB = "bootstrap" - defSvcHttpPort = "9013" + defSvcHTTPPort = "9013" ) type config struct { @@ -72,23 +70,27 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to generate instanceID: %s", err)) + exitCode = 1 + return } } // Create new postgres client dbConfig := pgClient.Config{Name: defDB} - - db, err := pgClient.SetupWithConfig(envPrefix, *bootstrapPg.Migration(), dbConfig) + db, err := pgClient.SetupWithConfig(envPrefixDB, *bootstrapPg.Migration(), dbConfig) if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer db.Close() // Create new redis client for bootstrap event store @@ -101,7 +103,7 @@ func main() { defer esClient.Close() // Create new auth grpc client api - auth, authHandler, err := authClient.Setup(envPrefix, svcName) + auth, authHandler, err := authClient.Setup(svcName) if err != nil { logger.Error(err.Error()) exitCode = 1 @@ -112,10 +114,12 @@ func main() { tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { - logger.Fatal(fmt.Sprintf("failed to init Jaeger: %s", err)) + logger.Error(fmt.Sprintf("failed to init Jaeger: %s", err)) + exitCode = 1 + return } defer func() { - if err := tp.Shutdown(context.Background()); err != nil { + if err := tp.Shutdown(ctx); err != nil { logger.Error(fmt.Sprintf("error shutting down tracer provider: %v", err)) } }() @@ -125,8 +129,8 @@ func main() { svc := newService(auth, db, tracer, logger, esClient, cfg) // Create an new HTTP server - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return @@ -150,9 +154,7 @@ func main() { // Subscribe to things event store thingsESClient, err := redisClient.Setup(envPrefixES) if err != nil { - logger.Error(err.Error()) - exitCode = 1 - return + logger.Fatal(err.Error()) } defer thingsESClient.Close() diff --git a/cmd/cassandra-reader/main.go b/cmd/cassandra-reader/main.go index a21af42c38a..e40cee5d001 100644 --- a/cmd/cassandra-reader/main.go +++ b/cmd/cassandra-reader/main.go @@ -30,9 +30,9 @@ import ( const ( svcName = "cassandra-reader" - envPrefix = "MF_CASSANDRA_READER_" - envPrefixHttp = "MF_CASSANDRA_READER_HTTP_" - defSvcHttpPort = "9003" + envPrefixDB = "MF_CASSANDRA_" + envPrefixHTTP = "MF_CASSANDRA_READER_HTTP_" + defSvcHTTPPort = "9003" ) type config struct { @@ -47,7 +47,6 @@ func main() { // Create cassandra reader service configurations cfg := config{} - if err := env.Parse(&cfg); err != nil { log.Fatalf("failed to load %s service configuration : %s", svcName, err) } @@ -57,36 +56,43 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to generate instanceID: %s", err)) + exitCode = 1 + return } } // Create new thing grpc client - tc, tcHandler, err := thingsClient.Setup(envPrefix) + tc, tcHandler, err := thingsClient.Setup() if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer tcHandler.Close() + logger.Info("Successfully connected to things grpc server " + tcHandler.Secure()) // Create new auth grpc client - auth, authHandler, err := authClient.Setup(envPrefix, svcName) + auth, authHandler, err := authClient.Setup(svcName) if err != nil { logger.Error(err.Error()) exitCode = 1 return } defer authHandler.Close() + logger.Info("Successfully connected to auth grpc server " + authHandler.Secure()) // Create new cassandra client - csdSession, err := cassandraClient.Setup(envPrefix) + csdSession, err := cassandraClient.Setup(envPrefixDB) if err != nil { logger.Error(err.Error()) exitCode = 1 @@ -98,14 +104,12 @@ func main() { repo := newService(csdSession, logger) // Create new http server - httpServerConfig := server.Config{Port: defSvcHttpPort} - - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return } - hs := httpserver.New(ctx, cancel, svcName, httpServerConfig, api.MakeHandler(repo, tc, auth, svcName, instanceID), logger) if cfg.SendTelemetry { diff --git a/cmd/cassandra-writer/main.go b/cmd/cassandra-writer/main.go index e5b68ff402f..7e0c7febbdb 100644 --- a/cmd/cassandra-writer/main.go +++ b/cmd/cassandra-writer/main.go @@ -33,16 +33,16 @@ import ( const ( svcName = "cassandra-writer" - envPrefix = "MF_CASSANDRA_WRITER_" - envPrefixHttp = "MF_CASSANDRA_WRITER_HTTP_" - defSvcHttpPort = "9004" + envPrefixDB = "MF_CASSANDRA_" + envPrefixHTTP = "MF_CASSANDRA_WRITER_HTTP_" + defSvcHTTPPort = "9004" ) type config struct { LogLevel string `env:"MF_CASSANDRA_WRITER_LOG_LEVEL" envDefault:"info"` ConfigPath string `env:"MF_CASSANDRA_WRITER_CONFIG_PATH" envDefault:"/config.toml"` BrokerURL string `env:"MF_BROKER_URL" envDefault:"nats://localhost:4222"` - JaegerURL string `env:"MF_JAEGER_URL" envDefault:"localhost:6831"` + JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` InstanceID string `env:"MF_CASSANDRA_WRITER_INSTANCE_ID" envDefault:""` } @@ -62,26 +62,33 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to generate instanceID: %s", err)) + exitCode = 1 + return } } // Create new to cassandra client - csdSession, err := cassandraClient.SetupDB(envPrefix, cassandra.Table) + csdSession, err := cassandraClient.SetupDB(envPrefixDB, cassandra.Table) if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer csdSession.Close() tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } defer func() { if err := tp.Shutdown(ctx); err != nil { @@ -90,8 +97,8 @@ func main() { }() tracer := tp.Tracer(svcName) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefix, AltPrefix: envPrefixHttp}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return @@ -114,6 +121,8 @@ func main() { // Start new consumer if err := consumers.Start(ctx, svcName, pubSub, repo, cfg.ConfigPath, logger); err != nil { logger.Error(fmt.Sprintf("Failed to create Cassandra writer: %s", err)) + exitCode = 1 + return } // Create new http server diff --git a/cmd/certs/main.go b/cmd/certs/main.go index 200d425558e..ca95b58ebbe 100644 --- a/cmd/certs/main.go +++ b/cmd/certs/main.go @@ -36,10 +36,10 @@ import ( const ( svcName = "certs" - envPrefix = "MF_CERTS_" - envPrefixHttp = "MF_CERTS_HTTP_" + envPrefixDB = "MF_CERTS_DB_" + envPrefixHTTP = "MF_CERTS_HTTP_" defDB = "certs" - defSvcHttpPort = "9019" + defSvcHTTPPort = "9019" ) type config struct { @@ -53,9 +53,6 @@ type config struct { // Sign and issue certificates without 3rd party PKI SignCAPath string `env:"MF_CERTS_SIGN_CA_PATH" envDefault:"ca.crt"` SignCAKeyPath string `env:"MF_CERTS_SIGN_CA_KEY_PATH" envDefault:"ca.key"` - // used in pki mock , need to clean up certs in separate PR - SignRSABits int `env:"MF_CERTS_SIGN_RSA_BITS," envDefault:""` - SignHoursValid string `env:"MF_CERTS_SIGN_HOURS_VALID" envDefault:"2048h"` // 3rd party PKI API access settings PkiHost string `env:"MF_CERTS_VAULT_HOST" envDefault:""` @@ -78,44 +75,56 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to generate instanceID: %s", err)) + exitCode = 1 + return } } if cfg.PkiHost == "" { - logger.Fatal("No host specified for PKI engine") + logger.Error("No host specified for PKI engine") + exitCode = 1 + return } pkiClient, err := vault.NewVaultClient(cfg.PkiToken, cfg.PkiHost, cfg.PkiPath, cfg.PkiRole) if err != nil { - logger.Fatal("failed to configure client for PKI engine") + logger.Error("failed to configure client for PKI engine") + exitCode = 1 + return } dbConfig := pgClient.Config{Name: defDB} - db, err := pgClient.SetupWithConfig(envPrefix, *certsPg.Migration(), dbConfig) + db, err := pgClient.SetupWithConfig(envPrefixDB, *certsPg.Migration(), dbConfig) if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer db.Close() - auth, authHandler, err := authClient.Setup(envPrefix, svcName) + auth, authHandler, err := authClient.Setup(svcName) if err != nil { logger.Error(err.Error()) exitCode = 1 return } defer authHandler.Close() + logger.Info("Successfully connected to auth grpc server " + authHandler.Secure()) tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { - logger.Fatal(fmt.Sprintf("failed to init Jaeger: %s", err)) + logger.Error(fmt.Sprintf("failed to init Jaeger: %s", err)) + exitCode = 1 + return } defer func() { if err := tp.Shutdown(ctx); err != nil { @@ -126,9 +135,11 @@ func main() { svc := newService(auth, db, tracer, logger, cfg, pkiClient) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { - logger.Fatal(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { + logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) + exitCode = 1 + return } hs := httpserver.New(ctx, cancel, svcName, httpServerConfig, api.MakeHandler(svc, logger, instanceID), logger) diff --git a/cmd/coap/main.go b/cmd/coap/main.go index 44bfcafdb3d..3369b28f114 100644 --- a/cmd/coap/main.go +++ b/cmd/coap/main.go @@ -32,14 +32,13 @@ import ( const ( svcName = "coap_adapter" envPrefix = "MF_COAP_ADAPTER_" - envPrefixHttp = "MF_COAP_ADAPTER_HTTP_" - envPrefixCoap = "MF_COAP_ADAPTER_COAP_" - defSvcHttpPort = "5683" - defSvcCoapPort = "5683" + envPrefixHTTP = "MF_COAP_ADAPTER_HTTP_" + defSvcHTTPPort = "5683" + defSvcCoAPPort = "5683" ) type config struct { - LogLevel string `env:"MF_INFLUX_READER_LOG_LEVEL" envDefault:"info"` + LogLevel string `env:"MF_COAP_ADAPTER_LOG_LEVEL" envDefault:"info"` BrokerURL string `env:"MF_BROKER_URL" envDefault:"nats://localhost:4222"` JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` @@ -60,26 +59,32 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to generate instanceID: %s", err)) } } - tc, tcHandler, err := thingsClient.Setup(envPrefix) + tc, tcHandler, err := thingsClient.Setup() if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer tcHandler.Close() + logger.Info("Successfully connected to things grpc server " + tcHandler.Secure()) tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } defer func() { if err := tp.Shutdown(ctx); err != nil { @@ -106,16 +111,16 @@ func main() { counter, latency := internal.MakeMetrics(svcName, "api") svc = api.MetricsMiddleware(svc, counter, latency) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return } hs := httpserver.New(ctx, cancel, svcName, httpServerConfig, api.MakeHandler(instanceID), logger) - coapServerConfig := server.Config{Port: defSvcCoapPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixCoap, AltPrefix: envPrefix}); err != nil { + coapServerConfig := server.Config{Port: defSvcCoAPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefix}); err != nil { logger.Error(fmt.Sprintf("failed to load %s CoAP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/http/main.go b/cmd/http/main.go index 6b3dac9dbc7..128f72d737d 100644 --- a/cmd/http/main.go +++ b/cmd/http/main.go @@ -35,8 +35,7 @@ import ( const ( svcName = "http_adapter" envPrefix = "MF_HTTP_ADAPTER_" - envPrefixHttp = "MF_HTTP_ADAPTER_HTTP_" - defSvcHttpPort = "80" + defSvcHTTPPort = "80" ) type config struct { @@ -61,26 +60,34 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to generate instanceID: %s", err)) + exitCode = 1 + return } } - tc, tcHandler, err := thingsClient.Setup(envPrefix) + tc, tcHandler, err := thingsClient.Setup() if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer tcHandler.Close() + logger.Info("Successfully connected to things grpc server " + tcHandler.Secure()) tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } defer func() { if err := tp.Shutdown(ctx); err != nil { @@ -100,8 +107,8 @@ func main() { svc := newService(pub, tc, logger, tracer) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefix}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/influxdb-reader/main.go b/cmd/influxdb-reader/main.go index 0171126b808..abeedc509c4 100644 --- a/cmd/influxdb-reader/main.go +++ b/cmd/influxdb-reader/main.go @@ -30,11 +30,10 @@ import ( ) const ( - svcName = "influxdb-reader" - envPrefix = "MF_INFLUX_READER_" - envPrefixHttp = "MF_INFLUX_READER_HTTP_" - envPrefixInfluxdb = "MF_INFLUXDB_" - defSvcHttpPort = "9005" + svcName = "influxdb-reader" + envPrefixHTTP = "MF_INFLUX_READER_HTTP_" + envPrefixDB = "MF_INFLUXDB_" + defSvcHTTPPort = "9005" ) type config struct { @@ -57,34 +56,41 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to generate instanceID: %s", err)) + exitCode = 1 + return } } - tc, tcHandler, err := thingsClient.Setup(envPrefix) + tc, tcHandler, err := thingsClient.Setup() if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer tcHandler.Close() + logger.Info("Successfully connected to things grpc server " + tcHandler.Secure()) - auth, authHandler, err := authClient.Setup(envPrefix, svcName) + auth, authHandler, err := authClient.Setup(svcName) if err != nil { logger.Error(err.Error()) exitCode = 1 return } defer authHandler.Close() + logger.Info("Successfully connected to auth grpc server " + authHandler.Secure()) influxDBConfig := influxDBClient.Config{} - if err := env.Parse(&influxDBConfig, env.Options{Prefix: envPrefixInfluxdb}); err != nil { + if err := env.Parse(&influxDBConfig, env.Options{Prefix: envPrefixDB}); err != nil { logger.Error(fmt.Sprintf("failed to load InfluxDB client configuration from environment variable : %s", err)) exitCode = 1 return @@ -96,7 +102,7 @@ func main() { Org: influxDBConfig.Org, } - client, err := influxDBClient.Connect(influxDBConfig, ctx) + client, err := influxDBClient.Connect(ctx, influxDBConfig) if err != nil { logger.Error(fmt.Sprintf("failed to connect to InfluxDB : %s", err)) exitCode = 1 @@ -106,8 +112,8 @@ func main() { repo := newService(client, repocfg, logger) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/influxdb-writer/main.go b/cmd/influxdb-writer/main.go index f6d5405323a..3bb21c7b31c 100644 --- a/cmd/influxdb-writer/main.go +++ b/cmd/influxdb-writer/main.go @@ -29,18 +29,17 @@ import ( ) const ( - svcName = "influxdb-writer" - envPrefix = "MF_INFLUX_WRITER_" - envPrefixHttp = "MF_INFLUX_WRITER_HTTP_" - envPrefixInfluxdb = "MF_INFLUXDB_" - defSvcHttpPort = "9006" + svcName = "influxdb-writer" + envPrefixHTTP = "MF_INFLUX_WRITER_HTTP_" + envPrefixDB = "MF_INFLUXDB_" + defSvcHTTPPort = "9006" ) type config struct { LogLevel string `env:"MF_INFLUX_WRITER_LOG_LEVEL" envDefault:"info"` ConfigPath string `env:"MF_INFLUX_WRITER_CONFIG_PATH" envDefault:"/config.toml"` BrokerURL string `env:"MF_BROKER_URL" envDefault:"nats://localhost:4222"` - JaegerURL string `env:"MF_JAEGER_URL" envDefault:"localhost:6831"` + JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` InstanceID string `env:"MF_INFLUX_WRITER_INSTANCE_ID" envDefault:""` } @@ -59,20 +58,26 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to generate instanceID: %s", err)) + exitCode = 1 + return } } tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) + defer func() { if err := tp.Shutdown(ctx); err != nil { logger.Error(fmt.Sprintf("Error shutting down tracer provider: %v", err)) @@ -90,7 +95,7 @@ func main() { defer pubSub.Close() influxDBConfig := influxDBClient.Config{} - if err := env.Parse(&influxDBConfig, env.Options{Prefix: envPrefixInfluxdb}); err != nil { + if err := env.Parse(&influxDBConfig, env.Options{Prefix: envPrefixDB}); err != nil { logger.Error(fmt.Sprintf("failed to load InfluxDB client configuration from environment variable : %s", err)) exitCode = 1 return @@ -102,7 +107,7 @@ func main() { Org: influxDBConfig.Org, } - client, err := influxDBClient.Connect(influxDBConfig, ctx) + client, err := influxDBClient.Connect(ctx, influxDBConfig) if err != nil { logger.Error(fmt.Sprintf("failed to connect to InfluxDB : %s", err)) exitCode = 1 @@ -110,8 +115,8 @@ func main() { } defer client.Close() - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/lora/main.go b/cmd/lora/main.go index 6a015cb3a26..3ff372fafbd 100644 --- a/cmd/lora/main.go +++ b/cmd/lora/main.go @@ -36,11 +36,10 @@ import ( const ( svcName = "lora-adapter" - envPrefix = "MF_LORA_ADAPTER_" - envPrefixHttp = "MF_LORA_ADAPTER_HTTP_" + envPrefixHTTP = "MF_LORA_ADAPTER_HTTP_" envPrefixRouteMap = "MF_LORA_ADAPTER_ROUTE_MAP_" envPrefixThingsES = "MF_THINGS_ES_" - defSvcHttpPort = "9017" + defSvcHTTPPort = "9017" thingsRMPrefix = "thing" channelsRMPrefix = "channel" @@ -48,7 +47,7 @@ const ( ) type config struct { - LogLevel string `env:"MF_BOOTSTRAP_LOG_LEVEL" envDefault:"info"` + LogLevel string `env:"MF_LORA_ADAPTER_LOG_LEVEL" envDefault:"info"` LoraMsgURL string `env:"MF_LORA_ADAPTER_MESSAGES_URL" envDefault:"tcp://localhost:1883"` LoraMsgUser string `env:"MF_LORA_ADAPTER_MESSAGES_USER" envDefault:""` LoraMsgPass string `env:"MF_LORA_ADAPTER_MESSAGES_PASS" envDefault:""` @@ -56,7 +55,7 @@ type config struct { LoraMsgTimeout time.Duration `env:"MF_LORA_ADAPTER_MESSAGES_TIMEOUT" envDefault:"30s"` ESConsumerName string `env:"MF_LORA_ADAPTER_EVENT_CONSUMER" envDefault:"lora"` BrokerURL string `env:"MF_BROKER_URL" envDefault:"nats://localhost:4222"` - JaegerURL string `env:"MF_JAEGER_URL" envDefault:"localhost:6831"` + JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` InstanceID string `env:"MF_LORA_ADAPTER_INSTANCE_ID" envDefault:""` } @@ -75,25 +74,32 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to generate instanceID: %s", err)) + exitCode = 1 + return } } rmConn, err := redisClient.Setup(envPrefixRouteMap) if err != nil { - logger.Fatal(fmt.Sprintf("failed to setup route map redis client : %s", err)) + logger.Error(fmt.Sprintf("failed to setup route map redis client : %s", err)) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer rmConn.Close() tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } defer func() { if err := tp.Shutdown(ctx); err != nil { @@ -131,10 +137,11 @@ func main() { g.Go(func() error { return subscribeToLoRaBroker(svc, mqttConn, cfg.LoraMsgTimeout, cfg.LoraMsgTopic, logger) }) + go subscribeToThingsES(svc, esConn, cfg.ESConsumerName, logger) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/mongodb-reader/main.go b/cmd/mongodb-reader/main.go index 57744ed0110..da718e9197a 100644 --- a/cmd/mongodb-reader/main.go +++ b/cmd/mongodb-reader/main.go @@ -30,15 +30,14 @@ import ( const ( svcName = "mongodb-reader" - envPrefix = "MF_MONGO_READER_" - envPrefixDB = "MF_MONGO_READER_DB_" - envPrefixHttp = "MF_MONGO_READER_HTTP_" - defSvcHttpPort = "9007" + envPrefixDB = "MF_MONGO_" + envPrefixHTTP = "MF_MONGO_READER_HTTP_" + defSvcHTTPPort = "9007" ) type config struct { - LogLevel string `env:"MF_MONGO_READER_LOG_LEVEL" envDefault:"info"` - SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` + LogLevel string `env:"MF_MONGO_READER_LOG_LEVEL" envDefault:"info"` + SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` InstanceID string `env:"MF_MONGO_READER_INSTANCE_ID" envDefault:""` } @@ -56,41 +55,50 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to generate instanceID: %s", err)) + exitCode = 1 + return } } db, err := mongoClient.Setup(envPrefixDB) if err != nil { - logger.Fatal(fmt.Sprintf("failed to setup mongo database : %s", err)) + logger.Error(fmt.Sprintf("failed to setup mongo database : %s", err)) + exitCode = 1 + return } repo := newService(db, logger) - tc, tcHandler, err := thingsClient.Setup(envPrefix) + tc, tcHandler, err := thingsClient.Setup() if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer tcHandler.Close() + logger.Info("Successfully connected to things grpc server " + tcHandler.Secure()) - auth, authHandler, err := authClient.Setup(envPrefix, svcName) + auth, authHandler, err := authClient.Setup(svcName) if err != nil { logger.Fatal(err.Error()) exitCode = 1 return } defer authHandler.Close() + logger.Info("Successfully connected to auth grpc server " + authHandler.Secure()) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/mongodb-writer/main.go b/cmd/mongodb-writer/main.go index 9c1a66f5088..529a7acd337 100644 --- a/cmd/mongodb-writer/main.go +++ b/cmd/mongodb-writer/main.go @@ -32,17 +32,16 @@ import ( const ( svcName = "mongodb-writer" - envPrefix = "MF_MONGO_WRITER_" - envPrefixDB = "MF_MONGO_WRITER_DB_" - envPrefixHttp = "MF_MONGO_WRITER_HTTP_" - defSvcHttpPort = "9008" + envPrefixDB = "MF_MONGO_" + envPrefixHTTP = "MF_MONGO_WRITER_HTTP_" + defSvcHTTPPort = "9008" ) type config struct { LogLevel string `env:"MF_MONGO_WRITER_LOG_LEVEL" envDefault:"info"` ConfigPath string `env:"MF_MONGO_WRITER_CONFIG_PATH" envDefault:"/config.toml"` BrokerURL string `env:"MF_BROKER_URL" envDefault:"nats://localhost:4222"` - JaegerURL string `env:"MF_JAEGER_URL" envDefault:"localhost:6831"` + JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` InstanceID string `env:"MF_MONGO_WRITER_INSTANCE_ID" envDefault:""` } @@ -61,20 +60,25 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to generate instanceID: %s", err)) + exitCode = 1 + return } } tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer func() { if err := tp.Shutdown(ctx); err != nil { logger.Error(fmt.Sprintf("Error shutting down tracer provider: %v", err)) @@ -98,8 +102,8 @@ func main() { return } - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/mqtt/main.go b/cmd/mqtt/main.go index 463f802582e..931b7827fec 100644 --- a/cmd/mqtt/main.go +++ b/cmd/mqtt/main.go @@ -37,23 +37,21 @@ import ( ) const ( - svcName = "mqtt" - envPrefix = "MF_MQTT_ADAPTER_" - envPrefixES = "MF_MQTT_ADAPTER_ES_" - envPrefixAuthCache = "MF_AUTH_CACHE_" + svcName = "mqtt" + envPrefixES = "MF_MQTT_ADAPTER_ES_" ) type config struct { LogLevel string `env:"MF_MQTT_ADAPTER_LOG_LEVEL" envDefault:"info"` - MqttPort string `env:"MF_MQTT_ADAPTER_MQTT_PORT" envDefault:"1883"` - MqttTargetHost string `env:"MF_MQTT_ADAPTER_MQTT_TARGET_HOST" envDefault:"localhost"` - MqttTargetPort string `env:"MF_MQTT_ADAPTER_MQTT_TARGET_PORT" envDefault:"1883"` - MqttForwarderTimeout time.Duration `env:"MF_MQTT_ADAPTER_FORWARDER_TIMEOUT" envDefault:"30s"` - MqttTargetHealthCheck string `env:"MF_MQTT_ADAPTER_MQTT_TARGET_HEALTH_CHECK" envDefault:""` - HttpPort string `env:"MF_MQTT_ADAPTER_WS_PORT" envDefault:"8080"` - HttpTargetHost string `env:"MF_MQTT_ADAPTER_WS_TARGET_HOST" envDefault:"localhost"` - HttpTargetPort string `env:"MF_MQTT_ADAPTER_WS_TARGET_PORT" envDefault:"8080"` - HttpTargetPath string `env:"MF_MQTT_ADAPTER_WS_TARGET_PATH" envDefault:"/mqtt"` + MQTTPort string `env:"MF_MQTT_ADAPTER_MQTT_PORT" envDefault:"1883"` + MQTTTargetHost string `env:"MF_MQTT_ADAPTER_MQTT_TARGET_HOST" envDefault:"localhost"` + MQTTTargetPort string `env:"MF_MQTT_ADAPTER_MQTT_TARGET_PORT" envDefault:"1883"` + MQTTForwarderTimeout time.Duration `env:"MF_MQTT_ADAPTER_FORWARDER_TIMEOUT" envDefault:"30s"` + MQTTTargetHealthCheck string `env:"MF_MQTT_ADAPTER_MQTT_TARGET_HEALTH_CHECK" envDefault:""` + HTTPPort string `env:"MF_MQTT_ADAPTER_WS_PORT" envDefault:"8080"` + HTTPTargetHost string `env:"MF_MQTT_ADAPTER_WS_TARGET_HOST" envDefault:"localhost"` + HTTPTargetPort string `env:"MF_MQTT_ADAPTER_WS_TARGET_PORT" envDefault:"8080"` + HTTPTargetPath string `env:"MF_MQTT_ADAPTER_WS_TARGET_PATH" envDefault:"/mqtt"` Instance string `env:"MF_MQTT_ADAPTER_INSTANCE" envDefault:""` JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` BrokerURL string `env:"MF_BROKER_URL" envDefault:"nats://localhost:4222"` @@ -75,31 +73,38 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to generate instanceID: %s", err)) + exitCode = 1 + return } } - if cfg.MqttTargetHealthCheck != "" { + if cfg.MQTTTargetHealthCheck != "" { notify := func(e error, next time.Duration) { logger.Info(fmt.Sprintf("Broker not ready: %s, next try in %s", e.Error(), next)) } err := backoff.RetryNotify(healthcheck(cfg), backoff.NewExponentialBackOff(), notify) if err != nil { - logger.Fatal(fmt.Sprintf("MQTT healthcheck limit exceeded, exiting. %s ", err)) + logger.Error(fmt.Sprintf("MQTT healthcheck limit exceeded, exiting. %s ", err)) + exitCode = 1 + return } } tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer func() { if err := tp.Shutdown(ctx); err != nil { logger.Error(fmt.Sprintf("Error shutting down tracer provider: %v", err)) @@ -116,7 +121,7 @@ func main() { nps = tracing.NewPubSub(tracer, nps) defer nps.Close() - mpub, err := mqttpub.NewPublisher(fmt.Sprintf("%s:%s", cfg.MqttTargetHost, cfg.MqttTargetPort), cfg.MqttForwarderTimeout) + mpub, err := mqttpub.NewPublisher(fmt.Sprintf("%s:%s", cfg.MQTTTargetHost, cfg.MQTTTargetPort), cfg.MQTTForwarderTimeout) if err != nil { logger.Error(fmt.Sprintf("failed to create MQTT publisher: %s", err)) exitCode = 1 @@ -151,21 +156,14 @@ func main() { es := mqttredis.NewEventStore(ec, cfg.Instance) - ac, err := redisClient.Setup(envPrefixAuthCache) - if err != nil { - logger.Error(fmt.Sprintf("failed to setup %s event store redis client : %s", svcName, err)) - exitCode = 1 - return - } - defer ac.Close() - - tc, tcHandler, err := thingsClient.Setup(envPrefix) + tc, tcHandler, err := thingsClient.Setup() if err != nil { logger.Error(err.Error()) exitCode = 1 return } defer tcHandler.Close() + logger.Info("Successfully connected to things grpc server " + tcHandler.Secure()) h := mqtt.NewHandler([]messaging.Publisher{np}, es, logger, tc) @@ -176,12 +174,12 @@ func main() { go chc.CallHome(ctx) } - logger.Info(fmt.Sprintf("Starting MQTT proxy on port %s", cfg.MqttPort)) + logger.Info(fmt.Sprintf("Starting MQTT proxy on port %s", cfg.MQTTPort)) g.Go(func() error { return proxyMQTT(ctx, cfg, logger, h) }) - logger.Info(fmt.Sprintf("Starting MQTT over WS proxy on port %s", cfg.HttpPort)) + logger.Info(fmt.Sprintf("Starting MQTT over WS proxy on port %s", cfg.HTTPPort)) g.Go(func() error { return proxyWS(ctx, cfg, logger, h) }) @@ -200,8 +198,8 @@ func main() { } func proxyMQTT(ctx context.Context, cfg config, logger mflog.Logger, handler session.Handler) error { - address := fmt.Sprintf(":%s", cfg.MqttPort) - target := fmt.Sprintf("%s:%s", cfg.MqttTargetHost, cfg.MqttTargetPort) + address := fmt.Sprintf(":%s", cfg.MQTTPort) + target := fmt.Sprintf("%s:%s", cfg.MQTTTargetHost, cfg.MQTTTargetPort) mp := mp.New(address, target, handler, logger) errCh := make(chan error) @@ -219,14 +217,14 @@ func proxyMQTT(ctx context.Context, cfg config, logger mflog.Logger, handler ses } func proxyWS(ctx context.Context, cfg config, logger mflog.Logger, handler session.Handler) error { - target := fmt.Sprintf("%s:%s", cfg.HttpTargetHost, cfg.HttpTargetPort) - wp := ws.New(target, cfg.HttpTargetPath, "ws", handler, logger) + target := fmt.Sprintf("%s:%s", cfg.HTTPTargetHost, cfg.HTTPTargetPort) + wp := ws.New(target, cfg.HTTPTargetPath, "ws", handler, logger) http.Handle("/mqtt", wp.Handler()) errCh := make(chan error) go func() { - errCh <- wp.Listen(cfg.HttpPort) + errCh <- wp.Listen(cfg.HTTPPort) }() select { @@ -240,7 +238,7 @@ func proxyWS(ctx context.Context, cfg config, logger mflog.Logger, handler sessi func healthcheck(cfg config) func() error { return func() error { - res, err := http.Get(cfg.MqttTargetHealthCheck) + res, err := http.Get(cfg.MQTTTargetHealthCheck) if err != nil { return err } diff --git a/cmd/opcua/main.go b/cmd/opcua/main.go index a50f3c0b5b5..cb5a7357c32 100644 --- a/cmd/opcua/main.go +++ b/cmd/opcua/main.go @@ -33,11 +33,10 @@ import ( const ( svcName = "opc-ua-adapter" - envPrefix = "MF_OPCUA_ADAPTER_" envPrefixES = "MF_OPCUA_ADAPTER_ES_" - envPrefixHttp = "MF_OPCUA_ADAPTER_HTTP_" + envPrefixHTTP = "MF_OPCUA_ADAPTER_HTTP_" envPrefixRouteMap = "MF_OPCUA_ADAPTER_ROUTE_MAP_" - defSvcHttpPort = "8180" + defSvcHTTPPort = "8180" thingsRMPrefix = "thing" channelsRMPrefix = "channel" @@ -48,7 +47,7 @@ type config struct { LogLevel string `env:"MF_OPCUA_ADAPTER_LOG_LEVEL" envDefault:"info"` ESConsumerName string `env:"MF_OPCUA_ADAPTER_EVENT_CONSUMER" envDefault:""` BrokerURL string `env:"MF_BROKER_URL" envDefault:"nats://localhost:4222"` - JaegerURL string `env:"MF_JAEGER_URL" envDefault:"localhost:6831"` + JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` InstanceID string `env:"MF_OPCUA_ADAPTER_INSTANCE_ID" envDefault:""` } @@ -72,17 +71,24 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } } rmConn, err := redisClient.Setup(envPrefixRouteMap) if err != nil { - logger.Fatal(fmt.Sprintf("failed to setup %s bootstrap event store redis client : %s", svcName, err)) + logger.Error(fmt.Sprintf("failed to setup %s bootstrap event store redis client : %s", svcName, err)) + exitCode = 1 + return } defer rmConn.Close() @@ -92,15 +98,17 @@ func main() { esConn, err := redisClient.Setup(envPrefixES) if err != nil { - logger.Fatal(fmt.Sprintf("failed to setup %s bootstrap event store redis client : %s", svcName, err)) + logger.Error(fmt.Sprintf("failed to setup %s bootstrap event store redis client : %s", svcName, err)) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer esConn.Close() tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } defer func() { if err := tp.Shutdown(ctx); err != nil { @@ -126,8 +134,8 @@ func main() { go subscribeToStoredSubs(ctx, sub, opcConfig, logger) go subscribeToThingsES(ctx, svc, esConn, cfg.ESConsumerName, logger) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/postgres-reader/main.go b/cmd/postgres-reader/main.go index 2cc269fb1f4..da5844604cf 100644 --- a/cmd/postgres-reader/main.go +++ b/cmd/postgres-reader/main.go @@ -30,10 +30,10 @@ import ( const ( svcName = "postgres-reader" - envPrefix = "MF_POSTGRES_READER_" - envPrefixHttp = "MF_POSTGRES_READER_HTTP_" + envPrefixDB = "MF_POSTGRES_" + envPrefixHTTP = "MF_POSTGRES_READER_HTTP_" defDB = "messages" - defSvcHttpPort = "9009" + defSvcHTTPPort = "9009" ) type config struct { @@ -56,35 +56,41 @@ func main() { log.Fatalf("failed to init logger: %s", err) } - tc, tcHandler, err := thingsClient.Setup(envPrefix) - if err != nil { - logger.Fatal(err.Error()) - } + var exitCode int + defer mflog.ExitWithError(&exitCode) instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } } - var exitCode int - defer mflog.ExitWithError(&exitCode) + tc, tcHandler, err := thingsClient.Setup() + if err != nil { + logger.Error(err.Error()) + exitCode = 1 + return + } defer tcHandler.Close() + logger.Info("Successfully connected to things grpc server " + tcHandler.Secure()) - auth, authHandler, err := authClient.Setup(envPrefix, svcName) + auth, authHandler, err := authClient.Setup(svcName) if err != nil { logger.Error(err.Error()) exitCode = 1 return } defer authHandler.Close() + logger.Info("Successfully connected to auth grpc server " + authHandler.Secure()) dbConfig := pgClient.Config{Name: defDB} - if err := dbConfig.LoadEnv(envPrefix); err != nil { + if err := dbConfig.LoadEnv(envPrefixDB); err != nil { logger.Error(err.Error()) exitCode = 1 return @@ -99,8 +105,8 @@ func main() { repo := newService(db, logger) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/postgres-writer/main.go b/cmd/postgres-writer/main.go index c661a59ec4d..14a6a9e1f46 100644 --- a/cmd/postgres-writer/main.go +++ b/cmd/postgres-writer/main.go @@ -32,17 +32,17 @@ import ( const ( svcName = "postgres-writer" - envPrefix = "MF_POSTGRES_WRITER_" - envPrefixHttp = "MF_POSTGRES_WRITER_HTTP_" + envPrefixDB = "MF_POSTGRES_" + envPrefixHTTP = "MF_POSTGRES_WRITER_HTTP_" defDB = "messages" - defSvcHttpPort = "9010" + defSvcHTTPPort = "9010" ) type config struct { LogLevel string `env:"MF_POSTGRES_WRITER_LOG_LEVEL" envDefault:"info"` ConfigPath string `env:"MF_POSTGRES_WRITER_CONFIG_PATH" envDefault:"/config.toml"` BrokerURL string `env:"MF_BROKER_URL" envDefault:"nats://localhost:4222"` - JaegerURL string `env:"MF_JAEGER_URL" envDefault:"localhost:6831"` + JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` InstanceID string `env:"MF_POSTGRES_WRITER_INSTANCE_ID" envDefault:""` } @@ -61,20 +61,25 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } } tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer func() { if err := tp.Shutdown(ctx); err != nil { logger.Error(fmt.Sprintf("Error shutting down tracer provider: %v", err)) @@ -92,7 +97,7 @@ func main() { defer pubSub.Close() dbConfig := pgClient.Config{Name: defDB} - db, err := pgClient.SetupWithConfig(envPrefix, *writerPg.Migration(), dbConfig) + db, err := pgClient.SetupWithConfig(envPrefixDB, *writerPg.Migration(), dbConfig) if err != nil { logger.Error(err.Error()) exitCode = 1 @@ -100,8 +105,8 @@ func main() { } defer db.Close() - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/provision/main.go b/cmd/provision/main.go index 8325b06164d..cf5f745adc5 100644 --- a/cmd/provision/main.go +++ b/cmd/provision/main.go @@ -17,7 +17,7 @@ import ( "github.com/mainflux/mainflux" "github.com/mainflux/mainflux/internal/server" httpserver "github.com/mainflux/mainflux/internal/server/http" - "github.com/mainflux/mainflux/logger" + mflog "github.com/mainflux/mainflux/logger" mfclients "github.com/mainflux/mainflux/pkg/clients" "github.com/mainflux/mainflux/pkg/errors" mfgroups "github.com/mainflux/mainflux/pkg/groups" @@ -97,16 +97,21 @@ func main() { if err != nil { log.Fatalf(err.Error()) } - logger, err := logger.New(os.Stdout, cfg.Server.LogLevel) + logger, err := mflog.New(os.Stdout, cfg.Server.LogLevel) if err != nil { log.Fatalf(err.Error()) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := mainflux.Env(envInstanceID, defInstanceID) if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } } diff --git a/cmd/smpp-notifier/main.go b/cmd/smpp-notifier/main.go index 9ac962542b7..47c33142763 100644 --- a/cmd/smpp-notifier/main.go +++ b/cmd/smpp-notifier/main.go @@ -39,10 +39,10 @@ import ( const ( svcName = "smpp-notifier" - envPrefix = "MF_SMPP_NOTIFIER_" - envPrefixHttp = "MF_SMPP_NOTIFIER_HTTP_" + envPrefixDB = "MF_SMPP_NOTIFIER_DB_" + envPrefixHTTP = "MF_SMPP_NOTIFIER_HTTP_" defDB = "subscriptions" - defSvcHttpPort = "9014" + defSvcHTTPPort = "9014" ) type config struct { @@ -69,21 +69,24 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } } dbConfig := pgClient.Config{Name: defDB} - db, err := pgClient.SetupWithConfig(envPrefix, *notifierPg.Migration(), dbConfig) + db, err := pgClient.SetupWithConfig(envPrefixDB, *notifierPg.Migration(), dbConfig) if err != nil { logger.Fatal(err.Error()) } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer db.Close() smppConfig := mfsmpp.Config{} @@ -96,6 +99,8 @@ func main() { tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } defer func() { if err := tp.Shutdown(ctx); err != nil { @@ -113,7 +118,7 @@ func main() { pubSub = pstracing.NewPubSub(tracer, pubSub) defer pubSub.Close() - auth, authHandler, err := authClient.Setup(envPrefix, svcName) + auth, authHandler, err := authClient.Setup(svcName) if err != nil { logger.Error(err.Error()) exitCode = 1 @@ -129,8 +134,8 @@ func main() { return } - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/smtp-notifier/main.go b/cmd/smtp-notifier/main.go index 2d63d3cf3fb..3606bd048b3 100644 --- a/cmd/smtp-notifier/main.go +++ b/cmd/smtp-notifier/main.go @@ -40,10 +40,10 @@ import ( const ( svcName = "smtp-notifier" - envPrefix = "MF_SMTP_NOTIFIER_" - envPrefixHttp = "MF_SMTP_NOTIFIER_HTTP_" + envPrefixDB = "MF_SMTP_NOTIFIER_DB_" + envPrefixHTTP = "MF_SMTP_NOTIFIER_HTTP_" defDB = "subscriptions" - defSvcHttpPort = "9015" + defSvcHTTPPort = "9015" ) type config struct { @@ -70,21 +70,26 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } } dbConfig := pgClient.Config{Name: defDB} - db, err := pgClient.SetupWithConfig(envPrefix, *notifierPg.Migration(), dbConfig) + db, err := pgClient.SetupWithConfig(envPrefixDB, *notifierPg.Migration(), dbConfig) if err != nil { logger.Fatal(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer db.Close() ec := email.Config{} @@ -116,13 +121,14 @@ func main() { pubSub = pstracing.NewPubSub(tracer, pubSub) defer pubSub.Close() - auth, authHandler, err := authClient.Setup(envPrefix, svcName) + auth, authHandler, err := authClient.Setup(svcName) if err != nil { logger.Error(err.Error()) exitCode = 1 return } defer authHandler.Close() + logger.Info("Successfully connected to auth grpc server " + authHandler.Secure()) svc, err := newService(db, tracer, auth, cfg, ec, logger) @@ -138,8 +144,8 @@ func main() { return } - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/things/main.go b/cmd/things/main.go index 0d4258f7c71..d6a5c0c628f 100644 --- a/cmd/things/main.go +++ b/cmd/things/main.go @@ -56,14 +56,14 @@ import ( const ( svcName = "things" - envPrefix = "MF_THINGS_" + envPrefixDB = "MF_THINGS_DB_" envPrefixCache = "MF_THINGS_CACHE_" envPrefixES = "MF_THINGS_ES_" - envPrefixHttp = "MF_THINGS_HTTP_" - envPrefixAuthGrpc = "MF_THINGS_AUTH_GRPC_" + envPrefixHTTP = "MF_THINGS_HTTP_" + envPrefixGRPC = "MF_THINGS_GRPC_" defDB = "things" - defSvcHttpPort = "9000" - defSvcAuthGrpcPort = "7000" + defSvcHTTPPort = "9000" + defSvcAuthGRPCPort = "7000" ) type config struct { @@ -91,27 +91,34 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } } // Create new database for things dbConfig := pgClient.Config{Name: defDB} - db, err := pgClient.SetupWithConfig(envPrefix, *thingsPg.Migration(), dbConfig) + db, err := pgClient.SetupWithConfig(envPrefixDB, *thingsPg.Migration(), dbConfig) if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer db.Close() tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } defer func() { if err := tp.Shutdown(ctx); err != nil { @@ -144,7 +151,7 @@ func main() { auth = localusers.NewAuthService(cfg.StandaloneID, cfg.StandaloneToken) logger.Info("Using standalone auth service") default: - authServiceClient, authHandler, err := authClient.Setup(envPrefix, svcName) + authServiceClient, authHandler, err := authClient.Setup(svcName) if err != nil { logger.Error(err.Error()) exitCode = 1 @@ -157,8 +164,8 @@ func main() { csvc, gsvc, psvc := newService(db, auth, cacheClient, esClient, cfg.CacheKeyDuration, tracer, logger) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s gRPC server configuration : %s", svcName, err)) exitCode = 1 return @@ -172,8 +179,8 @@ func main() { reflection.Register(srv) tpolicies.RegisterAuthServiceServer(srv, grpcapi.NewServer(csvc, psvc)) } - grpcServerConfig := server.Config{Port: defSvcAuthGrpcPort} - if err := env.Parse(&grpcServerConfig, env.Options{Prefix: envPrefixAuthGrpc, AltPrefix: envPrefix}); err != nil { + grpcServerConfig := server.Config{Port: defSvcAuthGRPCPort} + if err := env.Parse(&grpcServerConfig, env.Options{Prefix: envPrefixGRPC}); err != nil { logger.Error(fmt.Sprintf("failed to load %s gRPC server configuration : %s", svcName, err)) exitCode = 1 return @@ -189,6 +196,7 @@ func main() { g.Go(func() error { return hsp.Start() }) + g.Go(func() error { return gs.Start() }) diff --git a/cmd/timescale-reader/main.go b/cmd/timescale-reader/main.go index 0a1d1a250d3..25e897e49bf 100644 --- a/cmd/timescale-reader/main.go +++ b/cmd/timescale-reader/main.go @@ -30,10 +30,10 @@ import ( const ( svcName = "timescaledb-reader" - envPrefix = "MF_TIMESCALE_READER_" - envPrefixHttp = "MF_TIMESCALE_READER_HTTP_" + envPrefixDB = "MF_TIMESCALE_" + envPrefixHTTP = "MF_TIMESCALE_READER_HTTP_" defDB = "messages" - defSvcHttpPort = "9011" + defSvcHTTPPort = "9011" ) type config struct { @@ -56,48 +56,55 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } } dbConfig := pgClient.Config{Name: defDB} - if err := dbConfig.LoadEnv(envPrefix); err != nil { - logger.Fatal(err.Error()) + if err := dbConfig.LoadEnv(envPrefixDB); err != nil { + logger.Error(err.Error()) + exitCode = 1 + return } db, err := pgClient.Connect(dbConfig) if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer db.Close() repo := newService(db, logger) - auth, authHandler, err := authClient.Setup(envPrefix, svcName) + auth, authHandler, err := authClient.Setup(svcName) if err != nil { logger.Error(err.Error()) exitCode = 1 return } defer authHandler.Close() + logger.Info("Successfully connected to auth grpc server " + authHandler.Secure()) - tc, tcHandler, err := thingsClient.Setup(envPrefix) + tc, tcHandler, err := thingsClient.Setup() if err != nil { logger.Error(err.Error()) exitCode = 1 return } defer tcHandler.Close() + logger.Info("Successfully connected to things grpc server " + tcHandler.Secure()) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/timescale-writer/main.go b/cmd/timescale-writer/main.go index 4d218857fb0..a396316dfef 100644 --- a/cmd/timescale-writer/main.go +++ b/cmd/timescale-writer/main.go @@ -33,17 +33,17 @@ import ( const ( svcName = "timescaledb-writer" - envPrefix = "MF_TIMESCALE_WRITER_" - envPrefixHttp = "MF_TIMESCALE_WRITER_HTTP_" + envPrefixDB = "MF_TIMESCALE_" + envPrefixHTTP = "MF_TIMESCALE_WRITER_HTTP_" defDB = "messages" - defSvcHttpPort = "9012" + defSvcHTTPPort = "9012" ) type config struct { LogLevel string `env:"MF_TIMESCALE_WRITER_LOG_LEVEL" envDefault:"info"` ConfigPath string `env:"MF_TIMESCALE_WRITER_CONFIG_PATH" envDefault:"/config.toml"` BrokerURL string `env:"MF_BROKER_URL" envDefault:"nats://localhost:4222"` - JaegerURL string `env:"MF_JAEGER_URL" envDefault:"localhost:6831"` + JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` InstanceID string `env:"MF_TIMESCALE_WRITER_INSTANCE_ID" envDefault:""` } @@ -62,26 +62,33 @@ func main() { log.Fatal(err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } } dbConfig := pgClient.Config{Name: defDB} - db, err := pgClient.SetupWithConfig(envPrefix, *timescale.Migration(), dbConfig) + db, err := pgClient.SetupWithConfig(envPrefixDB, *timescale.Migration(), dbConfig) if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer db.Close() tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) if err != nil { logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } defer func() { if err := tp.Shutdown(ctx); err != nil { @@ -90,8 +97,8 @@ func main() { }() tracer := tp.Tracer(svcName) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/twins/main.go b/cmd/twins/main.go index 9d08cff8743..c3ffecf67d9 100644 --- a/cmd/twins/main.go +++ b/cmd/twins/main.go @@ -42,11 +42,11 @@ import ( const ( svcName = "twins" queue = "twins" - envPrefix = "MF_TWINS_" - envPrefixHttp = "MF_TWINS_HTTP_" + envPrefixDB = "MF_TWINS_DB_" + envPrefixHTTP = "MF_TWINS_HTTP_" envPrefixCache = "MF_TWINS_CACHE_" envPrefixES = "MF_TWINS_ES_" - defSvcHttpPort = "9018" + defSvcHTTPPort = "9018" ) type config struct { @@ -74,30 +74,37 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } } cacheClient, err := redisClient.Setup(envPrefixCache) if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer cacheClient.Close() // Setup new redis event store client esClient, err := redisClient.Setup(envPrefixES) if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } defer esClient.Close() - db, err := mongoClient.Setup(envPrefix) + db, err := mongoClient.Setup(envPrefixDB) if err != nil { logger.Error(fmt.Sprintf("failed to setup postgres database : %s", err)) exitCode = 1 @@ -122,7 +129,7 @@ func main() { case true: auth = localusers.NewAuthService(cfg.StandaloneID, cfg.StandaloneToken) default: - authServiceClient, authHandler, err := authClient.Setup(envPrefix, svcName) + authServiceClient, authHandler, err := authClient.Setup(svcName) if err != nil { logger.Error(err.Error()) exitCode = 1 @@ -144,8 +151,8 @@ func main() { svc := newService(ctx, svcName, pubSub, cfg.ChannelID, auth, tracer, db, cacheClient, esClient, logger) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/cmd/users/main.go b/cmd/users/main.go index bedc4dd1d2c..a32bda5332e 100644 --- a/cmd/users/main.go +++ b/cmd/users/main.go @@ -54,12 +54,12 @@ import ( const ( svcName = "users" - envPrefix = "MF_USERS_" - envPrefixHttp = "MF_USERS_HTTP_" + envPrefixDB = "MF_USERS_DB_" + envPrefixHTTP = "MF_USERS_HTTP_" envPrefixGrpc = "MF_USERS_GRPC_" defDB = "users" - defSvcHttpPort = "9002" - defSvcGrpcPort = "9192" + defSvcHTTPPort = "9002" + defSvcGRPCPort = "9192" ) type config struct { @@ -96,26 +96,33 @@ func main() { logger.Fatal(fmt.Sprintf("failed to init logger: %s", err.Error())) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } } ec := email.Config{} if err := env.Parse(&ec); err != nil { - logger.Fatal(fmt.Sprintf("failed to load email configuration : %s", err.Error())) + logger.Error(fmt.Sprintf("failed to load email configuration : %s", err.Error())) + exitCode = 1 + return } dbConfig := pgClient.Config{Name: defDB} - db, err := pgClient.SetupWithConfig(envPrefix, *clientsPg.Migration(), dbConfig) + db, err := pgClient.SetupWithConfig(envPrefixDB, *clientsPg.Migration(), dbConfig) if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer db.Close() tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) @@ -133,8 +140,8 @@ func main() { csvc, gsvc, psvc := newService(ctx, db, tracer, cfg, ec, logger) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err.Error())) exitCode = 1 return @@ -149,8 +156,8 @@ func main() { policies.RegisterAuthServiceServer(srv, grpcapi.NewServer(csvc, psvc)) } - grpcServerConfig := server.Config{Port: defSvcGrpcPort} - if err := env.Parse(&grpcServerConfig, env.Options{Prefix: envPrefixGrpc, AltPrefix: envPrefix}); err != nil { + grpcServerConfig := server.Config{Port: defSvcGRPCPort} + if err := env.Parse(&grpcServerConfig, env.Options{Prefix: envPrefixGrpc}); err != nil { logger.Error(fmt.Sprintf("failed to load %s gRPC server configuration : %s", svcName, err.Error())) exitCode = 1 return diff --git a/cmd/ws/main.go b/cmd/ws/main.go index 58946ab96ef..9e7b77cdc4c 100644 --- a/cmd/ws/main.go +++ b/cmd/ws/main.go @@ -34,9 +34,8 @@ import ( const ( svcName = "ws-adapter" - envPrefix = "MF_WS_ADAPTER_" - envPrefixHttp = "MF_WS_ADAPTER_HTTP_" - defSvcHttpPort = "8190" + envPrefixHTTP = "MF_WS_ADAPTER_HTTP_" + defSvcHTTPPort = "8190" ) type config struct { @@ -61,21 +60,27 @@ func main() { log.Fatalf("failed to init logger: %s", err) } + var exitCode int + defer mflog.ExitWithError(&exitCode) + instanceID := cfg.InstanceID if instanceID == "" { instanceID, err = uuid.New().ID() if err != nil { - log.Fatalf("Failed to generate instanceID: %s", err) + logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err)) + exitCode = 1 + return } } - tc, tcHandler, err := thingsClient.Setup(envPrefix) + tc, tcHandler, err := thingsClient.Setup() if err != nil { - logger.Fatal(err.Error()) + logger.Error(err.Error()) + exitCode = 1 + return } - var exitCode int - defer mflog.ExitWithError(&exitCode) defer internal.Close(logger, tcHandler) + logger.Info("Successfully connected to things grpc server " + tcHandler.Secure()) tp, err := jaegerClient.NewProvider(svcName, cfg.JaegerURL, instanceID) @@ -102,8 +107,8 @@ func main() { svc := newService(tc, nps, logger, tracer) - httpServerConfig := server.Config{Port: defSvcHttpPort} - if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHttp, AltPrefix: envPrefix}); err != nil { + httpServerConfig := server.Config{Port: defSvcHTTPPort} + if err := env.Parse(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { logger.Error(fmt.Sprintf("failed to load %s HTTP server configuration : %s", svcName, err)) exitCode = 1 return diff --git a/coap/README.md b/coap/README.md index ca7b7217b68..752b34acfa0 100644 --- a/coap/README.md +++ b/coap/README.md @@ -9,22 +9,29 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -|--------------------------------|--------------------------------------------------------|-----------------------| -| MF_COAP_ADAPTER_PORT | Service listening port | 5683 | -| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | -| MF_COAP_ADAPTER_LOG_LEVEL | Service log level | info | -| MF_COAP_ADAPTER_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | -| MF_COAP_ADAPTER_CA_CERTS | Path to trusted CAs in PEM format | | -| MF_COAP_ADAPTER_PING_PERIOD | Hours between 1 and 24 to ping client with ACK message | 12 | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | -| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1s | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| -------------------------------- | --------------------------------------------------- | ------------------------------ | +| MF_COAP_ADAPTER_LOG_LEVEL | Service log level | info | +| MF_COAP_ADAPTER_HOST | CoAP service listening host | | +| MF_COAP_ADAPTER_PORT | CoAP service listening port | 5683 | +| MF_COAP_ADAPTER_SERVER_CERT | CoAP service server certificate | | +| MF_COAP_ADAPTER_SERVER_KEY | CoAP service server key | | +| MF_COAP_ADAPTER_HTTP_HOST | Service HTTP listening host | | +| MF_COAP_ADAPTER_HTTP_PORT | Service listening port | 5683 | +| MF_COAP_ADAPTER_HTTP_SERVER_CERT | Service server certificate | | +| MF_COAP_ADAPTER_HTTP_SERVER_KEY | Service server key | | +| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | +| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1s | +| MF_THINGS_AUTH_GRPC_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | +| MF_THINGS_AUTH_GRPC_CA_CERTS | Path to trusted CAs in PEM format | | +| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_COAP_ADAPTER_INSTANCE_ID | CoAP adapter instance ID | | ## Deployment -The service itself is distributed as Docker container. Check the [`coap-adapter`](https://github.com/mainflux/mainflux/blob/master/docker/docker-compose.yml#L273-L291) service section in +The service itself is distributed as Docker container. Check the [`coap-adapter`](https://github.com/mainflux/mainflux/blob/master/docker/docker-compose.yml#L273-L291) service section in docker-compose to see how service is deployed. Running this service outside of container requires working instance of the message broker service. @@ -43,15 +50,23 @@ make coap make install # set the environment variables and run the service -MF_BROKER_URL=[Message broker instance URL] \ -MF_COAP_ADAPTER_PORT=[Service HTTP port] \ MF_COAP_ADAPTER_LOG_LEVEL=[Service log level] \ -MF_COAP_ADAPTER_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ -MF_COAP_ADAPTER_CA_CERTS=[Path to trusted CAs in PEM format] \ -MF_COAP_ADAPTER_PING_PERIOD: [Hours between 1 and 24 to ping client with ACK message] \ -MF_JAEGER_URL=[Jaeger server URL] \ +MF_COAP_ADAPTER_HOST=[CoAP service host] \ +MF_COAP_ADAPTER_PORT=[CoAP service port] \ +MF_COAP_ADAPTER_SERVER_CERT=[Path to CoAP server certificate] \ +MF_COAP_ADAPTER_SERVER_KEY=[Path to CoAP server key] \ +MF_COAP_ADAPTER_HTTP_HOST=[CoAP HTTP service host] \ +MF_COAP_ADAPTER_HTTP_PORT=[CoAP HTTP service port] \ +MF_COAP_ADAPTER_HTTP_SERVER_CERT=[Path to HTTP server certificate] \ +MF_COAP_ADAPTER_HTTP_SERVER_KEY=[Path to HTTP server key] \ MF_THINGS_AUTH_GRPC_URL=[Things service Auth gRPC URL] \ MF_THINGS_AUTH_GRPC_TIMEOUT=[Things service Auth gRPC request timeout in seconds] \ +MF_THINGS_AUTH_GRPC_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ +MF_THINGS_AUTH_GRPC_CA_CERTS=[Path to trusted CAs in PEM format] \ +MF_BROKER_URL=[Message broker instance URL] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_COAP_ADAPTER_INSTANCE_ID=[CoAP adapter instance ID] \ $GOBIN/mainflux-coap ``` diff --git a/consumers/notifiers/smpp/README.md b/consumers/notifiers/smpp/README.md index 9ebdcdc1e74..2cb1ea49d5e 100644 --- a/consumers/notifiers/smpp/README.md +++ b/consumers/notifiers/smpp/README.md @@ -8,36 +8,40 @@ The Subscription service using SMPP Notifier is configured using the environment following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -| ------------------------------------| -------------------------------------------------------------------- | --------------------- | -| MF_SMPP_NOTIFIER_LOG_LEVEL | Log level for SMPP Notifier (debug, info, warn, error) | info | -| MF_SMPP_NOTIFIER_DB_HOST | Database host address | localhost | -| MF_SMPP_NOTIFIER_DB_PORT | Database host port | 5432 | -| MF_SMPP_NOTIFIER_DB_USER | Database user | mainflux | -| MF_SMPP_NOTIFIER_DB_PASS | Database password | mainflux | -| MF_SMPP_NOTIFIER_DB | Name of the database used by the service | subscriptions | -| MF_SMPP_NOTIFIER_WRITER_CONFIG_PATH | DB connection SSL mode (disable, require, verify-ca, verify-full) | disable | -| MF_SMPP_NOTIFIER_DB_SSL_MODE | Path to the PEM encoded certificate file | | -| MF_SMPP_NOTIFIER_DB_SSL_CERT | Path to the PEM encoded key file | | -| MF_SMPP_NOTIFIER_DB_SSL_KEY | Path to the PEM encoded root certificate file | | -| MF_SMPP_NOTIFIER_DB_SSL_ROOT_CERT | Users service HTTP port | 9002 | -| MF_SMPP_NOTIFIER_HTTP_PORT | Path to server certificate in pem format | | -| MF_SMPP_NOTIFIER_SERVER_CERT | Path to server cert in pem format | | -| MF_SMPP_NOTIFIER_SERVER_KEY | Path to server key in pem format | | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_BROKER_URL | Message broker URL | nats://127.0.0.1:4222 | -| MF_SMPP_ADDRESS | SMPP address [host:port] | | -| MF_SMPP_USERNAME | SMPP Username | | -| MF_SMPP_PASSWORD | SMPP Password | | -| MF_SMPP_SYSTEM_TYPE | SMPP System Type | | -| MF_SMPP_SRC_ADDR_TON | SMPP source address TON | | -| MF_SMPP_DST_ADDR_TON | SMPP destination address TON | | -| MF_SMPP_SRC_ADDR_NPI | SMPP source address NPI | | -| MF_SMPP_DST_ADDR_NPI | SMPP destination address NPI | | -| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | -| MF_AUTH_CLIENT_TLS | Users client TLS flag | false | -| MF_AUTH_CA_CERTS | Path to Auth client CA certs in pem format | | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| --------------------------------- | --------------------------------------------------------------------------------- | ------------------------------ | +| MF_SMPP_NOTIFIER_LOG_LEVEL | Log level for SMPP Notifier (debug, info, warn, error) | info | +| MF_SMPP_NOTIFIER_FROM_ADDRESS | From address for SMS notifications | | +| MF_SMPP_NOTIFIER_CONFIG_PATH | Config file path with Message broker subjects list, payload type and content-type | /config.toml | +| MF_SMPP_NOTIFIER_HTTP_HOST | Service HTTP host | localhost | +| MF_SMPP_NOTIFIER_HTTP_PORT | Service HTTP port | 9014 | +| MF_SMPP_NOTIFIER_HTTP_SERVER_CERT | Service HTTP server certificate path | "" | +| MF_SMPP_NOTIFIER_HTTP_SERVER_KEY | Service HTTP server key | "" | +| MF_SMPP_NOTIFIER_DB_HOST | Database host address | localhost | +| MF_SMPP_NOTIFIER_DB_PORT | Database host port | 5432 | +| MF_SMPP_NOTIFIER_DB_USER | Database user | mainflux | +| MF_SMPP_NOTIFIER_DB_PASS | Database password | mainflux | +| MF_SMPP_NOTIFIER_DB_NAME | Name of the database used by the service | subscriptions | +| MF_SMPP_NOTIFIER_DB_SSL_MODE | DB connection SSL mode (disable, require, verify-ca, verify-full) | disable | +| MF_SMPP_NOTIFIER_DB_SSL_CERT | Path to the PEM encoded certificate file | "" | +| MF_SMPP_NOTIFIER_DB_SSL_KEY | Path to the PEM encoded key file | "" | +| MF_SMPP_NOTIFIER_DB_SSL_ROOT_CERT | Path to the PEM encoded root certificate file | "" | +| MF_SMPP_ADDRESS | SMPP address [host:port] | | +| MF_SMPP_USERNAME | SMPP Username | | +| MF_SMPP_PASSWORD | SMPP Password | | +| MF_SMPP_SYSTEM_TYPE | SMPP System Type | | +| MF_SMPP_SRC_ADDR_TON | SMPP source address TON | | +| MF_SMPP_DST_ADDR_TON | SMPP destination address TON | | +| MF_SMPP_SRC_ADDR_NPI | SMPP source address NPI | | +| MF_SMPP_DST_ADDR_NPI | SMPP destination address NPI | | +| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | +| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | +| MF_AUTH_GRPC_CLIENT_TLS | Users client TLS flag | false | +| MF_AUTH_GRPC_CA_CERT | Path to Auth client CA certs in pem format | "" | +| MF_BROKER_URL | Message broker URL | nats://127.0.0.1:4222 | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_SMPP_NOTIFIER_INSTANCE_ID | SMPP Notifier instance ID | "" | ## Usage diff --git a/consumers/notifiers/smtp/README.md b/consumers/notifiers/smtp/README.md index fc15c371077..4b7c0c94cb5 100644 --- a/consumers/notifiers/smtp/README.md +++ b/consumers/notifiers/smtp/README.md @@ -8,36 +8,41 @@ The Subscription service using SMTP Notifier is configured using the environment following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -| --------------------------------- | ----------------------------------------------------------------------- | --------------------- | -| MF_SMTP_NOTIFIER_LOG_LEVEL | Log level for SMT Notifier (debug, info, warn, error) | info | -| MF_SMTP_NOTIFIER_DB_HOST | Database host address | localhost | -| MF_SMTP_NOTIFIER_DB_PORT | Database host port | 5432 | -| MF_SMTP_NOTIFIER_DB_USER | Database user | mainflux | -| MF_SMTP_NOTIFIER_DB_PASS | Database password | mainflux | -| MF_SMTP_NOTIFIER_DB | Name of the database used by the service | subscriptions | -| MF_SMTP_NOTIFIER_CONFIG_PATH | Path to the config file with message broker subjects configuration | disable | -| MF_SMTP_NOTIFIER_DB_SSL_MODE | Database connection SSL mode (disable, require, verify-ca, verify-full) | | -| MF_SMTP_NOTIFIER_DB_SSL_CERT | Path to the PEM encoded cert file | | -| MF_SMTP_NOTIFIER_DB_SSL_KEY | Path to the PEM encoded certificate key | | -| MF_SMTP_NOTIFIER_DB_SSL_ROOT_CERT | Path to the PEM encoded root certificate file | | -| MF_SMTP_NOTIFIER_PORT | HTTP server port | 9015 | -| MF_SMTP_NOTIFIER_SERVER_CERT | Path to server cert in pem format | | -| MF_SMTP_NOTIFIER_SERVER_KEY | Path to server key in pem format | | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_BROKER_URL | Message broker URL | nats://127.0.0.1:4222 | -| MF_EMAIL_HOST | Mail server host | localhost | -| MF_EMAIL_PORT | Mail server port | 25 | -| MF_EMAIL_USERNAME | Mail server username | | -| MF_EMAIL_PASSWORD | Mail server password | | -| MF_EMAIL_FROM_ADDRESS | Email "from" address | | -| MF_EMAIL_FROM_NAME | Email "from" name | | -| MF_EMAIL_TEMPLATE | Email template for sending notification emails | email.tmpl | -| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | -| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | -| MF_AUTH_CLIENT_TLS | Auth client TLS flag | false | -| MF_AUTH_CA_CERTS | Path to Auth client CA certs in pem format | | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| --------------------------------- | ----------------------------------------------------------------------- | ------------------------------ | +| MF_SMTP_NOTIFIER_LOG_LEVEL | Log level for SMT Notifier (debug, info, warn, error) | info | +| MF_SMTP_NOTIFIER_FROM_ADDRESS | From address for SMTP notifications | | +| MF_SMTP_NOTIFIER_CONFIG_PATH | Path to the config file with message broker subjects configuration | disable | +| MF_SMTP_NOTIFIER_HTTP_HOST | SMTP Notifier service HTTP host | localhost | +| MF_SMTP_NOTIFIER_HTTP_PORT | SMTP Notifier service HTTP port | 9015 | +| MF_SMTP_NOTIFIER_HTTP_SERVER_CERT | SMTP Notifier service HTTP server certificate path | "" | +| MF_SMTP_NOTIFIER_HTTP_SERVER_KEY | SMTP Notifier service HTTP server key | "" | +| MF_SMTP_NOTIFIER_DB_HOST | Database host address | localhost | +| MF_SMTP_NOTIFIER_DB_PORT | Database host port | 5432 | +| MF_SMTP_NOTIFIER_DB_USER | Database user | mainflux | +| MF_SMTP_NOTIFIER_DB_PASS | Database password | mainflux | +| MF_SMTP_NOTIFIER_DB_NAME | Name of the database used by the service | subscriptions | +| MF_SMTP_NOTIFIER_DB_SSL_MODE | Database connection SSL mode (disable, require, verify-ca, verify-full) | disable | +| MF_SMTP_NOTIFIER_DB_SSL_CERT | Path to the PEM encoded cert file | "" | +| MF_SMTP_NOTIFIER_DB_SSL_KEY | Path to the PEM encoded certificate key | "" | +| MF_SMTP_NOTIFIER_DB_SSL_ROOT_CERT | Path to the PEM encoded root certificate file | "" | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_BROKER_URL | Message broker URL | nats://127.0.0.1:4222 | +| MF_EMAIL_HOST | Mail server host | localhost | +| MF_EMAIL_PORT | Mail server port | 25 | +| MF_EMAIL_USERNAME | Mail server username | | +| MF_EMAIL_PASSWORD | Mail server password | | +| MF_EMAIL_FROM_ADDRESS | Email "from" address | | +| MF_EMAIL_FROM_NAME | Email "from" name | | +| MF_EMAIL_TEMPLATE | Email template for sending notification emails | email.tmpl | +| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | +| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | +| MF_AUTH_GRPC_CLIENT_TLS | Users service gRPC TLS flag | false | +| MF_AUTH_GRPC_CA_CERT | Path to Users service CA cert in pem format | "" | +| MF_AUTH_CLIENT_TLS | Auth client TLS flag | false | +| MF_AUTH_CA_CERTS | Path to Auth client CA certs in pem format | "" | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_SMTP_NOTIFIER_INSTANCE_ID | SMTP Notifier instance ID | "" | ## Usage diff --git a/consumers/writers/cassandra/README.md b/consumers/writers/cassandra/README.md index be073e83ee4..edc6cba5198 100644 --- a/consumers/writers/cassandra/README.md +++ b/consumers/writers/cassandra/README.md @@ -8,21 +8,26 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -| -------------------------------- | ----------------------------------------------------------------------- | --------------------- | -| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | -| MF_CASSANDRA_WRITER_LOG_LEVEL | Log level for Cassandra writer (debug, info, warn, error) | info | -| MF_CASSANDRA_WRITER_PORT | Service HTTP port | 9004 | -| MF_CASSANDRA_WRITER_DB_CLUSTER | Cassandra cluster comma separated addresses | 127.0.0.1 | -| MF_CASSANDRA_WRITER_DB_KEYSPACE | Cassandra keyspace name | mainflux | -| MF_CASSANDRA_WRITER_DB_USER | Cassandra DB username | | -| MF_CASSANDRA_WRITER_DB_PASS | Cassandra DB password | | -| MF_CASSANDRA_WRITER_DB_PORT | Cassandra DB port | 9042 | -| MF_CASSANDRA_WRITER_CONFIG_PATH | Config file path with NATS subjects list, payload type and content-type | /config.toml || MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| ------------------------------------ | ----------------------------------------------------------------------- | ------------------------------ | +| MF_CASSANDRA_WRITER_LOG_LEVEL | Log level for Cassandra writer (debug, info, warn, error) | info | +| MF_CASSANDRA_WRITER_CONFIG_PATH | Config file path with NATS subjects list, payload type and content-type | /config.toml | +| MF_CASSANDRA_WRITER_HTTP_HOST | Cassandra service HTTP host | | +| MF_CASSANDRA_WRITER_HTTP_PORT | Cassandra service HTTP port | 9004 | +| MF_CASSANDRA_WRITER_HTTP_SERVER_CERT | Cassandra service HTTP server certificate path | | +| MF_CASSANDRA_WRITER_HTTP_SERVER_KEY | Cassandra service HTTP server key path | | +| MF_CASSANDRA_CLUSTER | Cassandra cluster comma separated addresses | 127.0.0.1 | +| MF_CASSANDRA_KEYSPACE | Cassandra keyspace name | mainflux | +| MF_CASSANDRA_USER | Cassandra DB username | mainflux | +| MF_CASSANDRA_PASS | Cassandra DB password | mainflux | +| MF_CASSANDRA_PORT | Cassandra DB port | 9042 | +| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_CASSANDRA_WRITER_INSANCE_ID | Cassandra writer instance ID | | ## Deployment + The service itself is distributed as Docker container. Check the [`cassandra-writer`](https://github.com/mainflux/mainflux/blob/master/docker/addons/cassandra-writer/docker-compose.yml#L30-L49) service section in docker-compose to see how service is deployed. To start the service, execute the following shell script: @@ -40,15 +45,21 @@ make cassandra-writer make install # Set the environment variables and run the service -MF_BROKER_URL=[NATS instance URL] \ MF_CASSANDRA_WRITER_LOG_LEVEL=[Cassandra writer log level] \ -MF_CASSANDRA_WRITER_PORT=[Service HTTP port] \ -MF_CASSANDRA_WRITER_DB_CLUSTER=[Cassandra cluster comma separated addresses] \ -MF_CASSANDRA_WRITER_DB_KEYSPACE=[Cassandra keyspace name] \ -MF_CASSANDRA_READER_DB_USER=[Cassandra DB username] \ -MF_CASSANDRA_READER_DB_PASS=[Cassandra DB password] \ -MF_CASSANDRA_READER_DB_PORT=[Cassandra DB port] \ MF_CASSANDRA_WRITER_CONFIG_PATH=[Config file path with NATS subjects list, payload type and content-type] \ +MF_CASSANDRA_WRITER_HTTP_HOST=[Cassandra service HTTP host] \ +MF_CASSANDRA_WRITER_HTTP_PORT=[Cassandra service HTTP port] \ +MF_CASSANDRA_WRITER_HTTP_SERVER_CERT=[Cassandra service HTTP server cert] \ +MF_CASSANDRA_WRITER_HTTP_SERVER_KEY=[Cassandra service HTTP server key] \ +MF_CASSANDRA_CLUSTER=[Cassandra cluster comma separated addresses] \ +MF_CASSANDRA_KEYSPACE=[Cassandra keyspace name] \ +MF_CASSANDRA_USER=[Cassandra DB username] \ +MF_CASSANDRA_PASS=[Cassandra DB password] \ +MF_CASSANDRA_PORT=[Cassandra DB port] \ +MF_BROKER_URL=[Message Broker instance URL] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_CASSANDRA_WRITER_INSANCE_ID=[Cassandra writer instance ID] \ $GOBIN/mainflux-cassandra-writer ``` diff --git a/consumers/writers/influxdb/README.md b/consumers/writers/influxdb/README.md index edd38500242..09ade710ca8 100644 --- a/consumers/writers/influxdb/README.md +++ b/consumers/writers/influxdb/README.md @@ -8,27 +8,31 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -| ----------------------------- | --------------------------------------------------------------------------------- | ---------------------- | -| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | -| MF_INFLUX_WRITER_LOG_LEVEL | Log level for InfluxDB writer (debug, info, warn, error) | info | -| MF_INFLUX_WRITER_PORT | Service HTTP port | 9006 | -| MF_INFLUX_WRITER_DB_HOST | InfluxDB host | localhost | -| MF_INFLUXDB_PORT | Default port of InfluxDB database | 8086 | -| MF_INFLUXDB_ADMIN_USER | Default user of InfluxDB database | mainflux | -| MF_INFLUXDB_ADMIN_PASSWORD | Default password of InfluxDB user | mainflux | -| MF_INFLUXDB_DB | InfluxDB database name | mainflux | -| MF_INFLUXDB_HOST | InfluxDB host name | mainflux-influxdb | -| MF_INFLUXDB_PROTOCOL | InfluxDB protocol | http | -| MF_INFLUXDB_TIMEOUT | InfluxDB client connection readiness timeout | 1s | -| MF_INFLUXDB_ORG | InfluxDB organization name | mainflux | -| MF_INFLUXDB_BUCKET | InfluxDB bucket name | mainflux-bucket | -| MF_INFLUXDB_TOKEN | InfluxDB API token | mainflux-token | -| MF_INFLUXDB_HTTP_ENABLED | InfluxDB http enabled status | true | -| MF_INFLUXDB_INIT_MODE | InfluxDB initialization mode | setup | -| MF_INFLUX_WRITER_CONFIG_PATH | Config file path with message broker subjects list, payload type and content-type | /configs.toml | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| --------------------------------- | --------------------------------------------------------------------------------- | ------------------------------ | +| MF_INFLUX_WRITER_LOG_LEVEL | Log level for InfluxDB writer (debug, info, warn, error) | info | +| MF_INFLUX_WRITER_CONFIG_PATH | Config file path with message broker subjects list, payload type and content-type | /configs.toml | +| MF_INFLUX_WRITER_HTTP_HOST | Service HTTP host | | +| MF_INFLUX_WRITER_HTTP_PORT | Service HTTP port | 9006 | +| MF_INFLUX_WRITER_HTTP_SERVER_CERT | Path to server certificate in pem format | | +| MF_INFLUX_WRITER_HTTP_SERVER_KEY | Path to server key in pem format | | +| MF_INFLUXDB_PROTOCOL | InfluxDB protocol | http | +| MF_INFLUXDB_HOST | InfluxDB host name | mainflux-influxdb | +| MF_INFLUXDB_PORT | Default port of InfluxDB database | 8086 | +| MF_INFLUXDB_ADMIN_USER | Default user of InfluxDB database | mainflux | +| MF_INFLUXDB_ADMIN_PASSWORD | Default password of InfluxDB user | mainflux | +| MF_INFLUXDB_NAME | InfluxDB database name | mainflux | +| MF_INFLUXDB_BUCKET | InfluxDB bucket name | mainflux-bucket | +| MF_INFLUXDB_ORG | InfluxDB organization name | mainflux | +| MF_INFLUXDB_TOKEN | InfluxDB API token | mainflux-token | +| MF_INFLUXDB_DBURL | InfluxDB database URL | | +| MF_INFLUXDB_USER_AGENT | InfluxDB user agent | | +| MF_INFLUXDB_TIMEOUT | InfluxDB client connection readiness timeout | 1s | +| MF_INFLUXDB_INSECURE_SKIP_VERIFY | InfluxDB client connection insecure skip verify | false | +| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_INFLUX_WRITER_INSTANCE_ID | InfluxDB writer instance ID | | ## Deployment @@ -49,22 +53,29 @@ make influxdb make install # Set the environment variables and run the service -MF_BROKER_URL=[Message broker instance URL] \ MF_INFLUX_WRITER_LOG_LEVEL=[Influx writer log level] \ -MF_INFLUX_WRITER_PORT=[Service HTTP port] \ -MF_INFLUXDB_DB=[InfluxDB database name] \ +MF_INFLUX_WRITER_CONFIG_PATH=[Config file path with Message broker subjects list, payload type and content-type] \ +MF_INFLUX_WRITER_HTTP_HOST=[Service HTTP host] \ +MF_INFLUX_WRITER_HTTP_PORT=[Service HTTP port] \ +MF_INFLUX_WRITER_HTTP_SERVER_CERT=[Service HTTP server cert] \ +MF_INFLUX_WRITER_HTTP_SERVER_KEY=[Service HTTP server key] \ +MF_INFLUXDB_PROTOCOL=[InfluxDB protocol] \ MF_INFLUXDB_HOST=[InfluxDB database host] \ MF_INFLUXDB_PORT=[InfluxDB database port] \ MF_INFLUXDB_ADMIN_USER=[InfluxDB admin user] \ MF_INFLUXDB_ADMIN_PASSWORD=[InfluxDB admin password] \ -MF_INFLUXDB_PROTOCOL=[InfluxDB protocol] \ -MF_INFLUXDB_TIMEOUT=[InfluxDB timeout] \ -MF_INFLUXDB_ORG=[InfluxDB org] \ +MF_INFLUXDB_NAME=[InfluxDB database name] \ MF_INFLUXDB_BUCKET=[InfluxDB bucket] \ +MF_INFLUXDB_ORG=[InfluxDB org] \ MF_INFLUXDB_TOKEN=[InfluxDB token] \ -MF_INFLUXDB_HTTP_ENABLED=[InfluxDB http enabled] \ -MF_INFLUXDB_INIT_MODE=[InfluxDB init mode] \ -MF_INFLUX_WRITER_CONFIG_PATH=[Config file path with Message broker subjects list, payload type and content-type] \ +MF_INFLUXDB_DBURL=[InfluxDB database url] \ +MF_INFLUXDB_USER_AGENT=[InfluxDB user agent] \ +MF_INFLUXDB_TIMEOUT=[InfluxDB timeout] \ +MF_INFLUXDB_INSECURE_SKIP_VERIFY=[InfluxDB insecure skip verify] \ +MF_BROKER_URL=[Message broker instance URL] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_INFLUX_WRITER_INSTANCE_ID=[Influx writer instance ID] \ $GOBIN/mainflux-influxdb ``` diff --git a/consumers/writers/mongodb/README.md b/consumers/writers/mongodb/README.md index a5e0f3e6364..317005c6320 100644 --- a/consumers/writers/mongodb/README.md +++ b/consumers/writers/mongodb/README.md @@ -8,17 +8,21 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -| ---------------------------- | --------------------------------------------------------------------------------- | ---------------------- | -| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | -| MF_MONGO_WRITER_LOG_LEVEL | Log level for MongoDB writer | info | -| MF_MONGO_WRITER_PORT | Service HTTP port | 9008 | -| MF_MONGO_WRITER_DB | Default MongoDB database name | messages | -| MF_MONGO_WRITER_DB_HOST | Default MongoDB database host | localhost | -| MF_MONGO_WRITER_DB_PORT | Default MongoDB database port | 27017 | -| MF_MONGO_WRITER_CONFIG_PATH | Config file path with Message broker subjects list, payload type and content-type | /config.toml | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| -------------------------------- | --------------------------------------------------------------------------------- | ------------------------------ | +| MF_MONGO_WRITER_LOG_LEVEL | Log level for MongoDB writer | info | +| MF_MONGO_WRITER_CONFIG_PATH | Config file path with Message broker subjects list, payload type and content-type | /config.toml | +| MF_MONGO_WRITER_HTTP_HOST | Service HTTP host | localhost | +| MF_MONGO_WRITER_HTTP_PORT | Service HTTP port | 9010 | +| MF_MONGO_WRITER_HTTP_SERVER_CERT | Service HTTP server certificate path | "" | +| MF_MONGO_WRITER_HTTP_SERVER_KEY | Service HTTP server key | "" | +| MF_MONGO_NAME | Default MongoDB database name | messages | +| MF_MONGO_HOST | Default MongoDB database host | localhost | +| MF_MONGO_PORT | Default MongoDB database port | 27017 | +| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_MONGO_WRITER_INSTANCE_ID | MongoDB writer instance ID | "" | ## Deployment @@ -39,13 +43,20 @@ make mongodb-writer make install # Set the environment variables and run the service -MF_BROKER_URL=[Message broker instance URL] \ MF_MONGO_WRITER_LOG_LEVEL=[MongoDB writer log level] \ -MF_MONGO_WRITER_PORT=[Service HTTP port] \ -MF_MONGO_WRITER_DB=[MongoDB database name] \ -MF_MONGO_WRITER_DB_HOST=[MongoDB database host] \ -MF_MONGO_WRITER_DB_PORT=[MongoDB database port] \ MF_MONGO_WRITER_CONFIG_PATH=[Configuration file path with Message broker subjects list] \ +MF_MONGO_WRITER_HTTP_HOST=[Service HTTP host] \ +MF_MONGO_WRITER_HTTP_PORT=[Service HTTP port] \ +MF_MONGO_WRITER_HTTP_SERVER_CERT=[Service HTTP server certificate] \ +MF_MONGO_WRITER_HTTP_SERVER_KEY=[Service HTTP server key] \ +MF_MONGO_NAME=[MongoDB database name] \ +MF_MONGO_HOST=[MongoDB database host] \ +MF_MONGO_PORT=[MongoDB database port] \ +MF_BROKER_URL=[Message broker instance URL] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_MONGO_WRITER_INSTANCE_ID=[MongoDB writer instance ID] \ + $GOBIN/mainflux-mongodb-writer ``` diff --git a/consumers/writers/postgres/README.md b/consumers/writers/postgres/README.md index c9efa60b89d..3cf1c5a3ce4 100644 --- a/consumers/writers/postgres/README.md +++ b/consumers/writers/postgres/README.md @@ -8,23 +8,27 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -| ----------------------------------- | --------------------------------------------------------------------------------- | ---------------------- | -| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | -| MF_POSTGRES_WRITER_LOG_LEVEL | Service log level | info | -| MF_POSTGRES_WRITER_PORT | Service HTTP port | 9010 | -| MF_POSTGRES_WRITER_DB_HOST | Postgres DB host | postgres | -| MF_POSTGRES_WRITER_DB_PORT | Postgres DB port | 5432 | -| MF_POSTGRES_WRITER_DB_USER | Postgres user | mainflux | -| MF_POSTGRES_WRITER_DB_PASS | Postgres password | mainflux | -| MF_POSTGRES_WRITER_DB | Postgres database name | messages | -| MF_POSTGRES_WRITER_DB_SSL_MODE | Postgres SSL mode | disabled | -| MF_POSTGRES_WRITER_DB_SSL_CERT | Postgres SSL certificate path | "" | -| MF_POSTGRES_WRITER_DB_SSL_KEY | Postgres SSL key | "" | -| MF_POSTGRES_WRITER_DB_SSL_ROOT_CERT | Postgres SSL root certificate path | "" | +| Variable | Description | Default | +| ----------------------------------- | --------------------------------------------------------------------------------- | ------------------------------ | +| MF_POSTGRES_WRITER_LOG_LEVEL | Service log level | info | | MF_POSTGRES_WRITER_CONFIG_PATH | Config file path with Message broker subjects list, payload type and content-type | /config.toml | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_POSTGRES_WRITER_HTTP_HOST | Service HTTP host | localhost | +| MF_POSTGRES_WRITER_HTTP_PORT | Service HTTP port | 9010 | +| MF_POSTGRES_WRITER_HTTP_SERVER_CERT | Service HTTP server certificate path | "" | +| MF_POSTGRES_WRITER_HTTP_SERVER_KEY | Service HTTP server key | "" | +| MF_POSTGRES_HOST | Postgres DB host | postgres | +| MF_POSTGRES_PORT | Postgres DB port | 5432 | +| MF_POSTGRES_USER | Postgres user | mainflux | +| MF_POSTGRES_PASS | Postgres password | mainflux | +| MF_POSTGRES_NAME | Postgres database name | messages | +| MF_POSTGRES_SSL_MODE | Postgres SSL mode | disabled | +| MF_POSTGRES_SSL_CERT | Postgres SSL certificate path | "" | +| MF_POSTGRES_SSL_KEY | Postgres SSL key | "" | +| MF_POSTGRES_SSL_ROOT_CERT | Postgres SSL root certificate path | "" | +| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_POSTGRES_WRITER_INSTANCE_ID | Service instance ID | "" | ## Deployment @@ -45,19 +49,26 @@ make postgres-writer make install # Set the environment variables and run the service -MF_BROKER_URL=[Message broker instance URL] \ MF_POSTGRES_WRITER_LOG_LEVEL=[Service log level] \ -MF_POSTGRES_WRITER_PORT=[Service HTTP port] \ -MF_POSTGRES_WRITER_DB_HOST=[Postgres host] \ -MF_POSTGRES_WRITER_DB_PORT=[Postgres port] \ -MF_POSTGRES_WRITER_DB_USER=[Postgres user] \ -MF_POSTGRES_WRITER_DB_PASS=[Postgres password] \ -MF_POSTGRES_WRITER_DB=[Postgres database name] \ -MF_POSTGRES_WRITER_DB_SSL_MODE=[Postgres SSL mode] \ -MF_POSTGRES_WRITER_DB_SSL_CERT=[Postgres SSL cert] \ -MF_POSTGRES_WRITER_DB_SSL_KEY=[Postgres SSL key] \ -MF_POSTGRES_WRITER_DB_SSL_ROOT_CERT=[Postgres SSL Root cert] \ MF_POSTGRES_WRITER_CONFIG_PATH=[Config file path with Message broker subjects list, payload type and content-type] \ +MF_POSTGRES_WRITER_HTTP_HOST=[Service HTTP host] \ +MF_POSTGRES_WRITER_HTTP_PORT=[Service HTTP port] \ +MF_POSTGRES_WRITER_HTTP_SERVER_CERT=[Service HTTP server cert] \ +MF_POSTGRES_WRITER_HTTP_SERVER_KEY=[Service HTTP server key] \ +MF_POSTGRES_HOST=[Postgres host] \ +MF_POSTGRES_PORT=[Postgres port] \ +MF_POSTGRES_USER=[Postgres user] \ +MF_POSTGRES_PASS=[Postgres password] \ +MF_POSTGRES_NAME=[Postgres database name] \ +MF_POSTGRES_SSL_MODE=[Postgres SSL mode] \ +MF_POSTGRES_SSL_CERT=[Postgres SSL cert] \ +MF_POSTGRES_SSL_KEY=[Postgres SSL key] \ +MF_POSTGRES_SSL_ROOT_CERT=[Postgres SSL Root cert] \ +MF_BROKER_URL=[Message broker instance URL] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_POSTGRES_WRITER_INSTANCE_ID=[Service instance ID] \ + $GOBIN/mainflux-postgres-writer ``` diff --git a/consumers/writers/timescale/README.md b/consumers/writers/timescale/README.md index 643d6f5dd29..36d93491cbd 100644 --- a/consumers/writers/timescale/README.md +++ b/consumers/writers/timescale/README.md @@ -8,23 +8,27 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -| ----------------------------------- | --------------------------------------------------------- | ---------------------- | -| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | -| MF_TIMESCALE_WRITER_LOG_LEVEL | Service log level | info | -| MF_TIMESCALE_WRITER_PORT | Service HTTP port | 9012 | -| MF_TIMESCALE_WRITER_DB_HOST | Timescale DB host | timescale | -| MF_TIMESCALE_WRITER_DB_PORT | Timescale DB port | 5432 | -| MF_TIMESCALE_WRITER_DB_USER | Timescale user | mainflux | -| MF_TIMESCALE_WRITER_DB_PASS | Timescale password | mainflux | -| MF_TIMESCALE_WRITER_DB | Timescale database name | messages | -| MF_TIMESCALE_WRITER_DB_SSL_MODE | Timescale SSL mode | disabled | -| MF_TIMESCALE_WRITER_DB_SSL_CERT | Timescale SSL certificate path | "" | -| MF_TIMESCALE_WRITER_DB_SSL_KEY | Timescale SSL key | "" | -| MF_TIMESCALE_WRITER_DB_SSL_ROOT_CERT | Timescale SSL root certificate path | "" | -| MF_TIMESCALE_WRITER_CONFIG_PATH | Configuration file path with Message broker subjects list | /config.toml | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| ------------------------------------ | --------------------------------------------------------- | ------------------------------ | +| MF_TIMESCALE_WRITER_LOG_LEVEL | Service log level | info | +| MF_TIMESCALE_WRITER_CONFIG_PATH | Configuration file path with Message broker subjects list | /config.toml | +| MF_TIMESCALE_WRITER_HTTP_HOST | Service HTTP host | localhost | +| MF_TIMESCALE_WRITER_HTTP_PORT | Service HTTP port | 9012 | +| MF_TIMESCALE_WRITER_HTTP_SERVER_CERT | Service HTTP server certificate path | "" | +| MF_TIMESCALE_WRITER_HTTP_SERVER_KEY | Service HTTP server key | "" | +| MF_TIMESCALE_HOST | Timescale DB host | timescale | +| MF_TIMESCALE_PORT | Timescale DB port | 5432 | +| MF_TIMESCALE_USER | Timescale user | mainflux | +| MF_TIMESCALE_PASS | Timescale password | mainflux | +| MF_TIMESCALE_NAME | Timescale database name | messages | +| MF_TIMESCALE_SSL_MODE | Timescale SSL mode | disabled | +| MF_TIMESCALE_SSL_CERT | Timescale SSL certificate path | "" | +| MF_TIMESCALE_SSL_KEY | Timescale SSL key | "" | +| MF_TIMESCALE_SSL_ROOT_CERT | Timescale SSL root certificate path | "" | +| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_TIMESCALE_WRITER_INSTANCE_ID | Timescale writer instance ID | "" | ## Deployment @@ -45,20 +49,25 @@ make timescale-writer make install # Set the environment variables and run the service -MF_BROKER_URL=[Message broker instance URL] \ MF_TIMESCALE_WRITER_LOG_LEVEL=[Service log level] \ -MF_TIMESCALE_WRITER_PORT=[Service HTTP port] \ -MF_TIMESCALE_WRITER_DB_HOST=[Timescale host] \ -MF_TIMESCALE_WRITER_DB_PORT=[Timescale port] \ -MF_TIMESCALE_WRITER_DB_USER=[Timescale user] \ -MF_TIMESCALE_WRITER_DB_PASS=[Timescale password] \ -MF_TIMESCALE_WRITER_DB=[Timescale database name] \ -MF_TIMESCALE_WRITER_DB_SSL_MODE=[Timescale SSL mode] \ -MF_TIMESCALE_WRITER_DB_SSL_CERT=[Timescale SSL cert] \ -MF_TIMESCALE_WRITER_DB_SSL_KEY=[Timescale SSL key] \ -MF_TIMESCALE_WRITER_DB_SSL_ROOT_CERT=[Timescale SSL Root cert] \ MF_TIMESCALE_WRITER_CONFIG_PATH=[Configuration file path with Message broker subjects list] \ -MF_TIMESCALE_WRITER_TRANSFORMER=[Message transformer type] \ +MF_TIMESCALE_WRITER_HTTP_HOST=[Service HTTP host] \ +MF_TIMESCALE_WRITER_HTTP_PORT=[Service HTTP port] \ +MF_TIMESCALE_WRITER_HTTP_SERVER_CERT=[Service HTTP server cert] \ +MF_TIMESCALE_WRITER_HTTP_SERVER_KEY=[Service HTTP server key] \ +MF_TIMESCALE_HOST=[Timescale host] \ +MF_TIMESCALE_PORT=[Timescale port] \ +MF_TIMESCALE_USER=[Timescale user] \ +MF_TIMESCALE_PASS=[Timescale password] \ +MF_TIMESCALE_NAME=[Timescale database name] \ +MF_TIMESCALE_SSL_MODE=[Timescale SSL mode] \ +MF_TIMESCALE_SSL_CERT=[Timescale SSL cert] \ +MF_TIMESCALE_SSL_KEY=[Timescale SSL key] \ +MF_TIMESCALE_SSL_ROOT_CERT=[Timescale SSL Root cert] \ +MF_BROKER_URL=[Message broker instance URL] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_TIMESCALE_WRITER_INSTANCE_ID=[Timescale writer instance ID] \ $GOBIN/mainflux-timescale-writer ``` diff --git a/docker/.env b/docker/.env index 78e85b825e0..1613a5f2a6c 100644 --- a/docker/.env +++ b/docker/.env @@ -19,7 +19,7 @@ MF_RABBITMQ_COOKIE=mainflux MF_RABBITMQ_VHOST=/ MF_RABBITMQ_URL=amqp://${MF_RABBITMQ_USER}:${MF_RABBITMQ_PASS}@broker:${MF_RABBITMQ_PORT}${MF_RABBITMQ_VHOST} -# Message Broker +## Message Broker MF_BROKER_TYPE=nats MF_BROKER_URL=${MF_NATS_URL} @@ -33,34 +33,46 @@ MF_JAEGER_COLLECTOR=14268 MF_JAEGER_CONFIGS=5778 MF_JAEGER_URL=http://jaeger:14268/api/traces +## Call home +MF_SEND_TELEMETRY=true + ## Core Services ### Users MF_USERS_LOG_LEVEL=debug +MF_USERS_SECRET_KEY=HyE2D4RUt9nnKG6v8zKEqAp6g6ka8hhZsqUpzgKvnwpXrNVQSH +MF_USERS_ADMIN_EMAIL=admin@example.com +MF_USERS_ADMIN_PASSWORD=12345678 +MF_USERS_PASS_REGEX=^.{8,}$ +MF_USERS_ACCESS_TOKEN_DURATION=15m +MF_USERS_REFRESH_TOKEN_DURATION=24h +MF_TOKEN_RESET_ENDPOINT=/reset-request +MF_USERS_HTTP_HOST=users +MF_USERS_HTTP_PORT=9002 +MF_USERS_HTTP_SERVER_CERT= +MF_USERS_HTTP_SERVER_KEY= +MF_USERS_GRPC_HOST=users +MF_USERS_GRPC_PORT=7001 +MF_USERS_GRPC_SERVER_CERT= +MF_USERS_GRPC_SERVER_KEY= MF_USERS_DB_HOST=users-db MF_USERS_DB_PORT=5432 MF_USERS_DB_USER=mainflux MF_USERS_DB_PASS=mainflux -MF_USERS_DB=users -MF_USERS_DB_SSL_MODE= +MF_USERS_DB_NAME=users +MF_USERS_DB_SSL_MODE=disable MF_USERS_DB_SSL_CERT= MF_USERS_DB_SSL_KEY= MF_USERS_DB_SSL_ROOT_CERT= -MF_USERS_HTTP_PORT=9002 -MF_USERS_GRPC_PORT=7001 -MF_USERS_GRPC_URL=users:7001 -MF_USERS_GRPC_TIMEOUT=1s -MF_USERS_SERVER_CERT= -MF_USERS_SERVER_KEY= -MF_USERS_SECRET_KEY=HyE2D4RUt9nnKG6v8zKEqAp6g6ka8hhZsqUpzgKvnwpXrNVQSH -MF_USERS_ACCESS_TOKEN_DURATION=15m -MF_USERS_REFRESH_TOKEN_DURATION=24h -MF_USERS_ADMIN_EMAIL=admin@example.com -MF_USERS_ADMIN_PASSWORD=12345678 MF_USERS_RESET_PWD_TEMPLATE=users.tmpl -MF_USERS_PASS_REGEX=^.{8,}$$ MF_USERS_INSTANCE_ID= +#### Users Client Config +MF_USERS_GRPC_URL=users:7001 +MF_USERS_GRPC_TIMEOUT=1s +MF_USERS_GRPC_CLIENT_TLS= +MF_USERS_GRPC_CA_CERT= + ### Email utility MF_EMAIL_HOST=smtp.mailtrap.io MF_EMAIL_PORT=2525 @@ -69,48 +81,68 @@ MF_EMAIL_PASSWORD=2b0d302e775b1e MF_EMAIL_FROM_ADDRESS=from@example.com MF_EMAIL_FROM_NAME=Example MF_EMAIL_TEMPLATE=smtp-notifier.tmpl -MF_EMAIL_INSTANCE_ID= - -### Token utility -MF_TOKEN_RESET_ENDPOINT=/reset-request ### Things MF_THINGS_LOG_LEVEL=debug -MF_THINGS_HTTP_PORT=9000 -MF_THINGS_AUTH_HTTP_PORT=9001 -MF_THINGS_AUTH_GRPC_PORT=7000 -MF_THINGS_AUTH_GRPC_URL=things:7000 -MF_THINGS_AUTH_GRPC_TIMEOUT=1s -MF_THINGS_DB_HOST=things-db -MF_THINGS_DB_PORT=5432 -MF_THINGS_DB_USER=mainflux -MF_THINGS_DB_PASS=mainflux -MF_THINGS_DB=things -MF_THINGS_URL=http://mainflux-things:9000 MF_THINGS_STANDALONE_ID= MF_THINGS_STANDALONE_TOKEN= MF_THINGS_CACHE_KEY_DURATION=10m -MF_THINGS_CACHE_URL=things-redis:${MF_REDIS_TCP_PORT} -MF_THINGS_CACHE_PASS= -MF_THINGS_CACHE_DB= +MF_THINGS_HTTP_HOST=things +MF_THINGS_HTTP_PORT=9000 +MF_THINGS_HTTP_SERVER_CERT= +MF_THINGS_HTTP_SERVER_KEY= +MF_THINGS_GRPC_HOST=things +MF_THINGS_GRPC_PORT=7000 +MF_THINGS_GRPC_SERVER_CERT= +MF_THINGS_GRPC_SERVER_KEY= MF_THINGS_ES_URL=es-redis:${MF_REDIS_TCP_PORT} MF_THINGS_ES_PASS= -MF_THINGS_ES_DB= +MF_THINGS_ES_DB=0 +MF_THINGS_CACHE_URL=things-redis:${MF_REDIS_TCP_PORT} +MF_THINGS_CACHE_PASS= +MF_THINGS_CACHE_DB=0 +MF_THINGS_DB_HOST=things-db +MF_THINGS_DB_PORT=5432 +MF_THINGS_DB_USER=mainflux +MF_THINGS_DB_PASS=mainflux +MF_THINGS_DB_NAME=things +MF_THINGS_DB_SSL_MODE=disable +MF_THINGS_DB_SSL_CERT= +MF_THINGS_DB_SSL_KEY= +MF_THINGS_DB_SSL_ROOT_CERT= MF_THINGS_INSTANCE_ID= +#### Things Client Config +MF_THINGS_URL=http://things:9000 +MF_THINGS_AUTH_GRPC_URL=things:7000 +MF_THINGS_AUTH_GRPC_TIMEOUT=1s +MF_THINGS_AUTH_GRPC_CLIENT_TLS= +MF_THINGS_AUTH_GRPC_CA_CERTS= + ### HTTP +MF_HTTP_ADAPTER_LOG_LEVEL=debug +MF_HTTP_ADAPTER_HOST=http-adapter MF_HTTP_ADAPTER_PORT=8008 +MF_HTTP_ADAPTER_SERVER_CERT= +MF_HTTP_ADAPTER_SERVER_KEY= MF_HTTP_ADAPTER_INSTANCE_ID= ### MQTT MF_MQTT_ADAPTER_LOG_LEVEL=debug MF_MQTT_ADAPTER_MQTT_PORT=1883 -MF_MQTT_BROKER_PORT=1883 +MF_MQTT_ADAPTER_MQTT_TARGET_HOST=vernemq +MF_MQTT_ADAPTER_MQTT_TARGET_PORT=1883 +MF_MQTT_ADAPTER_FORWARDER_TIMEOUT=30s +MF_MQTT_ADAPTER_MQTT_TARGET_HEALTH_CHECK=http://vernemq:8888/health MF_MQTT_ADAPTER_WS_PORT=8080 -MF_MQTT_BROKER_WS_PORT=8080 -MF_MQTT_ADAPTER_ES_DB=0 +MF_MQTT_ADAPTER_WS_TARGET_HOST=vernemq +MF_MQTT_ADAPTER_WS_TARGET_PORT=8080 +MF_MQTT_ADAPTER_WS_TARGET_PATH=/mqtt +MF_MQTT_ADAPTER_INSTANCE= +MF_MQTT_ADAPTER_ES_URL=es-redis:${MF_REDIS_TCP_PORT} MF_MQTT_ADAPTER_ES_PASS= MF_MQTT_ADAPTER_INSTANCE_ID= +MF_MQTT_ADAPTER_ES_DB=0 ### VERNEMQ MF_DOCKER_VERNEMQ_ALLOW_ANONYMOUS=on @@ -118,26 +150,45 @@ MF_DOCKER_VERNEMQ_LOG__CONSOLE__LEVEL=error ### CoAP MF_COAP_ADAPTER_LOG_LEVEL=debug +MF_COAP_ADAPTER_HOST=coap-adapter MF_COAP_ADAPTER_PORT=5683 +MF_COAP_ADAPTER_SERVER_CERT= +MF_COAP_ADAPTER_SERVER_KEY= +MF_COAP_ADAPTER_HTTP_HOST=coap-adapter +MF_COAP_ADAPTER_HTTP_PORT=5683 +MF_COAP_ADAPTER_HTTP_SERVER_CERT= +MF_COAP_ADAPTER_HTTP_SERVER_KEY= MF_COAP_ADAPTER_INSTANCE_ID= ### WS MF_WS_ADAPTER_LOG_LEVEL=debug -MF_WS_ADAPTER_PORT=8186 +MF_WS_ADAPTER_HTTP_HOST=ws-adapter +MF_WS_ADAPTER_HTTP_PORT=8186 +MF_WS_ADAPTER_HTTP_SERVER_CERT= +MF_WS_ADAPTER_HTTP_SERVER_KEY= MF_WS_ADAPTER_INSTANCE_ID= -### Call home -MF_SEND_TELEMETRY=true - ## Addons Services ### Bootstrap MF_BOOTSTRAP_LOG_LEVEL=debug -MF_BOOTSTRAP_PORT=9013 +MF_BOOTSTRAP_ENCRYPT_KEY=v7aT0HGxJxt2gULzr3RHwf4WIf6DusPphG5Ftm2bNCWD8mTpyr +MF_BOOTSTRAP_EVENT_CONSUMER=bootstrap +MF_BOOTSTRAP_ES_URL=es-redis:${MF_REDIS_TCP_PORT} +MF_BOOTSTRAP_ES_PASS= +MF_BOOTSTRAP_ES_DB=0 +MF_BOOTSTRAP_HTTP_HOST=bootstrap +MF_BOOTSTRAP_HTTP_PORT=9013 +MF_BOOTSTRAP_HTTP_SERVER_CERT= +MF_BOOTSTRAP_HTTP_SERVER_KEY= +MF_BOOTSTRAP_DB_HOST=bootstrap-db MF_BOOTSTRAP_DB_PORT=5432 MF_BOOTSTRAP_DB_USER=mainflux MF_BOOTSTRAP_DB_PASS=mainflux -MF_BOOTSTRAP_DB=bootstrap +MF_BOOTSTRAP_DB_NAME=bootstrap MF_BOOTSTRAP_DB_SSL_MODE=disable +MF_BOOTSTRAP_DB_SSL_CERT= +MF_BOOTSTRAP_DB_SSL_KEY= +MF_BOOTSTRAP_DB_SSL_ROOT_CERT= MF_BOOTSTRAP_INSTANCE_ID= ### Provision @@ -165,29 +216,27 @@ MF_PROVISION_INSTANCE_ID= # Certs MF_CERTS_LOG_LEVEL=debug +MF_SDK_CERTS_URL=http://localhost +MF_CERTS_SIGN_CA_PATH=/etc/ssl/certs/ca.crt +MF_CERTS_SIGN_CA_KEY_PATH=/etc/ssl/certs/ca.key +MF_CERTS_VAULT_HOST=http://vault:8200 +MF_VAULT_PKI_INT_PATH=pki_int +MF_VAULT_CA_ROLE_NAME=mainflux +MF_CERTS_HTTP_HOST=certs MF_CERTS_HTTP_PORT=9019 +MF_CERTS_HTTP_SERVER_CERT= +MF_CERTS_HTTP_SERVER_KEY= MF_CERTS_DB_HOST=certs-db MF_CERTS_DB_PORT=5432 MF_CERTS_DB_USER=mainflux MF_CERTS_DB_PASS=mainflux -MF_CERTS_DB=certs +MF_CERTS_DB_NAME=certs MF_CERTS_DB_SSL_MODE= MF_CERTS_DB_SSL_CERT= MF_CERTS_DB_SSL_KEY= MF_CERTS_DB_SSL_ROOT_CERT= -MF_CERTS_ENCRYPT_KEY= -MF_CERTS_CLIENT_TLS= -MF_CERTS_CA_CERTS= -MF_CERTS_SERVER_CERT= -MF_CERTS_SERVER_KEY= -MF_CERTS_SIGN_CA_PATH=/etc/ssl/certs/ca.crt -MF_CERTS_SIGN_CA_KEY_PATH=/etc/ssl/certs/ca.key -MF_CERTS_SIGN_HOURS_VALID=2048h -MF_CERTS_SIGN_RSA_BITS=2048 -MF_CERTS_VAULT_HOST=http://vault:8200 MF_CERTS_INSTANCE_ID= - ### Vault MF_VAULT_HOST=vault MF_VAULT_PORT=8200 @@ -212,191 +261,232 @@ MF_LORA_ADAPTER_MESSAGES_TOPIC=application/+/device/+/event/up MF_LORA_ADAPTER_MESSAGES_USER= MF_LORA_ADAPTER_MESSAGES_PASS= MF_LORA_ADAPTER_MESSAGES_TIMEOUT=30s +MF_LORA_ADAPTER_EVENT_CONSUMER=lora +MF_LORA_ADAPTER_HTTP_HOST=lora-adapter MF_LORA_ADAPTER_HTTP_PORT=9017 -MF_LORA_ADAPTER_ROUTE_MAP_URL=localhost:6379 +MF_LORA_ADAPTER_HTTP_SERVER_CERT= +MF_LORA_ADAPTER_HTTP_SERVER_KEY= +MF_LORA_ADAPTER_ROUTE_MAP_URL=lora-redis:${MF_REDIS_TCP_PORT} MF_LORA_ADAPTER_ROUTE_MAP_PASS= MF_LORA_ADAPTER_ROUTE_MAP_DB=0 MF_LORA_ADAPTER_INSTANCE_ID= ### OPC-UA -MF_OPCUA_ADAPTER_HTTP_PORT=8188 MF_OPCUA_ADAPTER_LOG_LEVEL=debug -MF_OPCUA_ADAPTER_POLICY= -MF_OPCUA_ADAPTER_MODE= -MF_OPCUA_ADAPTER_CERT_FILE= -MF_OPCUA_ADAPTER_KEY_FILE= -MF_OPCUA_ADAPTER_ROUTE_MAP_URL=localhost:6379 +MF_OPCUA_ADAPTER_EVENT_CONSUMER=opcua +MF_OPCUA_ADAPTER_HTTP_HOST=opcua-adapter +MF_OPCUA_ADAPTER_HTTP_PORT=8188 +MF_OPCUA_ADAPTER_HTTP_SERVER_CERT= +MF_OPCUA_ADAPTER_HTTP_SERVER_KEY= +MF_OPCUA_ADAPTER_ES_URL=es-redis:${MF_REDIS_TCP_PORT} +MF_OPCUA_ADAPTER_ES_PASS= +MF_OPCUA_ADAPTER_ES_DB=0 +MF_OPCUA_ADAPTER_ROUTE_MAP_URL=opcua-redis:${MF_REDIS_TCP_PORT} MF_OPCUA_ADAPTER_ROUTE_MAP_PASS= MF_OPCUA_ADAPTER_ROUTE_MAP_DB=0 -MF_OPCUA_ADAPTER_EVENT_CONSUMER=opcua MF_OPCUA_ADAPTER_INSTANCE_ID= +### Cassandra +MF_CASSANDRA_CLUSTER=mainflux-cassandra +MF_CASSANDRA_KEYSPACE=mainflux +MF_CASSANDRA_USER=mainflux +MF_CASSANDRA_PASS=mainflux +MF_CASSANDRA_PORT=9042 + ### Cassandra Writer MF_CASSANDRA_WRITER_LOG_LEVEL=debug -MF_CASSANDRA_WRITER_PORT=9004 -MF_CASSANDRA_WRITER_DB_PORT=9042 -MF_CASSANDRA_WRITER_DB_CLUSTER=mainflux-cassandra -MF_CASSANDRA_WRITER_DB_KEYSPACE=mainflux +MF_CASSANDRA_WRITER_CONFIG_PATH=/config.toml +MF_CASSANDRA_WRITER_HTTP_HOST=cassandra-writer +MF_CASSANDRA_WRITER_HTTP_PORT=9004 +MF_CASSANDRA_WRITER_HTTP_SERVER_CERT= +MF_CASSANDRA_WRITER_HTTP_SERVER_KEY= +MF_CASSANDRA_WRITER_INSTANCE_ID= ### Cassandra Reader MF_CASSANDRA_READER_LOG_LEVEL=debug -MF_CASSANDRA_READER_PORT=9003 -MF_CASSANDRA_READER_DB_PORT=9042 -MF_CASSANDRA_READER_DB_CLUSTER=mainflux-cassandra -MF_CASSANDRA_READER_DB_KEYSPACE=mainflux -MF_CASSANDRA_READER_SERVER_CERT= -MF_CASSANDRA_READER_SERVER_KEY= -MF_CASSANDRA_WRITER_INSANCE_ID= +MF_CASSANDRA_READER_HTTP_HOST=cassandra-reader +MF_CASSANDRA_READER_HTTP_PORT=9003 +MF_CASSANDRA_READER_HTTP_SERVER_CERT= +MF_CASSANDRA_READER_HTTP_SERVER_KEY= +MF_CASSANDRA_READER_INSTANCE_ID= ### InfluxDB -MF_INFLUXDB_PORT=8086 +MF_INFLUXDB_PROTOCOL=http MF_INFLUXDB_HOST=mainflux-influxdb +MF_INFLUXDB_PORT=8086 MF_INFLUXDB_ADMIN_USER=mainflux MF_INFLUXDB_ADMIN_PASSWORD=mainflux -MF_INFLUXDB_ADMIN_URL="http://localhost:8086" -MF_INFLUXDB_PROTOCOL=http -MF_INFLUXDB_TIMEOUT=1s -MF_INFLUXDB_ORG=mainflux +MF_INFLUXDB_NAME=mainflux MF_INFLUXDB_BUCKET=mainflux-bucket +MF_INFLUXDB_ORG=mainflux MF_INFLUXDB_TOKEN=mainflux-token -MF_INFLUXDB_HTTP_ENABLED=true +MF_INFLUXDB_DBURL= +MF_INFLUXDB_USER_AGENT=InfluxDBClient +MF_INFLUXDB_TIMEOUT=1s +MF_INFLUXDB_INSECURE_SKIP_VERIFY=false MF_INFLUXDB_INIT_MODE=setup +MF_INFLUXDB_ADMIN_URL=http://${MF_INFLUXDB_HOST}:${MF_INFLUXDB_PORT} +MF_INFLUXDB_HTTP_ENABLED=true ### InfluxDB Writer MF_INFLUX_WRITER_LOG_LEVEL=debug -MF_INFLUX_WRITER_PORT=9006 -MF_INFLUX_WRITER_BATCH_SIZE=5000 -MF_INFLUX_WRITER_BATCH_TIMEOUT=5 +MF_INFLUX_WRITER_CONFIG_PATH=/config.toml +MF_INFLUX_WRITER_HTTP_HOST=influxdb-writer +MF_INFLUX_WRITER_HTTP_PORT=9006 +MF_INFLUX_WRITER_HTTP_SERVER_CERT= +MF_INFLUX_WRITER_HTTP_SERVER_KEY= MF_INFLUX_WRITER_INSTANCE_ID= ### InfluxDB Reader MF_INFLUX_READER_LOG_LEVEL=debug -MF_INFLUX_READER_PORT=9005 -MF_INFLUX_READER_SERVER_KEY= -MF_INFLUX_READER_SERVER_CERT= -MF_INFLUXDB_DB=mainflux +MF_INFLUX_READER_HTTP_HOST=influxdb-reader +MF_INFLUX_READER_HTTP_PORT=9005 +MF_INFLUX_READER_HTTP_SERVER_CERT= +MF_INFLUX_READER_HTTP_SERVER_KEY= MF_INFLUX_READER_INSTANCE_ID= +### MongoDB +MF_MONGO_HOST=mainflux-mongodb +MF_MONGO_PORT=27017 +MF_MONGO_NAME=mainflux + ### MongoDB Writer MF_MONGO_WRITER_LOG_LEVEL=debug -MF_MONGO_WRITER_PORT=9008 -MF_MONGO_WRITER_DB=mainflux -MF_MONGO_WRITER_DB_PORT=27017 +MF_MONGO_WRITER_CONFIG_PATH=/config.toml +MF_MONGO_WRITER_HTTP_HOST=mongodb-writer +MF_MONGO_WRITER_HTTP_PORT=9008 +MF_MONGO_WRITER_HTTP_SERVER_CERT= +MF_MONGO_WRITER_HTTP_SERVER_KEY= MF_MONGO_WRITER_INSTANCE_ID= ### MongoDB Reader MF_MONGO_READER_LOG_LEVEL=debug -MF_MONGO_READER_PORT=9007 -MF_MONGO_READER_DB=mainflux -MF_MONGO_READER_DB_PORT=27017 -MF_MONGO_READER_SERVER_CERT= -MF_MONGO_READER_SERVER_KEY= +MF_MONGO_READER_HTTP_HOST=mongodb-reader +MF_MONGO_READER_HTTP_PORT=9007 +MF_MONGO_READER_HTTP_SERVER_CERT= +MF_MONGO_READER_HTTP_SERVER_KEY= MF_MONGO_READER_INSTANCE_ID= +### Postgres +MF_POSTGRES_HOST=mainflux-postgres +MF_POSTGRES_PORT=5432 +MF_POSTGRES_USER=mainflux +MF_POSTGRES_PASS=mainflux +MF_POSTGRES_NAME=mainflux +MF_POSTGRES_SSL_MODE=disable +MF_POSTGRES_SSL_CERT= +MF_POSTGRES_SSL_KEY= +MF_POSTGRES_SSL_ROOT_CERT= + ### Postgres Writer MF_POSTGRES_WRITER_LOG_LEVEL=debug -MF_POSTGRES_WRITER_PORT=9010 -MF_POSTGRES_WRITER_DB_PORT=5432 -MF_POSTGRES_WRITER_DB_USER=mainflux -MF_POSTGRES_WRITER_DB_PASS=mainflux -MF_POSTGRES_WRITER_DB=mainflux -MF_POSTGRES_WRITER_DB_SSL_MODE=disable -MF_POSTGRES_WRITER_DB_SSL_CERT="" -MF_POSTGRES_WRITER_DB_SSL_KEY="" -MF_POSTGRES_WRITER_DB_SSL_ROOT_CERT="" +MF_POSTGRES_WRITER_CONFIG_PATH=/config.toml +MF_POSTGRES_WRITER_HTTP_HOST=postgres-writer +MF_POSTGRES_WRITER_HTTP_PORT=9010 +MF_POSTGRES_WRITER_HTTP_SERVER_CERT= +MF_POSTGRES_WRITER_HTTP_SERVER_KEY= MF_POSTGRES_WRITER_INSTANCE_ID= ### Postgres Reader MF_POSTGRES_READER_LOG_LEVEL=debug -MF_POSTGRES_READER_PORT=9009 -MF_POSTGRES_READER_CLIENT_TLS=false -MF_POSTGRES_READER_CA_CERTS="" -MF_POSTGRES_READER_DB_PORT=5432 -MF_POSTGRES_READER_DB_USER=mainflux -MF_POSTGRES_READER_DB_PASS=mainflux -MF_POSTGRES_READER_DB=mainflux -MF_POSTGRES_READER_DB_SSL_MODE=disable -MF_POSTGRES_READER_DB_SSL_CERT="" -MF_POSTGRES_READER_DB_SSL_KEY="" -MF_POSTGRES_READER_DB_SSL_ROOT_CERT="" +MF_POSTGRES_READER_HTTP_HOST=postgres-reader +MF_POSTGRES_READER_HTTP_PORT=9009 +MF_POSTGRES_READER_HTTP_SERVER_CERT= +MF_POSTGRES_READER_HTTP_SERVER_KEY= MF_POSTGRES_READER_INSTANCE_ID= +### Timescale +MF_TIMESCALE_HOST=mainflux-timescale +MF_TIMESCALE_PORT=5432 +MF_TIMESCALE_USER=mainflux +MF_TIMESCALE_PASS=mainflux +MF_TIMESCALE_NAME=mainflux +MF_TIMESCALE_SSL_MODE=disable +MF_TIMESCALE_SSL_CERT= +MF_TIMESCALE_SSL_KEY= +MF_TIMESCALE_SSL_ROOT_CERT= + ### Timescale Writer MF_TIMESCALE_WRITER_LOG_LEVEL=debug -MF_TIMESCALE_WRITER_PORT=9012 -MF_TIMESCALE_WRITER_DB_PORT=5432 -MF_TIMESCALE_WRITER_DB_USER=mainflux -MF_TIMESCALE_WRITER_DB_PASS=mainflux -MF_TIMESCALE_WRITER_DB=mainflux -MF_TIMESCALE_WRITER_DB_SSL_MODE=disable -MF_TIMESCALE_WRITER_DB_SSL_CERT="" -MF_TIMESCALE_WRITER_DB_SSL_KEY="" -MF_TIMESCALE_WRITER_DB_SSL_ROOT_CERT="" +MF_TIMESCALE_WRITER_CONFIG_PATH=/config.toml +MF_TIMESCALE_WRITER_HTTP_HOST=timescale-writer +MF_TIMESCALE_WRITER_HTTP_PORT=9012 +MF_TIMESCALE_WRITER_HTTP_SERVER_CERT= +MF_TIMESCALE_WRITER_HTTP_SERVER_KEY= MF_TIMESCALE_WRITER_INSTANCE_ID= ### Timescale Reader MF_TIMESCALE_READER_LOG_LEVEL=debug -MF_TIMESCALE_READER_PORT=9011 -MF_TIMESCALE_READER_CLIENT_TLS=false -MF_TIMESCALE_READER_CA_CERTS="" -MF_TIMESCALE_READER_DB_PORT=5432 -MF_TIMESCALE_READER_DB_USER=mainflux -MF_TIMESCALE_READER_DB_PASS=mainflux -MF_TIMESCALE_READER_DB=mainflux -MF_TIMESCALE_READER_DB_SSL_MODE=disable -MF_TIMESCALE_READER_DB_SSL_CERT="" -MF_TIMESCALE_READER_DB_SSL_KEY="" -MF_TIMESCALE_READER_DB_SSL_ROOT_CERT="" +MF_TIMESCALE_READER_HTTP_HOST=timescale-reader +MF_TIMESCALE_READER_HTTP_PORT=9011 +MF_TIMESCALE_READER_HTTP_SERVER_CERT= +MF_TIMESCALE_READER_HTTP_SERVER_KEY= MF_TIMESCALE_READER_INSTANCE_ID= ### Twins MF_TWINS_LOG_LEVEL=debug -MF_TWINS_HTTP_PORT=9018 -MF_TWINS_SERVER_CERT="" -MF_TWINS_SERVER_KEY="" -MF_TWINS_DB=mainflux-twins -MF_TWINS_DB_HOST=twins-db -MF_TWINS_DB_PORT=27018 -MF_TWINS_STANDALONE_EMAIL="" -MF_TWINS_STANDALONE_TOKEN="" -MF_TWINS_CLIENT_TLS="" -MF_TWINS_CA_CERTS="" +MF_TWINS_STANDALONE_ID= +MF_TWINS_STANDALONE_TOKEN= MF_TWINS_CHANNEL_ID= -MF_TWINS_INSTANCE_ID= -MF_TWINS_CACHE_URL=es-redis:6379 +MF_TWINS_HTTP_HOST=twins +MF_TWINS_HTTP_PORT=9018 +MF_TWINS_HTTP_SERVER_CERT= +MF_TWINS_HTTP_SERVER_KEY= +MF_TWINS_CACHE_URL=twins-redis:${MF_REDIS_TCP_PORT} MF_TWINS_CACHE_PASS= MF_TWINS_CACHE_DB=0 MF_THINGS_ES_URL=es-redis:${MF_REDIS_TCP_PORT} MF_THINGS_ES_PASS= -MF_THINGS_ES_DB= +MF_THINGS_ES_DB=0 +MF_TWINS_DB_HOST=twins-db +MF_TWINS_DB_PORT=27018 +MF_TWINS_DB_NAME=twins +MF_TWINS_INSTANCE_ID= ### SMTP Notifier -MF_SMTP_NOTIFIER_PORT=9015 MF_SMTP_NOTIFIER_LOG_LEVEL=debug +MF_SMTP_NOTIFIER_CONFIG_PATH=/config.toml +MF_SMTP_NOTIFIER_FROM_ADDR= +MF_SMTP_NOTIFIER_HTTP_HOST=smtp-notifier +MF_SMTP_NOTIFIER_HTTP_PORT=9015 +MF_SMTP_NOTIFIER_HTTP_SERVER_CERT= +MF_SMTP_NOTIFIER_HTTP_SERVER_KEY= +MF_SMTP_NOTIFIER_DB_HOST=smtp-notifier-db MF_SMTP_NOTIFIER_DB_PORT=5432 MF_SMTP_NOTIFIER_DB_USER=mainflux MF_SMTP_NOTIFIER_DB_PASS=mainflux -MF_SMTP_NOTIFIER_DB=subscriptions -MF_SMTP_NOTIFIER_TEMPLATE=smtp-notifier.tmpl -MF_SMTP_NOTIFIER_FROM_ADDR=from@example.com +MF_SMTP_NOTIFIER_DB_NAME=subscriptions +MF_SMTP_NOTIFIER_DB_SSL_MODE=disable +MF_SMTP_NOTIFIER_DB_SSL_CERT= +MF_SMTP_NOTIFIER_DB_SSL_KEY= +MF_SMTP_NOTIFIER_DB_SSL_ROOT_CERT= +MF_SMTP_NOTIFIER_EMAIL_TEMPLATE=smtp-notifier.tmpl MF_SMTP_NOTIFIER_INSTANCE_ID= ### SMPP Notifier -MF_SMPP_NOTIFIER_PORT=9014 MF_SMPP_NOTIFIER_LOG_LEVEL=debug -MF_SMPP_NOTIFIER_DB_HOST= +MF_SMPP_NOTIFIER_FROM_ADDR= +MF_SMPP_NOTIFIER_CONFIG_PATH=/config.toml +MF_SMPP_NOTIFIER_HTTP_HOST=smpp-notifier +MF_SMPP_NOTIFIER_HTTP_PORT=9014 +MF_SMPP_NOTIFIER_HTTP_SERVER_CERT= +MF_SMPP_NOTIFIER_HTTP_SERVER_KEY= +MF_SMPP_NOTIFIER_DB_HOST=smpp-notifier-db MF_SMPP_NOTIFIER_DB_PORT=5432 MF_SMPP_NOTIFIER_DB_USER=mainflux MF_SMPP_NOTIFIER_DB_PASS=mainflux -MF_SMPP_NOTIFIER_DB=subscriptions +MF_SMPP_NOTIFIER_DB_NAME=subscriptions +MF_SMPP_NOTIFIER_DB_SSL_MODE=disable +MF_SMPP_NOTIFIER_DB_SSL_CERT= +MF_SMPP_NOTIFIER_DB_SSL_KEY= +MF_SMPP_NOTIFIER_DB_SSL_ROOT_CERT= MF_SMPP_ADDRESS=localhost:2775 MF_SMPP_USERNAME= MF_SMPP_PASSWORD= -MF_SMPP_SYSTEM_TYPE="" -MF_SMPP_NOTIFIER_SOURCE_ADDR= +MF_SMPP_SYSTEM_TYPE= MF_SMPP_SRC_ADDR_TON=5 -MF_SMPP_SRC_ADDR_NPI=0 MF_SMPP_DST_ADDR_TON=1 +MF_SMPP_SRC_ADDR_NPI=0 MF_SMPP_DST_ADDR_NPI=1 MF_SMPP_NOTIFIER_INSTANCE_ID= diff --git a/docker/addons/bootstrap/docker-compose.yml b/docker/addons/bootstrap/docker-compose.yml index ce507b801b0..97c877a4984 100644 --- a/docker/addons/bootstrap/docker-compose.yml +++ b/docker/addons/bootstrap/docker-compose.yml @@ -15,6 +15,7 @@ networks: volumes: mainflux-bootstrap-db-volume: + services: bootstrap-db: image: postgres:13.3-alpine @@ -23,7 +24,7 @@ services: environment: POSTGRES_USER: ${MF_BOOTSTRAP_DB_USER} POSTGRES_PASSWORD: ${MF_BOOTSTRAP_DB_PASS} - POSTGRES_DB: ${MF_BOOTSTRAP_DB} + POSTGRES_DB: ${MF_BOOTSTRAP_DB_NAME} networks: - docker_mainflux-base-net volumes: @@ -36,21 +37,32 @@ services: - bootstrap-db restart: on-failure ports: - - ${MF_BOOTSTRAP_PORT}:${MF_BOOTSTRAP_PORT} + - ${MF_BOOTSTRAP_HTTP_PORT}:${MF_BOOTSTRAP_HTTP_PORT} environment: MF_BOOTSTRAP_LOG_LEVEL: ${MF_BOOTSTRAP_LOG_LEVEL} - MF_BOOTSTRAP_DB_HOST: bootstrap-db + MF_BOOTSTRAP_ENCRYPT_KEY: ${MF_BOOTSTRAP_ENCRYPT_KEY} + MF_BOOTSTRAP_EVENT_CONSUMER: ${MF_BOOTSTRAP_EVENT_CONSUMER} + MF_BOOTSTRAP_ES_URL: ${MF_BOOTSTRAP_ES_URL} + MF_BOOTSTRAP_ES_PASS: ${MF_BOOTSTRAP_ES_PASS} + MF_BOOTSTRAP_ES_DB: ${MF_BOOTSTRAP_ES_DB} + MF_BOOTSTRAP_HTTP_HOST: ${MF_BOOTSTRAP_HTTP_HOST} + MF_BOOTSTRAP_HTTP_PORT: ${MF_BOOTSTRAP_HTTP_PORT} + MF_BOOTSTRAP_HTTP_SERVER_CERT: ${MF_BOOTSTRAP_HTTP_SERVER_CERT} + MF_BOOTSTRAP_HTTP_SERVER_KEY: ${MF_BOOTSTRAP_HTTP_SERVER_KEY} + MF_BOOTSTRAP_DB_HOST: ${MF_BOOTSTRAP_DB_HOST} MF_BOOTSTRAP_DB_PORT: ${MF_BOOTSTRAP_DB_PORT} MF_BOOTSTRAP_DB_USER: ${MF_BOOTSTRAP_DB_USER} MF_BOOTSTRAP_DB_PASS: ${MF_BOOTSTRAP_DB_PASS} - MF_BOOTSTRAP_DB: ${MF_BOOTSTRAP_DB} + MF_BOOTSTRAP_DB_NAME: ${MF_BOOTSTRAP_DB_NAME} MF_BOOTSTRAP_DB_SSL_MODE: ${MF_BOOTSTRAP_DB_SSL_MODE} - MF_BOOTSTRAP_PORT: ${MF_BOOTSTRAP_PORT} - MF_THINGS_URL: ${MF_THINGS_URL} - MF_THINGS_ES_URL: es-redis:${MF_REDIS_TCP_PORT} - MF_BOOTSTRAP_ES_URL: es-redis:${MF_REDIS_TCP_PORT} + MF_BOOTSTRAP_DB_SSL_CERT: ${MF_BOOTSTRAP_DB_SSL_CERT} + MF_BOOTSTRAP_DB_SSL_KEY: ${MF_BOOTSTRAP_DB_SSL_KEY} + MF_BOOTSTRAP_DB_SSL_ROOT_CERT: ${MF_BOOTSTRAP_DB_SSL_ROOT_CERT} MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} - MF_AUTH_GRPC_TIMMEOUT: ${MF_USERS_GRPC_TIMEOUT} + MF_AUTH_GRPC_TIMEOUT: ${MF_USERS_GRPC_TIMEOUT} + MF_AUTH_GRPC_CLIENT_TLS: ${MF_USERS_GRPC_CLIENT_TLS} + MF_AUTH_GRPC_CA_CERT: ${MF_USERS_GRPC_CA_CERT} + MF_THINGS_URL: ${MF_THINGS_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_BOOTSTRAP_INSTANCE_ID: ${MF_BOOTSTRAP_INSTANCE_ID} diff --git a/docker/addons/cassandra-reader/docker-compose.yml b/docker/addons/cassandra-reader/docker-compose.yml index d43dea162bf..7a5ad27e091 100644 --- a/docker/addons/cassandra-reader/docker-compose.yml +++ b/docker/addons/cassandra-reader/docker-compose.yml @@ -19,19 +19,28 @@ services: restart: on-failure environment: MF_CASSANDRA_READER_LOG_LEVEL: ${MF_CASSANDRA_READER_LOG_LEVEL} - MF_CASSANDRA_READER_PORT: ${MF_CASSANDRA_READER_PORT} - MF_CASSANDRA_READER_DB_CLUSTER: ${MF_CASSANDRA_READER_DB_CLUSTER} - MF_CASSANDRA_READER_DB_KEYSPACE: ${MF_CASSANDRA_READER_DB_KEYSPACE} - MF_CASSANDRA_READER_SERVER_CERT: ${MF_CASSANDRA_READER_SERVER_CERT} - MF_CASSANDRA_READER_SERVER_KEY: ${MF_CASSANDRA_READER_SERVER_KEY} + MF_CASSANDRA_READER_HTTP_HOST: ${MF_CASSANDRA_READER_HTTP_HOST} + MF_CASSANDRA_READER_HTTP_PORT: ${MF_CASSANDRA_READER_HTTP_PORT} + MF_CASSANDRA_READER_HTTP_SERVER_CERT: ${MF_CASSANDRA_READER_HTTP_SERVER_CERT} + MF_CASSANDRA_READER_HTTP_SERVER_KEY: ${MF_CASSANDRA_READER_HTTP_SERVER_KEY} + MF_CASSANDRA_PORT: ${MF_CASSANDRA_PORT} + MF_CASSANDRA_CLUSTER: ${MF_CASSANDRA_CLUSTER} + MF_CASSANDRA_KEYSPACE: ${MF_CASSANDRA_KEYSPACE} + MF_CASSANDRA_USER: ${MF_CASSANDRA_USER} + MF_CASSANDRA_PASS: ${MF_CASSANDRA_PASS} MF_THINGS_AUTH_GRPC_URL: ${MF_THINGS_AUTH_GRPC_URL} MF_THINGS_AUTH_GRPC_TIMEOUT: ${MF_THINGS_AUTH_GRPC_TIMEOUT} + MF_THINGS_AUTH_GRPC_CLIENT_TLS: ${MF_THINGS_AUTH_GRPC_CLIENT_TLS} + MF_THINGS_AUTH_GRPC_CA_CERTS: ${MF_THINGS_AUTH_GRPC_CA_CERTS} MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} MF_AUTH_GRPC_TIMEOUT : ${MF_USERS_GRPC_TIMEOUT} + MF_AUTH_GRPC_CLIENT_TLS: ${MF_USERS_GRPC_CLIENT_TLS} + MF_AUTH_GRPC_CA_CERT: ${MF_USERS_GRPC_CA_CERT} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_CASSANDRA_READER_INSTANCE_ID: ${MF_CASSANDRA_READER_INSTANCE_ID} ports: - - ${MF_CASSANDRA_READER_PORT}:${MF_CASSANDRA_READER_PORT} + - ${MF_CASSANDRA_READER_HTTP_PORT}:${MF_CASSANDRA_READER_HTTP_PORT} networks: - docker_mainflux-base-net volumes: diff --git a/docker/addons/cassandra-writer/docker-compose.yml b/docker/addons/cassandra-writer/docker-compose.yml index ddd70b0299c..e9d8ebcfb81 100644 --- a/docker/addons/cassandra-writer/docker-compose.yml +++ b/docker/addons/cassandra-writer/docker-compose.yml @@ -23,7 +23,7 @@ services: networks: - docker_mainflux-base-net ports: - - ${MF_CASSANDRA_WRITER_DB_PORT}:${MF_CASSANDRA_WRITER_DB_PORT} + - ${MF_CASSANDRA_PORT}:${MF_CASSANDRA_PORT} volumes: - mainflux-cassandra-volume:/var/lib/cassandra @@ -35,16 +35,22 @@ services: restart: on-failure environment: MF_CASSANDRA_WRITER_LOG_LEVEL: ${MF_CASSANDRA_WRITER_LOG_LEVEL} + MF_CASSANDRA_WRITER_CONFIG_PATH: ${MF_CASSANDRA_WRITER_CONFIG_PATH} + MF_CASSANDRA_WRITER_HTTP_HOST: ${MF_CASSANDRA_WRITER_HTTP_HOST} + MF_CASSANDRA_WRITER_HTTP_PORT: ${MF_CASSANDRA_WRITER_HTTP_PORT} + MF_CASSANDRA_WRITER_HTTP_SERVER_CERT: ${MF_CASSANDRA_WRITER_HTTP_SERVER_CERT} + MF_CASSANDRA_WRITER_HTTP_SERVER_KEY: ${MF_CASSANDRA_WRITER_HTTP_SERVER_KEY} + MF_CASSANDRA_PORT: ${MF_CASSANDRA_PORT} + MF_CASSANDRA_CLUSTER: ${MF_CASSANDRA_CLUSTER} + MF_CASSANDRA_KEYSPACE: ${MF_CASSANDRA_KEYSPACE} + MF_CASSANDRA_USER: ${MF_CASSANDRA_USER} + MF_CASSANDRA_PASS: ${MF_CASSANDRA_PASS} MF_BROKER_URL: ${MF_BROKER_URL} - MF_CASSANDRA_WRITER_PORT: ${MF_CASSANDRA_WRITER_PORT} - MF_CASSANDRA_WRITER_DB_PORT: ${MF_CASSANDRA_WRITER_DB_PORT} - MF_CASSANDRA_WRITER_DB_CLUSTER: ${MF_CASSANDRA_WRITER_DB_CLUSTER} - MF_CASSANDRA_WRITER_DB_KEYSPACE: ${MF_CASSANDRA_WRITER_DB_KEYSPACE} MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_CASSANDRA_WRITER_INSANCE_ID: ${MF_CASSANDRA_WRITER_INSANCE_ID} ports: - - ${MF_CASSANDRA_WRITER_PORT}:${MF_CASSANDRA_WRITER_PORT} + - ${MF_CASSANDRA_WRITER_HTTP_PORT}:${MF_CASSANDRA_WRITER_HTTP_PORT} networks: - docker_mainflux-base-net volumes: diff --git a/docker/addons/certs/docker-compose.yml b/docker/addons/certs/docker-compose.yml index e6829813a9b..d8aa50c53b4 100644 --- a/docker/addons/certs/docker-compose.yml +++ b/docker/addons/certs/docker-compose.yml @@ -12,10 +12,10 @@ networks: docker_mainflux-base-net: external: true - volumes: mainflux-certs-db-volume: + services: certs-db: image: postgres:13.3-alpine @@ -24,7 +24,7 @@ services: environment: POSTGRES_USER: ${MF_CERTS_DB_USER} POSTGRES_PASSWORD: ${MF_CERTS_DB_PASS} - POSTGRES_DB: ${MF_CERTS_DB} + POSTGRES_DB: ${MF_CERTS_DB_NAME} networks: - docker_mainflux-base-net volumes: @@ -42,33 +42,32 @@ services: - ${MF_CERTS_HTTP_PORT}:${MF_CERTS_HTTP_PORT} environment: MF_CERTS_LOG_LEVEL: ${MF_CERTS_LOG_LEVEL} - MF_CERTS_DB_HOST: certs-db + MF_SDK_CERTS_URL: ${MF_SDK_CERTS_URL} + MF_CERTS_SIGN_CA_PATH: ${MF_CERTS_SIGN_CA_PATH} + MF_CERTS_SIGN_CA_KEY_PATH: ${MF_CERTS_SIGN_CA_KEY_PATH} + MF_CERTS_VAULT_HOST: ${MF_CERTS_VAULT_HOST} + MF_VAULT_PKI_INT_PATH: ${MF_VAULT_PKI_INT_PATH} + MF_VAULT_CA_ROLE_NAME: ${MF_VAULT_CA_ROLE_NAME} + MF_VAULT_PKI_PATH: ${MF_VAULT_PKI_PATH} + MF_VAULT_TOKEN: ${MF_VAULT_TOKEN} + MF_CERTS_HTTP_HOST: ${MF_CERTS_HTTP_HOST} + MF_CERTS_HTTP_PORT: ${MF_CERTS_HTTP_PORT} + MF_CERTS_HTTP_SERVER_CERT: ${MF_CERTS_HTTP_SERVER_CERT} + MF_CERTS_HTTP_SERVER_KEY: ${MF_CERTS_HTTP_SERVER_KEY} + MF_CERTS_DB_HOST: ${MF_CERTS_DB_HOST} MF_CERTS_DB_PORT: ${MF_CERTS_DB_PORT} MF_CERTS_DB_PASS: ${MF_CERTS_DB_PASS} MF_CERTS_DB_USER: ${MF_CERTS_DB_USER} - MF_CERTS_DB: ${MF_CERTS_DB} + MF_CERTS_DB_NAME: ${MF_CERTS_DB_NAME} MF_CERTS_DB_SSL_MODE: ${MF_CERTS_DB_SSL_MODE} MF_CERTS_DB_SSL_CERT: ${MF_CERTS_DB_SSL_CERT} MF_CERTS_DB_SSL_KEY: ${MF_CERTS_DB_SSL_KEY} MF_CERTS_DB_SSL_ROOT_CERT: ${MF_CERTS_DB_SSL_ROOT_CERT} - MF_CERTS_ENCRYPT_KEY: ${MF_CERTS_ENCRYPT_KEY} - MF_CERTS_CLIENT_TLS: ${MF_CERTS_CLIENT_TLS} - MF_CERTS_CA_CERTS: ${MF_CERTS_CA_CERTS} - MF_CERTS_HTTP_PORT: ${MF_CERTS_HTTP_PORT} - MF_CERTS_SERVER_CERT: ${MF_CERTS_SERVER_CERT} - MF_CERTS_SERVER_KEY: ${MF_CERTS_SERVER_KEY} - MF_CERTS_SIGN_CA_PATH: ${MF_CERTS_SIGN_CA_PATH} - MF_CERTS_SIGN_CA_KEY_PATH: ${MF_CERTS_SIGN_CA_KEY_PATH} - MF_CERTS_SIGN_HOURS_VALID: ${MF_CERTS_SIGN_HOURS_VALID} - MF_CERTS_SIGN_RSA_BITS: ${MF_CERTS_SIGN_RSA_BITS} - MF_VAULT_TOKEN: ${MF_VAULT_TOKEN} - MF_VAULT_CA_NAME: ${MF_VAULT_CA_NAME} - MF_VAULT_CA_ROLE_NAME: ${MF_VAULT_CA_ROLE_NAME} - MF_VAULT_PKI_PATH: ${MF_VAULT_PKI_PATH} - MF_THINGS_URL: ${MF_THINGS_URL} MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} MF_AUTH_GRPC_TIMEOUT: ${MF_USERS_GRPC_TIMEOUT} - MF_CERTS_VAULT_HOST: ${MF_CERTS_VAULT_HOST} + MF_AUTH_GRPC_CLIENT_TLS: ${MF_USERS_GRPC_CLIENT_TLS} + MF_AUTH_GRPC_CA_CERT: ${MF_USERS_GRPC_CA_CERT} + MF_THINGS_URL: ${MF_THINGS_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_CERTS_INSTANCE_ID: ${MF_CERTS_INSTANCE_ID} diff --git a/docker/addons/influxdb-reader/docker-compose.yml b/docker/addons/influxdb-reader/docker-compose.yml index b0e6a5da72b..88b808d082f 100644 --- a/docker/addons/influxdb-reader/docker-compose.yml +++ b/docker/addons/influxdb-reader/docker-compose.yml @@ -20,26 +20,37 @@ services: container_name: mainflux-influxdb-reader restart: on-failure environment: - MF_INFLUX_READER_LOG_LEVEL: debug - MF_INFLUX_READER_PORT: ${MF_INFLUX_READER_PORT} - MF_INFLUXDB_DB: ${MF_INFLUXDB_DB} - MF_INFLUXDB_HOST: mainflux-influxdb - MF_INFLUXDB_PORT: ${MF_INFLUXDB_PORT} - MF_INFLUXDB_TIMEOUT: ${MF_INFLUXDB_TIMEOUT} + MF_INFLUX_READER_LOG_LEVEL: ${MF_INFLUX_READER_LOG_LEVEL} + MF_INFLUX_READER_HTTP_HOST: ${MF_INFLUX_READER_HTTP_HOST} + MF_INFLUX_READER_HTTP_PORT: ${MF_INFLUX_READER_HTTP_PORT} + MF_INFLUX_READER_HTTP_SERVER_CERT: ${MF_INFLUX_READER_HTTP_SERVER_CERT} + MF_INFLUX_READER_HTTP_SERVER_KEY: ${MF_INFLUX_READER_HTTP_SERVER_KEY} MF_INFLUXDB_PROTOCOL: ${MF_INFLUXDB_PROTOCOL} + MF_INFLUXDB_HOST: ${MF_INFLUXDB_HOST} + MF_INFLUXDB_PORT: ${MF_INFLUXDB_PORT} MF_INFLUXDB_ADMIN_USER: ${MF_INFLUXDB_ADMIN_USER} MF_INFLUXDB_ADMIN_PASSWORD: ${MF_INFLUXDB_ADMIN_PASSWORD} - MF_INFLUXDB_ADMIN_URL: ${MF_INFLUXDB_ADMIN_URL} - MF_INFLUX_READER_SERVER_CERT: ${MF_INFLUX_READER_SERVER_CERT} - MF_INFLUX_READER_SERVER_KEY: ${MF_INFLUX_READER_SERVER_KEY} + MF_INFLUXDB_NAME: ${MF_INFLUXDB_NAME} + MF_INFLUXDB_BUCKET: ${MF_INFLUXDB_BUCKET} + MF_INFLUXDB_ORG: ${MF_INFLUXDB_ORG} + MF_INFLUXDB_TOKEN: ${MF_INFLUXDB_TOKEN} + MF_INFLUXDB_DBURL: ${MF_INFLUXDB_DBURL} + MF_INFLUXDB_USER_AGENT: ${MF_INFLUXDB_USER_AGENT} + MF_INFLUXDB_TIMEOUT: ${MF_INFLUXDB_TIMEOUT} + MF_INFLUXDB_INSECURE_SKIP_VERIFY: ${MF_INFLUXDB_INSECURE_SKIP_VERIFY} MF_THINGS_AUTH_GRPC_URL: ${MF_THINGS_AUTH_GRPC_URL} MF_THINGS_AUTH_GRPC_TIMEOUT: ${MF_THINGS_AUTH_GRPC_TIMEOUT} + MF_THINGS_AUTH_GRPC_CLIENT_TLS: ${MF_THINGS_AUTH_GRPC_CLIENT_TLS} + MF_THINGS_AUTH_GRPC_CA_CERTS: ${MF_THINGS_AUTH_GRPC_CA_CERTS} MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} MF_AUTH_GRPC_TIMEOUT : ${MF_USERS_GRPC_TIMEOUT} + MF_AUTH_GRPC_CLIENT_TLS: ${MF_USERS_GRPC_CLIENT_TLS} + MF_AUTH_GRPC_CA_CERT: ${MF_USERS_GRPC_CA_CERT} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_INFLUX_READER_INSTANCE_ID: ${MF_INFLUX_READER_INSTANCE_ID} ports: - - ${MF_INFLUX_READER_PORT}:${MF_INFLUX_READER_PORT} + - ${MF_INFLUX_READER_HTTP_PORT}:${MF_INFLUX_READER_HTTP_PORT} networks: - docker_mainflux-base-net volumes: diff --git a/docker/addons/influxdb-writer/docker-compose.yml b/docker/addons/influxdb-writer/docker-compose.yml index de264e5ee36..d26937ce89a 100644 --- a/docker/addons/influxdb-writer/docker-compose.yml +++ b/docker/addons/influxdb-writer/docker-compose.yml @@ -43,22 +43,31 @@ services: - influxdb restart: on-failure environment: - MF_INFLUX_WRITER_LOG_LEVEL: debug - MF_BROKER_URL: ${MF_BROKER_URL} - MF_INFLUX_WRITER_PORT: ${MF_INFLUX_WRITER_PORT} - MF_INFLUX_WRITER_BATCH_SIZE: ${MF_INFLUX_WRITER_BATCH_SIZE} - MF_INFLUX_WRITER_BATCH_TIMEOUT: ${MF_INFLUX_WRITER_BATCH_TIMEOUT} + MF_INFLUX_WRITER_LOG_LEVEL: ${MF_INFLUX_WRITER_LOG_LEVEL} + MF_INFLUX_WRITER_CONFIG_PATH: ${MF_INFLUX_WRITER_CONFIG_PATH} + MF_INFLUX_WRITER_HTTP_HOST: ${MF_INFLUX_WRITER_HTTP_HOST} + MF_INFLUX_WRITER_HTTP_PORT: ${MF_INFLUX_WRITER_HTTP_PORT} + MF_INFLUX_WRITER_HTTP_SERVER_CERT: ${MF_INFLUX_WRITER_HTTP_SERVER_CERT} + MF_INFLUX_WRITER_HTTP_SERVER_KEY: ${MF_INFLUX_WRITER_HTTP_SERVER_KEY} + MF_INFLUXDB_PROTOCOL: ${MF_INFLUXDB_PROTOCOL} MF_INFLUXDB_HOST: ${MF_INFLUXDB_HOST} MF_INFLUXDB_PORT: ${MF_INFLUXDB_PORT} - MF_INFLUXDB_TIMEOUT: ${MF_INFLUXDB_TIMEOUT} - MF_INFLUXDB_PROTOCOL: ${MF_INFLUXDB_PROTOCOL} MF_INFLUXDB_ADMIN_USER: ${MF_INFLUXDB_ADMIN_USER} MF_INFLUXDB_ADMIN_PASSWORD: ${MF_INFLUXDB_ADMIN_PASSWORD} + MF_INFLUXDB_NAME: ${MF_INFLUXDB_NAME} + MF_INFLUXDB_BUCKET: ${MF_INFLUXDB_BUCKET} + MF_INFLUXDB_ORG: ${MF_INFLUXDB_ORG} + MF_INFLUXDB_TOKEN: ${MF_INFLUXDB_TOKEN} + MF_INFLUXDB_DBURL: ${MF_INFLUXDB_DBURL} + MF_INFLUXDB_USER_AGENT: ${MF_INFLUXDB_USER_AGENT} + MF_INFLUXDB_TIMEOUT: ${MF_INFLUXDB_TIMEOUT} + MF_INFLUXDB_INSECURE_SKIP_VERIFY: ${MF_INFLUXDB_INSECURE_SKIP_VERIFY} + MF_BROKER_URL: ${MF_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_INFLUX_WRITER_INSTANCE_ID: ${MF_INFLUX_WRITER_INSTANCE_ID} ports: - - ${MF_INFLUX_WRITER_PORT}:${MF_INFLUX_WRITER_PORT} + - ${MF_INFLUX_WRITER_HTTP_PORT}:${MF_INFLUX_WRITER_HTTP_PORT} networks: - docker_mainflux-base-net volumes: diff --git a/docker/addons/lora-adapter/docker-compose.yml b/docker/addons/lora-adapter/docker-compose.yml index 83b1e0924ce..aa8dd72b23c 100644 --- a/docker/addons/lora-adapter/docker-compose.yml +++ b/docker/addons/lora-adapter/docker-compose.yml @@ -26,15 +26,24 @@ services: restart: on-failure environment: MF_LORA_ADAPTER_LOG_LEVEL: ${MF_LORA_ADAPTER_LOG_LEVEL} - MF_THINGS_ES_URL: es-redis:${MF_REDIS_TCP_PORT} - MF_LORA_ADAPTER_ROUTE_MAP_URL: lora-redis:${MF_REDIS_TCP_PORT} MF_LORA_ADAPTER_MESSAGES_URL: ${MF_LORA_ADAPTER_MESSAGES_URL} MF_LORA_ADAPTER_MESSAGES_TOPIC: ${MF_LORA_ADAPTER_MESSAGES_TOPIC} MF_LORA_ADAPTER_MESSAGES_USER: ${MF_LORA_ADAPTER_MESSAGES_USER} MF_LORA_ADAPTER_MESSAGES_PASS: ${MF_LORA_ADAPTER_MESSAGES_PASS} MF_LORA_ADAPTER_MESSAGES_TIMEOUT: ${MF_LORA_ADAPTER_MESSAGES_TIMEOUT} + MF_LORA_ADAPTER_EVENT_CONSUMER: ${MF_LORA_ADAPTER_EVENT_CONSUMER} + MF_LORA_ADAPTER_HTTP_HOST: ${MF_LORA_ADAPTER_HTTP_HOST} MF_LORA_ADAPTER_HTTP_PORT: ${MF_LORA_ADAPTER_HTTP_PORT} + MF_LORA_ADAPTER_HTTP_SERVER_CERT: ${MF_LORA_ADAPTER_HTTP_SERVER_CERT} + MF_LORA_ADAPTER_HTTP_SERVER_KEY: ${MF_LORA_ADAPTER_HTTP_SERVER_KEY} + MF_LORA_ADAPTER_ROUTE_MAP_URL: lora-redis:${MF_REDIS_TCP_PORT} + MF_LORA_ADAPTER_ROUTE_MAP_PASS: ${MF_LORA_ADAPTER_ROUTE_MAP_PASS} + MF_LORA_ADAPTER_ROUTE_MAP_DB: ${MF_LORA_ADAPTER_ROUTE_MAP_DB} + MF_THINGS_ES_URL: ${MF_THINGS_ES_URL} + MF_THINGS_ES_PASS: ${MF_THINGS_ES_PASS} + MF_THINGS_ES_DB: ${MF_THINGS_ES_DB} MF_BROKER_URL: ${MF_BROKER_URL} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_LORA_ADAPTER_INSTANCE_ID: ${MF_LORA_ADAPTER_INSTANCE_ID} ports: diff --git a/docker/addons/mongodb-reader/docker-compose.yml b/docker/addons/mongodb-reader/docker-compose.yml index db1ba3b9f2e..64b48b13f43 100644 --- a/docker/addons/mongodb-reader/docker-compose.yml +++ b/docker/addons/mongodb-reader/docker-compose.yml @@ -20,20 +20,26 @@ services: restart: on-failure environment: MF_MONGO_READER_LOG_LEVEL: ${MF_MONGO_READER_LOG_LEVEL} - MF_MONGO_READER_PORT: ${MF_MONGO_READER_PORT} - MF_MONGO_READER_DB: ${MF_MONGO_READER_DB} - MF_MONGO_READER_DB_HOST: mongodb - MF_MONGO_READER_DB_PORT: ${MF_MONGO_READER_DB_PORT} - MF_MONGO_READER_SERVER_CERT: ${MF_MONGO_READER_SERVER_CERT} - MF_MONGO_READER_SERVER_KEY: ${MF_MONGO_READER_SERVER_KEY} + MF_MONGO_READER_HTTP_HOST: ${MF_MONGO_READER_HTTP_HOST} + MF_MONGO_READER_HTTP_PORT: ${MF_MONGO_READER_HTTP_PORT} + MF_MONGO_READER_HTTP_SERVER_CERT: ${MF_MONGO_READER_HTTP_SERVER_CERT} + MF_MONGO_READER_HTTP_SERVER_KEY: ${MF_MONGO_READER_HTTP_SERVER_KEY} + MF_MONGO_HOST: ${MF_MONGO_HOST} + MF_MONGO_PORT: ${MF_MONGO_PORT} + MF_MONGO_NAME: ${MF_MONGO_NAME} MF_THINGS_AUTH_GRPC_URL: ${MF_THINGS_AUTH_GRPC_URL} MF_THINGS_AUTH_GRPC_TIMEOUT: ${MF_THINGS_AUTH_GRPC_TIMEOUT} + MF_THINGS_AUTH_GRPC_CLIENT_TLS: ${MF_THINGS_AUTH_GRPC_CLIENT_TLS} + MF_THINGS_AUTH_GRPC_CA_CERTS: ${MF_THINGS_AUTH_GRPC_CA_CERTS} MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} MF_AUTH_GRPC_TIMEOUT : ${MF_USERS_GRPC_TIMEOUT} - MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} + MF_AUTH_GRPC_CLIENT_TLS: ${MF_USERS_GRPC_CLIENT_TLS} + MF_AUTH_GRPC_CA_CERT: ${MF_USERS_GRPC_CA_CERT} + MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_MONGO_READER_INSTANCE_ID: ${MF_MONGO_READER_INSTANCE_ID} ports: - - ${MF_MONGO_READER_PORT}:${MF_MONGO_READER_PORT} + - ${MF_MONGO_READER_HTTP_PORT}:${MF_MONGO_READER_HTTP_PORT} networks: - docker_mainflux-base-net volumes: diff --git a/docker/addons/mongodb-writer/docker-compose.yml b/docker/addons/mongodb-writer/docker-compose.yml index 8347e9bec7f..62785d118bf 100644 --- a/docker/addons/mongodb-writer/docker-compose.yml +++ b/docker/addons/mongodb-writer/docker-compose.yml @@ -24,9 +24,9 @@ services: container_name: mainflux-mongodb restart: on-failure environment: - MONGO_INITDB_DATABASE: ${MF_MONGO_WRITER_DB} + MONGO_INITDB_DATABASE: ${MF_MONGO_NAME} ports: - - ${MF_MONGO_WRITER_DB_PORT}:${MF_MONGO_WRITER_DB_PORT} + - ${MF_MONGO_PORT}:${MF_MONGO_PORT} networks: - docker_mainflux-base-net volumes: @@ -41,16 +41,20 @@ services: restart: on-failure environment: MF_MONGO_WRITER_LOG_LEVEL: ${MF_MONGO_WRITER_LOG_LEVEL} + MF_MONGO_WRITER_CONFIG_PATH: ${MF_MONGO_WRITER_CONFIG_PATH} + MF_MONGO_WRITER_HTTP_HOST: ${MF_MONGO_WRITER_HTTP_HOST} + MF_MONGO_WRITER_HTTP_PORT: ${MF_MONGO_WRITER_HTTP_PORT} + MF_MONGO_WRITER_HTTP_SERVER_CERT: ${MF_MONGO_WRITER_HTTP_SERVER_CERT} + MF_MONGO_WRITER_HTTP_SERVER_KEY: ${MF_MONGO_WRITER_HTTP_SERVER_KEY} + MF_MONGO_HOST: ${MF_MONGO_HOST} + MF_MONGO_PORT: ${MF_MONGO_PORT} + MF_MONGO_NAME: ${MF_MONGO_NAME} MF_BROKER_URL: ${MF_BROKER_URL} - MF_MONGO_WRITER_PORT: ${MF_MONGO_WRITER_PORT} - MF_MONGO_WRITER_DB: ${MF_MONGO_WRITER_DB} - MF_MONGO_WRITER_DB_HOST: mongodb - MF_MONGO_WRITER_DB_PORT: ${MF_MONGO_WRITER_DB_PORT} MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_MONGO_WRITER_INSTANCE_ID: ${MF_MONGO_WRITER_INSTANCE_ID} ports: - - ${MF_MONGO_WRITER_PORT}:${MF_MONGO_WRITER_PORT} + - ${MF_MONGO_WRITER_HTTP_PORT}:${MF_MONGO_WRITER_HTTP_PORT} networks: - docker_mainflux-base-net volumes: diff --git a/docker/addons/opcua-adapter/docker-compose.yml b/docker/addons/opcua-adapter/docker-compose.yml index 8e2c37ba4b2..aa4cdea4d41 100644 --- a/docker/addons/opcua-adapter/docker-compose.yml +++ b/docker/addons/opcua-adapter/docker-compose.yml @@ -31,20 +31,20 @@ services: container_name: mainflux-opcua restart: on-failure environment: - MF_OPCUA_ADAPTER_HTTP_PORT: ${MF_OPCUA_ADAPTER_HTTP_PORT} MF_OPCUA_ADAPTER_LOG_LEVEL: ${MF_OPCUA_ADAPTER_LOG_LEVEL} - MF_BROKER_URL: ${MF_BROKER_URL} - MF_OPCUA_ADAPTER_POLICY: ${MF_OPCUA_ADAPTER_POLICY} - MF_OPCUA_ADAPTER_MODE: ${MF_OPCUA_ADAPTER_MODE} - MF_OPCUA_ADAPTER_CERT_FILE: ${MF_OPCUA_ADAPTER_CERT_FILE} - MF_OPCUA_ADAPTER_KEY_FILE: ${MF_OPCUA_ADAPTER_KEY_FILE} - MF_OPCUA_ADAPTER_ROUTE_MAP_URL: opcua-redis:${MF_REDIS_TCP_PORT} + MF_OPCUA_ADAPTER_EVENT_CONSUMER: ${MF_OPCUA_ADAPTER_EVENT_CONSUMER} + MF_OPCUA_ADAPTER_HTTP_HOST: ${MF_OPCUA_ADAPTER_HTTP_HOST} + MF_OPCUA_ADAPTER_HTTP_PORT: ${MF_OPCUA_ADAPTER_HTTP_PORT} + MF_OPCUA_ADAPTER_HTTP_SERVER_CERT: ${MF_OPCUA_ADAPTER_HTTP_SERVER_CERT} + MF_OPCUA_ADAPTER_HTTP_SERVER_KEY: ${MF_OPCUA_ADAPTER_HTTP_SERVER_KEY} + MF_OPCUA_ADAPTER_ES_URL: ${MF_OPCUA_ADAPTER_ES_URL} + MF_OPCUA_ADAPTER_ES_PASS: ${MF_OPCUA_ADAPTER_ES_PASS} + MF_OPCUA_ADAPTER_ES_DB: ${MF_OPCUA_ADAPTER_ES_DB} + MF_OPCUA_ADAPTER_ROUTE_MAP_URL: ${MF_OPCUA_ADAPTER_ROUTE_MAP_URL} MF_OPCUA_ADAPTER_ROUTE_MAP_PASS: ${MF_OPCUA_ADAPTER_ROUTE_MAP_PASS} MF_OPCUA_ADAPTER_ROUTE_MAP_DB: ${MF_OPCUA_ADAPTER_ROUTE_MAP_DB} - MF_THINGS_ES_URL: es-redis:${MF_REDIS_TCP_PORT} - MF_THINGS_ES_PASS: ${MF_THINGS_ES_PASS} - MF_THINGS_ES_DB: ${MF_THINGS_ES_DB} - MF_OPCUA_ADAPTER_EVENT_CONSUMER: ${MF_OPCUA_ADAPTER_EVENT_CONSUMER} + MF_BROKER_URL: ${MF_BROKER_URL} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_OPCUA_ADAPTER_INSTANCE_ID: ${MF_OPCUA_ADAPTER_INSTANCE_ID} ports: diff --git a/docker/addons/postgres-reader/docker-compose.yml b/docker/addons/postgres-reader/docker-compose.yml index 51ddf57ac7d..afd61eb423a 100644 --- a/docker/addons/postgres-reader/docker-compose.yml +++ b/docker/addons/postgres-reader/docker-compose.yml @@ -20,25 +20,31 @@ services: restart: on-failure environment: MF_POSTGRES_READER_LOG_LEVEL: ${MF_POSTGRES_READER_LOG_LEVEL} - MF_POSTGRES_READER_PORT: ${MF_POSTGRES_READER_PORT} - MF_POSTGRES_READER_CLIENT_TLS: ${MF_POSTGRES_READER_CLIENT_TLS} - MF_POSTGRES_READER_CA_CERTS: ${MF_POSTGRES_READER_CA_CERTS} - MF_POSTGRES_READER_DB_HOST: postgres - MF_POSTGRES_READER_DB_PORT: ${MF_POSTGRES_READER_DB_PORT} - MF_POSTGRES_READER_DB_USER: ${MF_POSTGRES_READER_DB_USER} - MF_POSTGRES_READER_DB_PASS: ${MF_POSTGRES_READER_DB_PASS} - MF_POSTGRES_READER_DB: ${MF_POSTGRES_READER_DB} - MF_POSTGRES_READER_DB_SSL_MODE: ${MF_POSTGRES_READER_DB_SSL_MODE} - MF_POSTGRES_READER_DB_SSL_CERT: ${MF_POSTGRES_READER_DB_SSL_CERT} - MF_POSTGRES_READER_DB_SSL_KEY: ${MF_POSTGRES_READER_DB_SSL_KEY} - MF_POSTGRES_READER_DB_SSL_ROOT_CERT: ${MF_POSTGRES_READER_DB_SSL_ROOT_CERT} + MF_POSTGRES_READER_HTTP_HOST: ${MF_POSTGRES_READER_HTTP_HOST} + MF_POSTGRES_READER_HTTP_PORT: ${MF_POSTGRES_READER_HTTP_PORT} + MF_POSTGRES_READER_HTTP_SERVER_CERT: ${MF_POSTGRES_READER_HTTP_SERVER_CERT} + MF_POSTGRES_READER_HTTP_SERVER_KEY: ${MF_POSTGRES_READER_HTTP_SERVER_KEY} + MF_POSTGRES_HOST: ${MF_POSTGRES_HOST} + MF_POSTGRES_PORT: ${MF_POSTGRES_PORT} + MF_POSTGRES_USER: ${MF_POSTGRES_USER} + MF_POSTGRES_PASS: ${MF_POSTGRES_PASS} + MF_POSTGRES_DB_NAME: ${MF_POSTGRES_DB_NAME} + MF_POSTGRES_SSL_MODE: ${MF_POSTGRES_SSL_MODE} + MF_POSTGRES_SSL_CERT: ${MF_POSTGRES_SSL_CERT} + MF_POSTGRES_SSL_KEY: ${MF_POSTGRES_SSL_KEY} + MF_POSTGRES_SSL_ROOT_CERT: ${MF_POSTGRES_SSL_ROOT_CERT} MF_THINGS_AUTH_GRPC_URL: ${MF_THINGS_AUTH_GRPC_URL} MF_THINGS_AUTH_GRPC_TIMEOUT: ${MF_THINGS_AUTH_GRPC_TIMEOUT} + MF_THINGS_AUTH_GRPC_CLIENT_TLS: ${MF_THINGS_AUTH_GRPC_CLIENT_TLS} + MF_THINGS_AUTH_GRPC_CA_CERTS: ${MF_THINGS_AUTH_GRPC_CA_CERTS} MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} MF_AUTH_GRPC_TIMEOUT : ${MF_USERS_GRPC_TIMEOUT} + MF_AUTH_GRPC_CLIENT_TLS: ${MF_USERS_GRPC_CLIENT_TLS} + MF_AUTH_GRPC_CA_CERT: ${MF_USERS_GRPC_CA_CERT} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_POSTGRES_READER_INSTANCE_ID: ${MF_POSTGRES_READER_INSTANCE_ID} ports: - - ${MF_POSTGRES_READER_PORT}:${MF_POSTGRES_READER_PORT} + - ${MF_POSTGRES_READER_HTTP_PORT}:${MF_POSTGRES_READER_HTTP_PORT} networks: - docker_mainflux-base-net diff --git a/docker/addons/postgres-writer/docker-compose.yml b/docker/addons/postgres-writer/docker-compose.yml index 888ef333c9a..917ff5ba0e6 100644 --- a/docker/addons/postgres-writer/docker-compose.yml +++ b/docker/addons/postgres-writer/docker-compose.yml @@ -23,9 +23,9 @@ services: container_name: mainflux-postgres restart: on-failure environment: - POSTGRES_USER: ${MF_POSTGRES_WRITER_DB_USER} - POSTGRES_PASSWORD: ${MF_POSTGRES_WRITER_DB_PASS} - POSTGRES_DB: ${MF_POSTGRES_WRITER_DB} + POSTGRES_USER: ${MF_POSTGRES_USER} + POSTGRES_PASSWORD: ${MF_POSTGRES_PASS} + POSTGRES_DB: ${MF_POSTGRES_NAME} networks: - docker_mainflux-base-net volumes: @@ -38,23 +38,27 @@ services: - postgres restart: on-failure environment: - MF_BROKER_URL: ${MF_BROKER_URL} MF_POSTGRES_WRITER_LOG_LEVEL: ${MF_POSTGRES_WRITER_LOG_LEVEL} - MF_POSTGRES_WRITER_PORT: ${MF_POSTGRES_WRITER_PORT} - MF_POSTGRES_WRITER_DB_HOST: postgres - MF_POSTGRES_WRITER_DB_PORT: ${MF_POSTGRES_WRITER_DB_PORT} - MF_POSTGRES_WRITER_DB_USER: ${MF_POSTGRES_WRITER_DB_USER} - MF_POSTGRES_WRITER_DB_PASS: ${MF_POSTGRES_WRITER_DB_PASS} - MF_POSTGRES_WRITER_DB: ${MF_POSTGRES_WRITER_DB} - MF_POSTGRES_WRITER_DB_SSL_MODE: ${MF_POSTGRES_WRITER_DB_SSL_MODE} - MF_POSTGRES_WRITER_DB_SSL_CERT: ${MF_POSTGRES_WRITER_DB_SSL_CERT} - MF_POSTGRES_WRITER_DB_SSL_KEY: ${MF_POSTGRES_WRITER_DB_SSL_KEY} - MF_POSTGRES_WRITER_DB_SSL_ROOT_CERT: ${MF_POSTGRES_WRITER_DB_SSL_ROOT_CERT} + MF_POSTGRES_WRITER_CONFIG_PATH: ${MF_POSTGRES_WRITER_CONFIG_PATH} + MF_POSTGRES_WRITER_HTTP_HOST: ${MF_POSTGRES_WRITER_HTTP_HOST} + MF_POSTGRES_WRITER_HTTP_PORT: ${MF_POSTGRES_WRITER_HTTP_PORT} + MF_POSTGRES_WRITER_HTTP_SERVER_CERT: ${MF_POSTGRES_WRITER_HTTP_SERVER_CERT} + MF_POSTGRES_WRITER_HTTP_SERVER_KEY: ${MF_POSTGRES_WRITER_HTTP_SERVER_KEY} + MF_POSTGRES_HOST: ${MF_POSTGRES_HOST} + MF_POSTGRES_PORT: ${MF_POSTGRES_PORT} + MF_POSTGRES_USER: ${MF_POSTGRES_USER} + MF_POSTGRES_PASS: ${MF_POSTGRES_PASS} + MF_POSTGRES_NAME: ${MF_POSTGRES_NAME} + MF_POSTGRES_SSL_MODE: ${MF_POSTGRES_SSL_MODE} + MF_POSTGRES_SSL_CERT: ${MF_POSTGRES_SSL_CERT} + MF_POSTGRES_SSL_KEY: ${MF_POSTGRES_SSL_KEY} + MF_POSTGRES_SSL_ROOT_CERT: ${MF_POSTGRES_SSL_ROOT_CERT} + MF_BROKER_URL: ${MF_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_POSTGRES_WRITER_INSTANCE_ID: ${MF_POSTGRES_WRITER_INSTANCE_ID} ports: - - ${MF_POSTGRES_WRITER_PORT}:${MF_POSTGRES_WRITER_PORT} + - ${MF_POSTGRES_WRITER_HTTP_PORT}:${MF_POSTGRES_WRITER_HTTP_PORT} networks: - docker_mainflux-base-net volumes: diff --git a/docker/addons/provision/docker-compose.yml b/docker/addons/provision/docker-compose.yml index b09df6dfccb..acbf2b98e74 100644 --- a/docker/addons/provision/docker-compose.yml +++ b/docker/addons/provision/docker-compose.yml @@ -40,7 +40,6 @@ services: MF_PROVISION_BS_CONFIG_PROVISIONING: ${MF_PROVISION_BS_CONFIG_PROVISIONING} MF_PROVISION_BS_AUTO_WHITELIST: ${MF_PROVISION_BS_AUTO_WHITELIST} MF_PROVISION_BS_CONTENT: ${MF_PROVISION_BS_CONTENT} - MF_PROVISION_CERTS_RSA_BITS: ${MF_PROVISION_CERTS_RSA_BITS} MF_PROVISION_CERTS_HOURS_VALID: ${MF_PROVISION_CERTS_HOURS_VALID} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_PROVISION_INSTANCE_ID: ${MF_PROVISION_INSTANCE_ID} diff --git a/docker/addons/smpp-notifier/docker-compose.yml b/docker/addons/smpp-notifier/docker-compose.yml index 205ca826603..5eeca44261f 100644 --- a/docker/addons/smpp-notifier/docker-compose.yml +++ b/docker/addons/smpp-notifier/docker-compose.yml @@ -23,7 +23,7 @@ services: environment: POSTGRES_USER: ${MF_SMPP_NOTIFIER_DB_USER} POSTGRES_PASSWORD: ${MF_SMPP_NOTIFIER_DB_PASS} - POSTGRES_DB: ${MF_SMPP_NOTIFIER_DB} + POSTGRES_DB: ${MF_SMPP_NOTIFIER_DB_NAME} networks: - docker_mainflux-base-net volumes: @@ -36,30 +36,40 @@ services: - smpp-notifier-db restart: on-failure environment: - MF_BROKER_URL: ${MF_BROKER_URL} - MF_JAEGER_URL: ${MF_JAEGER_URL} - MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} - MF_AUTH_GRPC_TIMEOUT: ${MF_USERS_GRPC_TIMEOUT} MF_SMPP_NOTIFIER_LOG_LEVEL: ${MF_SMPP_NOTIFIER_LOG_LEVEL} - MF_SMPP_NOTIFIER_DB_HOST: smpp-notifier-db + MF_SMPP_NOTIFIER_FROM_ADDR: ${MF_SMPP_NOTIFIER_FROM_ADDR}] + MF_SMPP_NOTIFIER_CONFIG_PATH: ${MF_SMPP_NOTIFIER_CONFIG_PATH} + MF_SMPP_NOTIFIER_HTTP_HOST: ${MF_SMPP_NOTIFIER_HTTP_HOST} + MF_SMPP_NOTIFIER_HTTP_PORT: ${MF_SMPP_NOTIFIER_HTTP_PORT} + MF_SMPP_NOTIFIER_HTTP_SERVER_CERT: ${MF_SMPP_NOTIFIER_HTTP_SERVER_CERT} + MF_SMPP_NOTIFIER_HTTP_SERVER_KEY: ${MF_SMPP_NOTIFIER_HTTP_SERVER_KEY} + MF_SMPP_NOTIFIER_DB_HOST: ${MF_SMPP_NOTIFIER_DB_HOST} MF_SMPP_NOTIFIER_DB_PORT: ${MF_SMPP_NOTIFIER_DB_PORT} MF_SMPP_NOTIFIER_DB_USER: ${MF_SMPP_NOTIFIER_DB_USER} MF_SMPP_NOTIFIER_DB_PASS: ${MF_SMPP_NOTIFIER_DB_PASS} - MF_SMPP_NOTIFIER_DB: ${MF_SMPP_NOTIFIER_DB} - MF_SMPP_NOTIFIER_PORT: ${MF_SMPP_NOTIFIER_PORT} + MF_SMPP_NOTIFIER_DB_NAME: ${MF_SMPP_NOTIFIER_DB_NAME} + MF_SMPP_NOTIFIER_DB_SSL_MODE: ${MF_SMPP_NOTIFIER_DB_SSL_MODE} + MF_SMPP_NOTIFIER_DB_SSL_CERT: ${MF_SMPP_NOTIFIER_DB_SSL_CERT} + MF_SMPP_NOTIFIER_DB_SSL_KEY: ${MF_SMPP_NOTIFIER_DB_SSL_KEY} + MF_SMPP_NOTIFIER_DB_SSL_ROOT_CERT: ${MF_SMPP_NOTIFIER_DB_SSL_ROOT_CERT} MF_SMPP_ADDRESS: ${MF_SMPP_ADDRESS} MF_SMPP_USERNAME: ${MF_SMPP_USERNAME} MF_SMPP_PASSWORD: ${MF_SMPP_PASSWORD} MF_SMPP_SYSTEM_TYPE: ${MF_SMPP_SYSTEM_TYPE} - MF_SMPP_NOTIFIER_SOURCE_ADDR: ${MF_SMPP_NOTIFIER_SOURCE_ADDR} MF_SMPP_SRC_ADDR_TON: ${MF_SMPP_SRC_ADDR_TON} MF_SMPP_SRC_ADDR_NPI: ${MF_SMPP_SRC_ADDR_NPI} MF_SMPP_DST_ADDR_TON: ${MF_SMPP_DST_ADDR_TON} MF_SMPP_DST_ADDR_NPI: ${MF_SMPP_DST_ADDR_NPI} + MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} + MF_AUTH_GRPC_TIMEOUT : ${MF_USERS_GRPC_TIMEOUT} + MF_AUTH_GRPC_CLIENT_TLS: ${MF_USERS_GRPC_CLIENT_TLS} + MF_AUTH_GRPC_CA_CERT: ${MF_USERS_GRPC_CA_CERT} + MF_BROKER_URL: ${MF_BROKER_URL} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_SMPP_NOTIFIER_INSTANCE_ID: ${MF_SMPP_NOTIFIER_INSTANCE_ID} ports: - - ${MF_SMPP_NOTIFIER_PORT}:${MF_SMPP_NOTIFIER_PORT} + - ${MF_SMPP_NOTIFIER_HTTP_PORT}:${MF_SMPP_NOTIFIER_HTTP_PORT} networks: - docker_mainflux-base-net volumes: diff --git a/docker/addons/smtp-notifier/docker-compose.yml b/docker/addons/smtp-notifier/docker-compose.yml index 6b0ba003656..64c2308ac2c 100644 --- a/docker/addons/smtp-notifier/docker-compose.yml +++ b/docker/addons/smtp-notifier/docker-compose.yml @@ -37,31 +37,40 @@ services: restart: on-failure environment: MF_SMTP_NOTIFIER_LOG_LEVEL: ${MF_SMTP_NOTIFIER_LOG_LEVEL} - MF_SMTP_NOTIFIER_DB_HOST: smtp-notifier-db + MF_SMTP_NOTIFIER_FROM_ADDR: ${MF_SMTP_NOTIFIER_FROM_ADDR}] + MF_SMTP_NOTIFIER_CONFIG_PATH: ${MF_SMTP_NOTIFIER_CONFIG_PATH} + MF_SMTP_NOTIFIER_HTTP_HOST: ${MF_SMTP_NOTIFIER_HTTP_HOST} + MF_SMTP_NOTIFIER_HTTP_PORT: ${MF_SMTP_NOTIFIER_HTTP_PORT} + MF_SMTP_NOTIFIER_HTTP_SERVER_CERT: ${MF_SMTP_NOTIFIER_HTTP_SERVER_CERT} + MF_SMTP_NOTIFIER_HTTP_SERVER_KEY: ${MF_SMTP_NOTIFIER_HTTP_SERVER_KEY} + MF_SMTP_NOTIFIER_DB_HOST: ${MF_SMTP_NOTIFIER_DB_HOST} MF_SMTP_NOTIFIER_DB_PORT: ${MF_SMTP_NOTIFIER_DB_PORT} MF_SMTP_NOTIFIER_DB_USER: ${MF_SMTP_NOTIFIER_DB_USER} MF_SMTP_NOTIFIER_DB_PASS: ${MF_SMTP_NOTIFIER_DB_PASS} - MF_SMTP_NOTIFIER_DB: ${MF_SMTP_NOTIFIER_DB} - MF_SMTP_NOTIFIER_PORT: ${MF_SMTP_NOTIFIER_PORT} - MF_BROKER_URL: ${MF_BROKER_URL} - MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_SMTP_NOTIFIER_DB_NAME: ${MF_SMTP_NOTIFIER_DB_NAME} + MF_SMTP_NOTIFIER_DB_SSL_MODE: ${MF_SMTP_NOTIFIER_DB_SSL_MODE} + MF_SMTP_NOTIFIER_DB_SSL_CERT: ${MF_SMTP_NOTIFIER_DB_SSL_CERT} + MF_SMTP_NOTIFIER_DB_SSL_KEY: ${MF_SMTP_NOTIFIER_DB_SSL_KEY} + MF_SMTP_NOTIFIER_DB_SSL_ROOT_CERT: ${MF_SMTP_NOTIFIER_DB_SSL_ROOT_CERT} MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} - MF_AUTH_GRPC_TIMEOUT: ${MF_USERS_GRPC_TIMEOUT} + MF_AUTH_GRPC_TIMEOUT : ${MF_USERS_GRPC_TIMEOUT} + MF_AUTH_GRPC_CLIENT_TLS: ${MF_USERS_GRPC_CLIENT_TLS} + MF_AUTH_GRPC_CA_CERT: ${MF_USERS_GRPC_CA_CERT} MF_EMAIL_USERNAME: ${MF_EMAIL_USERNAME} MF_EMAIL_PASSWORD: ${MF_EMAIL_PASSWORD} MF_EMAIL_HOST: ${MF_EMAIL_HOST} MF_EMAIL_PORT: ${MF_EMAIL_PORT} MF_EMAIL_FROM_ADDRESS: ${MF_EMAIL_FROM_ADDRESS} MF_EMAIL_FROM_NAME: ${MF_EMAIL_FROM_NAME} - MF_EMAIL_TEMPLATE: ${MF_EMAIL_TEMPLATE} - MF_SMTP_NOTIFIER_TEMPLATE: ${MF_SMTP_NOTIFIER_TEMPLATE} - MF_SMTP_NOTIFIER_FROM_ADDR: ${MF_SMTP_NOTIFIER_FROM_ADDR} + MF_EMAIL_TEMPLATE: ${MF_SMTP_NOTIFIER_EMAIL_TEMPLATE} + MF_BROKER_URL: ${MF_BROKER_URL} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_SMTP_NOTIFIER_INSTANCE_ID: ${MF_SMTP_NOTIFIER_INSTANCE_ID} ports: - - ${MF_SMTP_NOTIFIER_PORT}:${MF_SMTP_NOTIFIER_PORT} + - ${MF_SMTP_NOTIFIER_HTTP_PORT}:${MF_SMTP_NOTIFIER_HTTP_PORT} networks: - docker_mainflux-base-net volumes: - ./config.toml:/config.toml - - ../../templates/${MF_SMTP_NOTIFIER_TEMPLATE}:/${MF_EMAIL_TEMPLATE} + - ../../templates/${MF_SMTP_NOTIFIER_EMAIL_TEMPLATE}:/${MF_SMTP_NOTIFIER_EMAIL_TEMPLATE} diff --git a/docker/addons/timescale-reader/docker-compose.yml b/docker/addons/timescale-reader/docker-compose.yml index 1ec044124d2..b09d7e0dd84 100644 --- a/docker/addons/timescale-reader/docker-compose.yml +++ b/docker/addons/timescale-reader/docker-compose.yml @@ -20,25 +20,31 @@ services: restart: on-failure environment: MF_TIMESCALE_READER_LOG_LEVEL: ${MF_TIMESCALE_READER_LOG_LEVEL} - MF_TIMESCALE_READER_PORT: ${MF_TIMESCALE_READER_PORT} - MF_TIMESCALE_READER_CLIENT_TLS: ${MF_TIMESCALE_READER_CLIENT_TLS} - MF_TIMESCALE_READER_CA_CERTS: ${MF_TIMESCALE_READER_CA_CERTS} - MF_TIMESCALE_READER_DB_HOST: timescale - MF_TIMESCALE_READER_DB_PORT: ${MF_TIMESCALE_READER_DB_PORT} - MF_TIMESCALE_READER_DB_USER: ${MF_TIMESCALE_READER_DB_USER} - MF_TIMESCALE_READER_DB_PASS: ${MF_TIMESCALE_READER_DB_PASS} - MF_TIMESCALE_READER_DB: ${MF_TIMESCALE_READER_DB} - MF_TIMESCALE_READER_DB_SSL_MODE: ${MF_TIMESCALE_READER_DB_SSL_MODE} - MF_TIMESCALE_READER_DB_SSL_CERT: ${MF_TIMESCALE_READER_DB_SSL_CERT} - MF_TIMESCALE_READER_DB_SSL_KEY: ${MF_TIMESCALE_READER_DB_SSL_KEY} - MF_TIMESCALE_READER_DB_SSL_ROOT_CERT: ${MF_TIMESCALE_READER_DB_SSL_ROOT_CERT} + MF_TIMESCALE_READER_HTTP_HOST: ${MF_TIMESCALE_READER_HTTP_HOST} + MF_TIMESCALE_READER_HTTP_PORT: ${MF_TIMESCALE_READER_HTTP_PORT} + MF_TIMESCALE_READER_HTTP_SERVER_CERT: ${MF_TIMESCALE_READER_HTTP_SERVER_CERT} + MF_TIMESCALE_READER_HTTP_SERVER_KEY: ${MF_TIMESCALE_READER_HTTP_SERVER_KEY} + MF_TIMESCALE_HOST: ${MF_TIMESCALE_HOST} + MF_TIMESCALE_PORT: ${MF_TIMESCALE_PORT} + MF_TIMESCALE_USER: ${MF_TIMESCALE_USER} + MF_TIMESCALE_PASS: ${MF_TIMESCALE_PASS} + MF_TIMESCALE_NAME: ${MF_TIMESCALE_NAME} + MF_TIMESCALE_SSL_MODE: ${MF_TIMESCALE_SSL_MODE} + MF_TIMESCALE_SSL_CERT: ${MF_TIMESCALE_SSL_CERT} + MF_TIMESCALE_SSL_KEY: ${MF_TIMESCALE_SSL_KEY} + MF_TIMESCALE_SSL_ROOT_CERT: ${MF_TIMESCALE_SSL_ROOT_CERT} MF_THINGS_AUTH_GRPC_URL: ${MF_THINGS_AUTH_GRPC_URL} MF_THINGS_AUTH_GRPC_TIMEOUT: ${MF_THINGS_AUTH_GRPC_TIMEOUT} + MF_THINGS_AUTH_GRPC_CLIENT_TLS: ${MF_THINGS_AUTH_GRPC_CLIENT_TLS} + MF_THINGS_AUTH_GRPC_CA_CERTS: ${MF_THINGS_AUTH_GRPC_CA_CERTS} MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} MF_AUTH_GRPC_TIMEOUT : ${MF_USERS_GRPC_TIMEOUT} + MF_AUTH_GRPC_CLIENT_TLS: ${MF_USERS_GRPC_CLIENT_TLS} + MF_AUTH_GRPC_CA_CERT: ${MF_USERS_GRPC_CA_CERT} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_TIMESCALE_READER_INSTANCE_ID: ${MF_TIMESCALE_READER_INSTANCE_ID} ports: - - ${MF_TIMESCALE_READER_PORT}:${MF_TIMESCALE_READER_PORT} + - ${MF_TIMESCALE_READER_HTTP_PORT}:${MF_TIMESCALE_READER_HTTP_PORT} networks: - docker_mainflux-base-net diff --git a/docker/addons/timescale-writer/docker-compose.yml b/docker/addons/timescale-writer/docker-compose.yml index 9d5a2f1e625..58795bab63c 100644 --- a/docker/addons/timescale-writer/docker-compose.yml +++ b/docker/addons/timescale-writer/docker-compose.yml @@ -23,9 +23,9 @@ services: container_name: mainflux-timescale restart: on-failure environment: - POSTGRES_PASSWORD: ${MF_TIMESCALE_WRITER_DB_PASS} - POSTGRES_USER: ${MF_TIMESCALE_WRITER_DB_USER} - POSTGRES_DB: ${MF_TIMESCALE_WRITER_DB} + POSTGRES_PASSWORD: ${MF_TIMESCALE_PASS} + POSTGRES_USER: ${MF_TIMESCALE_USER} + POSTGRES_DB: ${MF_TIMESCALE_NAME} networks: - docker_mainflux-base-net volumes: @@ -38,23 +38,27 @@ services: - timescale restart: on-failure environment: - MF_BROKER_URL: ${MF_BROKER_URL} MF_TIMESCALE_WRITER_LOG_LEVEL: ${MF_TIMESCALE_WRITER_LOG_LEVEL} - MF_TIMESCALE_WRITER_PORT: ${MF_TIMESCALE_WRITER_PORT} - MF_TIMESCALE_WRITER_DB_HOST: timescale - MF_TIMESCALE_WRITER_DB_PORT: ${MF_TIMESCALE_WRITER_DB_PORT} - MF_TIMESCALE_WRITER_DB_USER: ${MF_TIMESCALE_WRITER_DB_USER} - MF_TIMESCALE_WRITER_DB_PASS: ${MF_TIMESCALE_WRITER_DB_PASS} - MF_TIMESCALE_WRITER_DB: ${MF_TIMESCALE_WRITER_DB} - MF_TIMESCALE_WRITER_DB_SSL_MODE: ${MF_TIMESCALE_WRITER_DB_SSL_MODE} - MF_TIMESCALE_WRITER_DB_SSL_CERT: ${MF_TIMESCALE_WRITER_DB_SSL_CERT} - MF_TIMESCALE_WRITER_DB_SSL_KEY: ${MF_TIMESCALE_WRITER_DB_SSL_KEY} - MF_TIMESCALE_WRITER_DB_SSL_ROOT_CERT: ${MF_TIMESCALE_WRITER_DB_SSL_ROOT_CERT} + MF_TIMESCALE_WRITER_CONFIG_PATH: ${MF_TIMESCALE_WRITER_CONFIG_PATH} + MF_TIMESCALE_WRITER_HTTP_HOST: ${MF_TIMESCALE_WRITER_HTTP_HOST} + MF_TIMESCALE_WRITER_HTTP_PORT: ${MF_TIMESCALE_WRITER_HTTP_PORT} + MF_TIMESCALE_WRITER_HTTP_SERVER_CERT: ${MF_TIMESCALE_WRITER_HTTP_SERVER_CERT} + MF_TIMESCALE_WRITER_HTTP_SERVER_KEY: ${MF_TIMESCALE_WRITER_HTTP_SERVER_KEY} + MF_TIMESCALE_HOST: ${MF_TIMESCALE_HOST} + MF_TIMESCALE_PORT: ${MF_TIMESCALE_PORT} + MF_TIMESCALE_USER: ${MF_TIMESCALE_USER} + MF_TIMESCALE_PASS: ${MF_TIMESCALE_PASS} + MF_TIMESCALE_NAME: ${MF_TIMESCALE_NAME} + MF_TIMESCALE_SSL_MODE: ${MF_TIMESCALE_SSL_MODE} + MF_TIMESCALE_SSL_CERT: ${MF_TIMESCALE_SSL_CERT} + MF_TIMESCALE_SSL_KEY: ${MF_TIMESCALE_SSL_KEY} + MF_TIMESCALE_SSL_ROOT_CERT: ${MF_TIMESCALE_SSL_ROOT_CERT} + MF_BROKER_URL: ${MF_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_TIMESCALE_WRITER_INSTANCE_ID: ${MF_TIMESCALE_WRITER_INSTANCE_ID} ports: - - ${MF_TIMESCALE_WRITER_PORT}:${MF_TIMESCALE_WRITER_PORT} + - ${MF_TIMESCALE_WRITER_HTTP_PORT}:${MF_TIMESCALE_WRITER_HTTP_PORT} networks: - docker_mainflux-base-net volumes: diff --git a/docker/addons/twins/docker-compose.yml b/docker/addons/twins/docker-compose.yml index 2ea927b5894..8ce892fc5fc 100644 --- a/docker/addons/twins/docker-compose.yml +++ b/docker/addons/twins/docker-compose.yml @@ -17,13 +17,20 @@ volumes: mainflux-twins-db-configdb-volume: services: + twins-redis: + image: redis:5.0-alpine + container_name: mainflux-twins-redis + restart: on-failure + networks: + - docker_mainflux-base-net + twins-db: image: mongo:bionic command: mongod --port ${MF_TWINS_DB_PORT} container_name: mainflux-twins-db restart: on-failure environment: - MONGO_INITDB_DATABASE: ${MF_TWINS_DB} + MONGO_INITDB_DATABASE: ${MF_TWINS_DB_NAME} ports: - ${MF_TWINS_DB_PORT}:${MF_TWINS_DB_PORT} networks: @@ -38,14 +45,13 @@ services: restart: on-failure environment: MF_TWINS_LOG_LEVEL: ${MF_TWINS_LOG_LEVEL} - MF_TWINS_HTTP_PORT: ${MF_TWINS_HTTP_PORT} - MF_TWINS_DB: ${MF_TWINS_DB} - MF_TWINS_DB_HOST: ${MF_TWINS_DB_HOST} - MF_TWINS_DB_PORT: ${MF_TWINS_DB_PORT} + MF_TWINS_STANDALONE_ID: ${MF_TWINS_STANDALONE_ID} + MF_TWINS_STANDALONE_TOKEN: ${MF_TWINS_STANDALONE_TOKEN} MF_TWINS_CHANNEL_ID: ${MF_TWINS_CHANNEL_ID} - MF_BROKER_URL: ${MF_BROKER_URL} - MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} - MF_AUTH_GRPC_TIMEOUT: ${MF_USERS_GRPC_TIMEOUT} + MF_TWINS_HTTP_HOST: ${MF_TWINS_HTTP_HOST} + MF_TWINS_HTTP_PORT: ${MF_TWINS_HTTP_PORT} + MF_TWINS_HTTP_SERVER_CERT: ${MF_TWINS_HTTP_SERVER_CERT} + MF_TWINS_HTTP_SERVER_KEY: ${MF_TWINS_HTTP_SERVER_KEY} MF_TWINS_CACHE_URL: ${MF_TWINS_CACHE_URL} MF_TWINS_CACHE_PASS: ${MF_TWINS_CACHE_PASS} MF_TWINS_CACHE_DB: ${MF_TWINS_CACHE_DB} @@ -54,6 +60,14 @@ services: MF_TWINS_ES_DB: ${MF_TWINS_ES_DB} MF_THINGS_STANDALONE_ID: ${MF_THINGS_STANDALONE_ID} MF_THINGS_STANDALONE_TOKEN: ${MF_THINGS_STANDALONE_TOKEN} + MF_TWINS_DB_HOST: ${MF_TWINS_DB_HOST} + MF_TWINS_DB_PORT: ${MF_TWINS_DB_PORT} + MF_TWINS_DB_NAME: ${MF_TWINS_DB_NAME} + MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} + MF_AUTH_GRPC_TIMEOUT : ${MF_USERS_GRPC_TIMEOUT} + MF_AUTH_GRPC_CLIENT_TLS: ${MF_USERS_GRPC_CLIENT_TLS} + MF_AUTH_GRPC_CA_CERT: ${MF_USERS_GRPC_CA_CERT} + MF_BROKER_URL: ${MF_BROKER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_TWINS_INSTANCE_ID: ${MF_TWINS_INSTANCE_ID} ports: @@ -62,3 +76,4 @@ services: docker_mainflux-base-net: depends_on: - twins-db + - twins-redis diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 50fba3dc77a..c2c3b6e96cd 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -62,12 +62,21 @@ services: environment: POSTGRES_USER: ${MF_THINGS_DB_USER} POSTGRES_PASSWORD: ${MF_THINGS_DB_PASS} - POSTGRES_DB: ${MF_THINGS_DB} + POSTGRES_DB: ${MF_THINGS_DB_NAME} networks: - mainflux-base-net volumes: - mainflux-things-db-volume:/var/lib/postgresql/data + things-redis: + image: redis:6.2.2-alpine + container_name: mainflux-things-redis + restart: on-failure + networks: + - mainflux-base-net + volumes: + - mainflux-things-redis-volume:/data + things: image: mainflux/things:${MF_RELEASE_TAG} container_name: mainflux-things @@ -77,31 +86,41 @@ services: restart: on-failure environment: MF_THINGS_LOG_LEVEL: ${MF_THINGS_LOG_LEVEL} + MF_THINGS_STANDALONE_ID: ${MF_THINGS_STANDALONE_ID} + MF_THINGS_STANDALONE_TOKEN: ${MF_THINGS_STANDALONE_TOKEN} + MF_THINGS_CACHE_KEY_DURATION: ${MF_THINGS_CACHE_KEY_DURATION} + MF_THINGS_HTTP_HOST: ${MF_THINGS_HTTP_HOST} + MF_THINGS_HTTP_PORT: ${MF_THINGS_HTTP_PORT} + MF_THINGS_HTTP_SERVER_CERT: ${MF_THINGS_HTTP_SERVER_CERT} + MF_THINGS_HTTP_SERVER_KEY: ${MF_THINGS_HTTP_SERVER_KEY} + MF_THINGS_GRPC_HOST: ${MF_THINGS_GRPC_HOST} + MF_THINGS_GRPC_PORT: ${MF_THINGS_GRPC_PORT} + MF_THINGS_GRPC_SERVER_CERT: ${MF_THINGS_GRPC_SERVER_CERT} + MF_THINGS_GRPC_SERVER_KEY: ${MF_THINGS_GRPC_SERVER_KEY} + MF_THINGS_ES_URL: ${MF_THINGS_ES_URL} + MF_THINGS_ES_PASS: ${MF_THINGS_ES_PASS} + MF_THINGS_ES_DB: ${MF_THINGS_ES_DB} + MF_THINGS_CACHE_URL: ${MF_THINGS_CACHE_URL} + MF_THINGS_CACHE_PASS: ${MF_THINGS_CACHE_PASS} + MF_THINGS_CACHE_DB: ${MF_THINGS_CACHE_DB} MF_THINGS_DB_HOST: ${MF_THINGS_DB_HOST} MF_THINGS_DB_PORT: ${MF_THINGS_DB_PORT} MF_THINGS_DB_USER: ${MF_THINGS_DB_USER} MF_THINGS_DB_PASS: ${MF_THINGS_DB_PASS} - MF_THINGS_DB: ${MF_THINGS_DB} - MF_THINGS_CACHE_URL: ${MF_THINGS_CACHE_URL} - MF_THINGS_CACHE_PASS: ${MF_THINGS_CACHE_PASS} - MF_THINGS_CACHE_DB: ${MF_THINGS_CACHE_DB} - MF_THINGS_ES_URL: ${MF_THINGS_ES_URL} - MF_THINGS_ES_PASS: ${MF_THINGS_ES_PASS} - MF_THINGS_ES_DB: ${MF_THINGS_ES_DB} - MF_THINGS_HTTP_PORT: ${MF_THINGS_HTTP_PORT} - MF_JAEGER_URL: ${MF_JAEGER_URL} - MF_THINGS_AUTH_HTTP_PORT: ${MF_THINGS_AUTH_HTTP_PORT} - MF_THINGS_AUTH_GRPC_PORT: ${MF_THINGS_AUTH_GRPC_PORT} + MF_THINGS_DB_NAME: ${MF_THINGS_DB_NAME} + MF_THINGS_DB_SSL_MODE: ${MF_THINGS_DB_SSL_MODE} + MF_THINGS_DB_SSL_CERT: ${MF_THINGS_DB_SSL_CERT} + MF_THINGS_DB_SSL_KEY: ${MF_THINGS_DB_SSL_KEY} + MF_THINGS_DB_SSL_ROOT_CERT: ${MF_THINGS_DB_SSL_ROOT_CERT} MF_AUTH_GRPC_URL: ${MF_USERS_GRPC_URL} - MF_AUTH_GRPC_TIMEOUT: ${MF_USERS_GRPC_TIMEOUT} - MF_THINGS_STANDALONE_ID: ${MF_THINGS_STANDALONE_ID} - MF_THINGS_STANDALONE_TOKEN: ${MF_THINGS_STANDALONE_TOKEN} - MF_THINGS_CACHE_KEY_DURATION: ${MF_THINGS_CACHE_KEY_DURATION} + MF_AUTH_GRPC_TIMEOUT : ${MF_USERS_GRPC_TIMEOUT} + MF_AUTH_GRPC_CLIENT_TLS: ${MF_USERS_GRPC_CLIENT_TLS} + MF_AUTH_GRPC_CA_CERT: ${MF_USERS_GRPC_CA_CERT} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} ports: - ${MF_THINGS_HTTP_PORT}:${MF_THINGS_HTTP_PORT} - - ${MF_THINGS_AUTH_HTTP_PORT}:${MF_THINGS_AUTH_HTTP_PORT} - - ${MF_THINGS_AUTH_GRPC_PORT}:${MF_THINGS_AUTH_GRPC_PORT} + - ${MF_THINGS_GRPC_PORT}:${MF_THINGS_GRPC_PORT} networks: - mainflux-base-net @@ -112,21 +131,12 @@ services: environment: POSTGRES_USER: ${MF_USERS_DB_USER} POSTGRES_PASSWORD: ${MF_USERS_DB_PASS} - POSTGRES_DB: ${MF_USERS_DB} + POSTGRES_DB: ${MF_USERS_DB_NAME} networks: - mainflux-base-net volumes: - mainflux-users-db-volume:/var/lib/postgresql/data - things-redis: - image: redis:6.2.2-alpine - container_name: mainflux-things-redis - restart: on-failure - networks: - - mainflux-base-net - volumes: - - mainflux-things-redis-volume:/data - users: image: mainflux/users:${MF_RELEASE_TAG} container_name: mainflux-users @@ -135,36 +145,38 @@ services: restart: on-failure environment: MF_USERS_LOG_LEVEL: ${MF_USERS_LOG_LEVEL} + MF_USERS_SECRET_KEY: ${MF_USERS_SECRET_KEY} + MF_USERS_ADMIN_EMAIL: ${MF_USERS_ADMIN_EMAIL} + MF_USERS_ADMIN_PASSWORD: ${MF_USERS_ADMIN_PASSWORD} + MF_USERS_PASS_REGEX: ${MF_USERS_PASS_REGEX} + MF_USERS_ACCESS_TOKEN_DURATION: ${MF_USERS_ACCESS_TOKEN_DURATION} + MF_USERS_REFRESH_TOKEN_DURATION: ${MF_USERS_REFRESH_TOKEN_DURATION} + MF_TOKEN_RESET_ENDPOINT: ${MF_TOKEN_RESET_ENDPOINT} + MF_USERS_HTTP_HOST: ${MF_USERS_HTTP_HOST} + MF_USERS_HTTP_PORT: ${MF_USERS_HTTP_PORT} + MF_USERS_HTTP_SERVER_CERT: ${MF_USERS_HTTP_SERVER_CERT} + MF_USERS_HTTP_SERVER_KEY: ${MF_USERS_HTTP_SERVER_KEY} + MF_USERS_GRPC_HOST: ${MF_USERS_GRPC_HOST} + MF_USERS_GRPC_PORT: ${MF_USERS_GRPC_PORT} + MF_USERS_GRPC_SERVER_CERT: ${MF_USERS_GRPC_SERVER_CERT} + MF_USERS_GRPC_SERVER_KEY: ${MF_USERS_GRPC_SERVER_KEY} MF_USERS_DB_HOST: ${MF_USERS_DB_HOST} MF_USERS_DB_PORT: ${MF_USERS_DB_PORT} MF_USERS_DB_USER: ${MF_USERS_DB_USER} MF_USERS_DB_PASS: ${MF_USERS_DB_PASS} - MF_USERS_DB: ${MF_USERS_DB} + MF_USERS_DB_NAME: ${MF_USERS_DB_NAME} MF_USERS_DB_SSL_MODE: ${MF_USERS_DB_SSL_MODE} MF_USERS_DB_SSL_CERT: ${MF_USERS_DB_SSL_CERT} MF_USERS_DB_SSL_KEY: ${MF_USERS_DB_SSL_KEY} MF_USERS_DB_SSL_ROOT_CERT: ${MF_USERS_DB_SSL_ROOT_CERT} - MF_USERS_HTTP_PORT: ${MF_USERS_HTTP_PORT} - MF_USERS_GRPC_PORT: ${MF_USERS_GRPC_PORT} - MF_USERS_GRPC_URL: ${MF_USERS_GRPC_URL} - MF_USERS_GRPC_TIMEOUT: ${MF_USERS_GRPC_TIMEOUT} - MF_USERS_SERVER_CERT: ${MF_USERS_SERVER_CERT} - MF_USERS_SERVER_KEY: ${MF_USERS_SERVER_KEY} - MF_USERS_SECRET_KEY: ${MF_USERS_SECRET_KEY} - MF_USERS_ADMIN_EMAIL: ${MF_USERS_ADMIN_EMAIL} - MF_USERS_ADMIN_PASSWORD: ${MF_USERS_ADMIN_PASSWORD} - MF_USERS_PASS_REGEX: ${MF_USERS_PASS_REGEX} - MF_USERS_ACCESS_TOKEN_DURATION: ${MF_USERS_ACCESS_TOKEN_DURATION} - MF_USERS_REFRESH_TOKEN_DURATION: ${MF_USERS_REFRESH_TOKEN_DURATION} - MF_TOKEN_RESET_ENDPOINT: ${MF_TOKEN_RESET_ENDPOINT} - MF_JAEGER_URL: ${MF_JAEGER_URL} MF_EMAIL_HOST: ${MF_EMAIL_HOST} MF_EMAIL_PORT: ${MF_EMAIL_PORT} MF_EMAIL_USERNAME: ${MF_EMAIL_USERNAME} MF_EMAIL_PASSWORD: ${MF_EMAIL_PASSWORD} MF_EMAIL_FROM_ADDRESS: ${MF_EMAIL_FROM_ADDRESS} MF_EMAIL_FROM_NAME: ${MF_EMAIL_FROM_NAME} - MF_EMAIL_TEMPLATE: ${MF_EMAIL_TEMPLATE} + MF_EMAIL_TEMPLATE: ${MF_USERS_RESET_PWD_TEMPLATE} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} ports: - ${MF_USERS_HTTP_PORT}:${MF_USERS_HTTP_PORT} @@ -208,19 +220,25 @@ services: environment: MF_MQTT_ADAPTER_LOG_LEVEL: ${MF_MQTT_ADAPTER_LOG_LEVEL} MF_MQTT_ADAPTER_MQTT_PORT: ${MF_MQTT_ADAPTER_MQTT_PORT} + MF_MQTT_ADAPTER_MQTT_TARGET_HOST: ${MF_MQTT_ADAPTER_MQTT_TARGET_HOST} + MF_MQTT_ADAPTER_MQTT_TARGET_PORT: ${MF_MQTT_ADAPTER_MQTT_TARGET_PORT} + MF_MQTT_ADAPTER_FORWARDER_TIMEOUT: ${MF_MQTT_ADAPTER_FORWARDER_TIMEOUT} + MF_MQTT_ADAPTER_MQTT_TARGET_HEALTH_CHECK: ${MF_MQTT_ADAPTER_MQTT_TARGET_HEALTH_CHECK} MF_MQTT_ADAPTER_WS_PORT: ${MF_MQTT_ADAPTER_WS_PORT} - MF_MQTT_ADAPTER_ES_URL: es-redis:${MF_REDIS_TCP_PORT} - MF_BROKER_URL: ${MF_BROKER_URL} - MF_MQTT_ADAPTER_MQTT_TARGET_HOST: vernemq - MF_MQTT_ADAPTER_MQTT_TARGET_PORT: ${MF_MQTT_BROKER_PORT} - MF_MQTT_ADAPTER_MQTT_TARGET_HEALTH_CHECK: http://vernemq:8888/health - MF_MQTT_ADAPTER_WS_TARGET_HOST: vernemq - MF_MQTT_ADAPTER_WS_TARGET_PORT: ${MF_MQTT_BROKER_WS_PORT} MF_MQTT_ADAPTER_INSTANCE_ID: ${MF_MQTT_ADAPTER_INSTANCE_ID} - MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_MQTT_ADAPTER_WS_TARGET_HOST: ${MF_MQTT_ADAPTER_WS_TARGET_HOST} + MF_MQTT_ADAPTER_WS_TARGET_PORT: ${MF_MQTT_ADAPTER_WS_TARGET_PORT} + MF_MQTT_ADAPTER_WS_TARGET_PATH: ${MF_MQTT_ADAPTER_WS_TARGET_PATH} + MF_MQTT_ADAPTER_INSTANCE: ${MF_MQTT_ADAPTER_INSTANCE} + MF_MQTT_ADAPTER_ES_URL: ${MF_MQTT_ADAPTER_ES_URL} + MF_MQTT_ADAPTER_ES_PASS: ${MF_MQTT_ADAPTER_ES_PASS} + MF_MQTT_ADAPTER_ES_DB: ${MF_MQTT_ADAPTER_ES_DB} MF_THINGS_AUTH_GRPC_URL: ${MF_THINGS_AUTH_GRPC_URL} MF_THINGS_AUTH_GRPC_TIMEOUT: ${MF_THINGS_AUTH_GRPC_TIMEOUT} - MF_AUTH_CACHE_URL: things-redis:${MF_REDIS_TCP_PORT} + MF_THINGS_AUTH_GRPC_CLIENT_TLS: ${MF_THINGS_AUTH_GRPC_CLIENT_TLS} + MF_THINGS_AUTH_GRPC_CA_CERTS: ${MF_THINGS_AUTH_GRPC_CA_CERTS} + MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_BROKER_URL: ${MF_BROKER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} networks: - mainflux-base-net @@ -233,14 +251,19 @@ services: - broker restart: on-failure environment: - MF_HTTP_ADAPTER_LOG_LEVEL: debug + MF_HTTP_ADAPTER_LOG_LEVEL: ${MF_HTTP_ADAPTER_LOG_LEVEL} + MF_HTTP_ADAPTER_HOST: ${MF_HTTP_ADAPTER_HOST} MF_HTTP_ADAPTER_PORT: ${MF_HTTP_ADAPTER_PORT} - MF_HTTP_ADAPTER_INSTANCE_ID: ${MF_HTTP_ADAPTER_INSTANCE_ID} - MF_BROKER_URL: ${MF_BROKER_URL} - MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_HTTP_ADAPTER_SERVER_CERT: ${MF_HTTP_ADAPTER_SERVER_CERT} + MF_HTTP_ADAPTER_SERVER_KEY: ${MF_HTTP_ADAPTER_SERVER_KEY} MF_THINGS_AUTH_GRPC_URL: ${MF_THINGS_AUTH_GRPC_URL} MF_THINGS_AUTH_GRPC_TIMEOUT: ${MF_THINGS_AUTH_GRPC_TIMEOUT} + MF_THINGS_AUTH_GRPC_CLIENT_TLS: ${MF_THINGS_AUTH_GRPC_CLIENT_TLS} + MF_THINGS_AUTH_GRPC_CA_CERTS: ${MF_THINGS_AUTH_GRPC_CA_CERTS} + MF_BROKER_URL: ${MF_BROKER_URL} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} + MF_HTTP_ADAPTER_INSTANCE_ID: ${MF_HTTP_ADAPTER_INSTANCE_ID} ports: - ${MF_HTTP_ADAPTER_PORT}:${MF_HTTP_ADAPTER_PORT} networks: @@ -264,16 +287,25 @@ services: restart: on-failure environment: MF_COAP_ADAPTER_LOG_LEVEL: ${MF_COAP_ADAPTER_LOG_LEVEL} + MF_COAP_ADAPTER_HOST: ${MF_COAP_ADAPTER_HOST} MF_COAP_ADAPTER_PORT: ${MF_COAP_ADAPTER_PORT} - MF_COAP_ADAPTER_INSTANCE_ID: ${MF_COAP_ADAPTER_INSTANCE_ID} - MF_BROKER_URL: ${MF_BROKER_URL} - MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_COAP_ADAPTER_SERVER_CERT: ${MF_COAP_ADAPTER_SERVER_CERT} + MF_COAP_ADAPTER_SERVER_KEY: ${MF_COAP_ADAPTER_SERVER_KEY} + MF_COAP_ADAPTER_HTTP_HOST: ${MF_COAP_ADAPTER_HTTP_HOST} + MF_COAP_ADAPTER_HTTP_PORT: ${MF_COAP_ADAPTER_HTTP_PORT} + MF_COAP_ADAPTER_HTTP_SERVER_CERT: ${MF_COAP_ADAPTER_HTTP_SERVER_CERT} + MF_COAP_ADAPTER_HTTP_SERVER_KEY: ${MF_COAP_ADAPTER_HTTP_SERVER_KEY} MF_THINGS_AUTH_GRPC_URL: ${MF_THINGS_AUTH_GRPC_URL} MF_THINGS_AUTH_GRPC_TIMEOUT: ${MF_THINGS_AUTH_GRPC_TIMEOUT} + MF_THINGS_AUTH_GRPC_CLIENT_TLS: ${MF_THINGS_AUTH_GRPC_CLIENT_TLS} + MF_THINGS_AUTH_GRPC_CA_CERTS: ${MF_THINGS_AUTH_GRPC_CA_CERTS} + MF_BROKER_URL: ${MF_BROKER_URL} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} + MF_COAP_ADAPTER_INSTANCE_ID: ${MF_COAP_ADAPTER_INSTANCE_ID} ports: - ${MF_COAP_ADAPTER_PORT}:${MF_COAP_ADAPTER_PORT}/udp - - ${MF_COAP_ADAPTER_PORT}:${MF_COAP_ADAPTER_PORT}/tcp + - ${MF_COAP_ADAPTER_HTTP_PORT}:${MF_COAP_ADAPTER_HTTP_PORT}/tcp networks: - mainflux-base-net @@ -286,14 +318,19 @@ services: restart: on-failure environment: MF_WS_ADAPTER_LOG_LEVEL: ${MF_WS_ADAPTER_LOG_LEVEL} - MF_WS_ADAPTER_PORT: ${MF_WS_ADAPTER_PORT} - MF_WS_ADAPTER_INSTANCE_ID: ${MF_WS_ADAPTER_INSTANCE_ID} - MF_BROKER_URL: ${MF_BROKER_URL} - MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_WS_ADAPTER_HTTP_HOST: ${MF_WS_ADAPTER_HTTP_HOST} + MF_WS_ADAPTER_HTTP_PORT: ${MF_WS_ADAPTER_HTTP_PORT} + MF_WS_ADAPTER_HTTP_SERVER_CERT: ${MF_WS_ADAPTER_HTTP_SERVER_CERT} + MF_WS_ADAPTER_HTTP_SERVER_KEY: ${MF_WS_ADAPTER_HTTP_SERVER_KEY} MF_THINGS_AUTH_GRPC_URL: ${MF_THINGS_AUTH_GRPC_URL} MF_THINGS_AUTH_GRPC_TIMEOUT: ${MF_THINGS_AUTH_GRPC_TIMEOUT} + MF_THINGS_AUTH_GRPC_CLIENT_TLS: ${MF_THINGS_AUTH_GRPC_CLIENT_TLS} + MF_THINGS_AUTH_GRPC_CA_CERTS: ${MF_THINGS_AUTH_GRPC_CA_CERTS} + MF_BROKER_URL: ${MF_BROKER_URL} + MF_JAEGER_URL: ${MF_JAEGER_URL} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} + MF_WS_ADAPTER_INSTANCE_ID: ${MF_WS_ADAPTER_INSTANCE_ID} ports: - - ${MF_WS_ADAPTER_PORT}:${MF_WS_ADAPTER_PORT} + - ${MF_WS_ADAPTER_HTTP_PORT}:${MF_WS_ADAPTER_HTTP_PORT} networks: - mainflux-base-net diff --git a/docker/nginx/entrypoint.sh b/docker/nginx/entrypoint.sh index 9deccadeda8..6f25caa59be 100755 --- a/docker/nginx/entrypoint.sh +++ b/docker/nginx/entrypoint.sh @@ -16,7 +16,6 @@ envsubst ' ${MF_HTTP_ADAPTER_PORT} ${MF_NGINX_MQTT_PORT} ${MF_NGINX_MQTTS_PORT} - ${MF_CLIENTS_HTTP_PORT} - ${MF_WS_ADAPTER_PORT}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf + ${MF_WS_ADAPTER_HTTP_PORT}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf exec nginx -g "daemon off;" diff --git a/docker/nginx/nginx-key.conf b/docker/nginx/nginx-key.conf index ecfec164b58..9031abf894a 100644 --- a/docker/nginx/nginx-key.conf +++ b/docker/nginx/nginx-key.conf @@ -107,7 +107,7 @@ http { location /ws/ { include snippets/proxy-headers.conf; include snippets/ws-upgrade.conf; - proxy_pass http://ws-adapter:${MF_WS_ADAPTER_PORT}/; + proxy_pass http://ws-adapter:${MF_WS_ADAPTER_HTTP_PORT}/; } } } diff --git a/docker/nginx/nginx-x509.conf b/docker/nginx/nginx-x509.conf index c3b5f5d5528..2552e449e65 100644 --- a/docker/nginx/nginx-x509.conf +++ b/docker/nginx/nginx-x509.conf @@ -119,7 +119,7 @@ http { include snippets/verify-ssl-client.conf; include snippets/proxy-headers.conf; include snippets/ws-upgrade.conf; - proxy_pass http://ws-adapter:${MF_WS_ADAPTER_PORT}/; + proxy_pass http://ws-adapter:${MF_WS_ADAPTER_HTTP_PORT}/; } } } diff --git a/http/README.md b/http/README.md index 75e73295d3b..ecffcc42080 100644 --- a/http/README.md +++ b/http/README.md @@ -8,21 +8,25 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -| --------------------------- | ------------------------------------------------------------- | --------------------- | -| MF_HTTP_ADAPTER_LOG_LEVEL | Log level for the HTTP Adapter | info | -| MF_HTTP_ADAPTER_PORT | Service HTTP port | 80 | -| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | -| MF_HTTP_ADAPTER_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | -| MF_HTTP_ADAPTER_CA_CERTS | Path to trusted CAs in PEM format | | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | -| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1s | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| ------------------------------ | --------------------------------------------------- | ------------------------------ | +| MF_HTTP_ADAPTER_LOG_LEVEL | Log level for the HTTP Adapter | debug | +| MF_HTTP_ADAPTER_HOST | HTTP adapter listening host | | +| MF_HTTP_ADAPTER_PORT | Service HTTP port | 80 | +| MF_HTTP_ADAPTER_SERVER_CERT | Service server certificate | | +| MF_HTTP_ADAPTER_SERVER_KEY | Service server key | | +| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | +| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1s | +| MF_THINGS_AUTH_GRPC_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | +| MF_THINGS_AUTH_GRPC_CA_CERTS | Path to trusted CAs in PEM format | | +| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_HTTP_ADAPTER_INSTANCE_ID | HTTP Adapter instance ID | | ## Deployment -The service itself is distributed as Docker container. Check the [`http-adapter`](https://github.com/mainflux/mainflux/blob/master/docker/docker-compose.yml#L245-L262) service section in +The service itself is distributed as Docker container. Check the [`http-adapter`](https://github.com/mainflux/mainflux/blob/master/docker/docker-compose.yml#L245-L262) service section in docker-compose to see how service is deployed. To start the service outside of the container, execute the following shell script: @@ -40,13 +44,19 @@ make http make install # set the environment variables and run the service -MF_BROKER_URL=[Message broker instance URL] \ MF_HTTP_ADAPTER_LOG_LEVEL=[HTTP Adapter Log Level] \ +MF_HTTP_ADAPTER_HOST=[Service HTTP host] \ MF_HTTP_ADAPTER_PORT=[Service HTTP port] \ -MF_HTTP_ADAPTER_CA_CERTS=[Path to trusted CAs in PEM format] \ -MF_JAEGER_URL=[Jaeger server URL] \ +MF_HTTP_ADAPTER_SERVER_CERT=[Path to server certificate] \ +MF_HTTP_ADAPTER_SERVER_KEY=[Path to server key] \ MF_THINGS_AUTH_GRPC_URL=[Things service Auth gRPC URL] \ MF_THINGS_AUTH_GRPC_TIMEOUT=[Things service Auth gRPC request timeout in seconds] \ +MF_THINGS_AUTH_GRPC_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ +MF_THINGS_AUTH_GRPC_CA_CERTS=[Path to trusted CAs in PEM format] \ +MF_BROKER_URL=[Message broker instance URL] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_HTTP_ADAPTER_INSTANCE_ID=[HTTP Adapter instance ID] \ $GOBIN/mainflux-http ``` diff --git a/internal/clients/cassandra/cassandra.go b/internal/clients/cassandra/cassandra.go index c7303d6bf53..281ef0b3bc7 100644 --- a/internal/clients/cassandra/cassandra.go +++ b/internal/clients/cassandra/cassandra.go @@ -17,11 +17,11 @@ var ( // Config contains Cassandra DB specific parameters. type Config struct { - Hosts []string `env:"DB_CLUSTER" envDefault:"127.0.0.1" envSeparator:","` - Keyspace string `env:"DB_KEYSPACE" envDefault:"mainflux"` - User string `env:"DB_USER" envDefault:""` - Pass string `env:"DB_PASS" envDefault:""` - Port int `env:"DB_PORT" envDefault:"9042"` + Hosts []string `env:"CLUSTER" envDefault:"127.0.0.1" envSeparator:","` + Keyspace string `env:"KEYSPACE" envDefault:"mainflux"` + User string `env:"USER" envDefault:""` + Pass string `env:"PASS" envDefault:""` + Port int `env:"PORT" envDefault:"9042"` } // Setup load configuration from environment and creates new cassandra connection. diff --git a/internal/clients/grpc/auth/client.go b/internal/clients/grpc/auth/client.go index c9bd8f74546..dae42e20f52 100644 --- a/internal/clients/grpc/auth/client.go +++ b/internal/clients/grpc/auth/client.go @@ -16,9 +16,9 @@ const envAuthGrpcPrefix = "MF_AUTH_GRPC_" var errGrpcConfig = errors.New("failed to load grpc configuration") // Setup loads Auth gRPC configuration from environment variable and creates new Auth gRPC API. -func Setup(envPrefix, svcName string) (policies.AuthServiceClient, grpcClient.ClientHandler, error) { +func Setup(svcName string) (policies.AuthServiceClient, grpcClient.ClientHandler, error) { config := grpcClient.Config{} - if err := env.Parse(&config, env.Options{Prefix: envAuthGrpcPrefix, AltPrefix: envPrefix}); err != nil { + if err := env.Parse(&config, env.Options{Prefix: envAuthGrpcPrefix}); err != nil { return nil, nil, errors.Wrap(errGrpcConfig, err) } c, ch, err := grpcClient.Setup(config, svcName) diff --git a/internal/clients/grpc/things/client.go b/internal/clients/grpc/things/client.go index 2c4c85c8ba0..0d97582c61b 100644 --- a/internal/clients/grpc/things/client.go +++ b/internal/clients/grpc/things/client.go @@ -16,9 +16,9 @@ const envThingsAuthGrpcPrefix = "MF_THINGS_AUTH_GRPC_" var errGrpcConfig = errors.New("failed to load grpc configuration") // Setup loads Things gRPC configuration from environment variable and creates new Things gRPC API. -func Setup(envPrefix string) (policies.AuthServiceClient, grpcClient.ClientHandler, error) { +func Setup() (policies.AuthServiceClient, grpcClient.ClientHandler, error) { config := grpcClient.Config{} - if err := env.Parse(&config, env.Options{Prefix: envThingsAuthGrpcPrefix, AltPrefix: envPrefix}); err != nil { + if err := env.Parse(&config, env.Options{Prefix: envThingsAuthGrpcPrefix}); err != nil { return nil, nil, errors.Wrap(errGrpcConfig, err) } diff --git a/internal/clients/influxdb/influxdb.go b/internal/clients/influxdb/influxdb.go index af5995b1eea..d08a7fa924b 100644 --- a/internal/clients/influxdb/influxdb.go +++ b/internal/clients/influxdb/influxdb.go @@ -23,7 +23,7 @@ type Config struct { Port string `env:"PORT" envDefault:"8086"` Username string `env:"ADMIN_USER" envDefault:"mainflux"` Password string `env:"ADMIN_PASSWORD" envDefault:"mainflux"` - DbName string `env:"DB" envDefault:"mainflux"` + DbName string `env:"NAME" envDefault:"mainflux"` Bucket string `env:"BUCKET" envDefault:"mainflux-bucket"` Org string `env:"ORG" envDefault:"mainflux"` Token string `env:"TOKEN" envDefault:"mainflux-token"` @@ -34,16 +34,16 @@ type Config struct { } // Setup load configuration from environment variable, create InfluxDB client and connect to InfluxDB server. -func Setup(envPrefix string, ctx context.Context) (influxdb2.Client, error) { +func Setup(ctx context.Context, envPrefix string) (influxdb2.Client, error) { config := Config{} if err := env.Parse(&config, env.Options{Prefix: envPrefix}); err != nil { return nil, errors.Wrap(errConfig, err) } - return Connect(config, ctx) + return Connect(ctx, config) } // Connect create InfluxDB client and connect to InfluxDB server. -func Connect(config Config, ctx context.Context) (influxdb2.Client, error) { +func Connect(ctx context.Context, config Config) (influxdb2.Client, error) { client := influxdb2.NewClientWithOptions(config.DBUrl, config.Token, influxdb2.DefaultOptions(). SetUseGZip(true). diff --git a/internal/clients/mongo/mongo.go b/internal/clients/mongo/mongo.go index 6ff49bd9b70..16698d6c35b 100644 --- a/internal/clients/mongo/mongo.go +++ b/internal/clients/mongo/mongo.go @@ -22,7 +22,7 @@ var ( type Config struct { Host string `env:"HOST" envDefault:"localhost"` Port string `env:"PORT" envDefault:"27017"` - DB string `env:"DB" envDefault:"messages"` + Name string `env:"NAME" envDefault:"messages"` } // Connect creates a connection to the MongoDB instance. @@ -33,7 +33,7 @@ func Connect(cfg Config) (*mongo.Database, error) { return nil, errors.Wrap(errConnect, err) } - db := client.Database(cfg.DB) + db := client.Database(cfg.Name) return db, nil } diff --git a/internal/clients/postgres/postgres.go b/internal/clients/postgres/postgres.go index 702ee2788c0..cfa797b3189 100644 --- a/internal/clients/postgres/postgres.go +++ b/internal/clients/postgres/postgres.go @@ -20,15 +20,15 @@ var ( ) type Config struct { - Host string `env:"DB_HOST,notEmpty" envDefault:"localhost"` - Port string `env:"DB_PORT,notEmpty" envDefault:"5432"` - User string `env:"DB_USER,notEmpty" envDefault:"mainflux"` - Pass string `env:"DB_PASS,notEmpty" envDefault:"mainflux"` - Name string `env:"DB" envDefault:""` - SSLMode string `env:"DB_SSL_MODE,notEmpty" envDefault:"disable"` - SSLCert string `env:"DB_SSL_CERT" envDefault:""` - SSLKey string `env:"DB_SSL_KEY" envDefault:""` - SSLRootCert string `env:"DB_SSL_ROOT_CERT" envDefault:""` + Host string `env:"HOST,notEmpty" envDefault:"localhost"` + Port string `env:"PORT,notEmpty" envDefault:"5432"` + User string `env:"USER,notEmpty" envDefault:"mainflux"` + Pass string `env:"PASS,notEmpty" envDefault:"mainflux"` + Name string `env:"NAME" envDefault:""` + SSLMode string `env:"SSL_MODE,notEmpty" envDefault:"disable"` + SSLCert string `env:"SSL_CERT" envDefault:""` + SSLKey string `env:"SSL_KEY" envDefault:""` + SSLRootCert string `env:"SSL_ROOT_CERT" envDefault:""` } // Setup creates a connection to the PostgreSQL instance and applies any diff --git a/internal/env/load.go b/internal/env/load.go deleted file mode 100644 index 1484af9a3c5..00000000000 --- a/internal/env/load.go +++ /dev/null @@ -1,10 +0,0 @@ -package env - -// NewConfig gets configuration from environment variable. -func NewConfig[T any](opts ...Options) (T, error) { - var cfg T - if err := Parse(&cfg, opts...); err != nil { - return cfg, err - } - return cfg, nil -} diff --git a/internal/env/parser.go b/internal/env/parser.go index 4bf127d809a..fe018d59a06 100644 --- a/internal/env/parser.go +++ b/internal/env/parser.go @@ -2,8 +2,6 @@ package env import ( "github.com/caarlos0/env/v7" - "github.com/mainflux/mainflux/internal/clients/grpc" - "github.com/mainflux/mainflux/internal/server" ) type Options struct { @@ -21,97 +19,20 @@ type Options struct { // Prefix define a prefix for each key Prefix string - - // AltPrefix define a alternate prefix for each key - AltPrefix string } func Parse(v interface{}, opts ...Options) error { - actOpt := []env.Options{} - altPrefix := "" + altOpts := []env.Options{} for _, opt := range opts { - actOpt = append(actOpt, env.Options{ + altOpts = append(altOpts, env.Options{ Environment: opt.Environment, TagName: opt.TagName, RequiredIfNoDef: opt.RequiredIfNoDef, OnSet: opt.OnSet, Prefix: opt.Prefix, }) - if opt.AltPrefix != "" { - altPrefix = opt.AltPrefix - } - } - - if altPrefix == "" { - return env.Parse(v, actOpt...) - } - - switch cfg := v.(type) { - case *grpc.Config: - return parseGrpcConfig(cfg, altPrefix, actOpt...) - case *server.Config: - return parseServerConfig(cfg, altPrefix, actOpt...) - default: - return env.Parse(v, actOpt...) - } -} - -func parseGrpcConfig(cfg *grpc.Config, altPrefix string, opts ...env.Options) error { - if err := env.Parse(cfg, opts...); err != nil { - return err } - if !cfg.ClientTLS || cfg.CACerts == "" { - altOpts := []env.Options{} - for _, opt := range opts { - if opt.Prefix != "" { - opt.Prefix = altPrefix - } - altOpts = append(altOpts, opt) - } - altCfg := grpc.Config{} - if err := env.Parse(&altCfg, altOpts...); err != nil { - return err - } - if cfg.CACerts == "" && altCfg.CACerts != "" { - cfg.CACerts = altCfg.CACerts - } - if !cfg.ClientTLS && altCfg.ClientTLS { - cfg.ClientTLS = altCfg.ClientTLS - } - } - - return nil -} - -func parseServerConfig(cfg *server.Config, altPrefix string, opts ...env.Options) error { - copyConfig := cfg - if err := env.Parse(cfg, opts...); err != nil { - return err - } - - if cfg.CertFile == "" || cfg.KeyFile == "" || cfg.Port == "" || cfg.Port == copyConfig.Port { - altOpts := []env.Options{} - for _, opt := range opts { - if opt.Prefix != "" { - opt.Prefix = altPrefix - } - altOpts = append(altOpts, opt) - } - altCfg := server.Config{} - if err := env.Parse(&altCfg, altOpts...); err != nil { - return err - } - if cfg.CertFile == "" && altCfg.CertFile != "" { - cfg.CertFile = altCfg.CertFile - } - if cfg.KeyFile == "" && altCfg.KeyFile != "" { - cfg.KeyFile = altCfg.KeyFile - } - if (cfg.Port == "" || cfg.Port == copyConfig.Port) && altCfg.Port != "" { - cfg.Port = altCfg.Port - } - } - return nil + return env.Parse(v, altOpts...) } diff --git a/internal/env/parser_test.go b/internal/env/parser_test.go index 4f846ad7c4d..cb2eca6b7e2 100644 --- a/internal/env/parser_test.go +++ b/internal/env/parser_test.go @@ -66,7 +66,7 @@ func TestParseServerConfig(t *testing.T) { nil, }, { - "Parsing with Server Config with Alt-Prefix", + "Parsing with conflicting configs", &server.Config{}, &server.Config{ Host: "localhost", @@ -77,40 +77,14 @@ func TestParseServerConfig(t *testing.T) { []Options{ { Environment: map[string]string{ + "PORT": "", + "MF-PORT": "8080", "MF-HOST": "localhost", "MF-HTTP-PORT": "8080", "MF-SERVER_CERT": "cert", "MF-SERVER_KEY": "key", }, - Prefix: "MF-", - AltPrefix: "MF-HTTP-", - }, - }, - nil, - }, - { - "Parsing with conflicting configs", - &server.Config{}, - &server.Config{ - Host: "localhost", - Port: "8080", - CertFile: "cert", - KeyFile: "key", - }, - []Options{ - { - Environment: map[string]string{ - "PORT": "", - "MF-PORT": "", - "MF-HOST": "localhost", - "MF-HTTP-PORT": "8080", - "MF-SERVER_CERT": "", - "MF-SERVER_KEY": "", - "MF-HTTP-SERVER_CERT": "cert", - "MF-HTTP-SERVER_KEY": "key", - }, - Prefix: "MF-", - AltPrefix: "MF-HTTP-", + Prefix: "MF-", }, }, nil, @@ -120,11 +94,11 @@ func TestParseServerConfig(t *testing.T) { err := Parse(test.config, test.options...) switch test.err { case nil: - assert.NoError(t, err, fmt.Sprintf("expected no error but got %v", err)) + assert.NoError(t, err, fmt.Sprintf("%s: expected no error but got %v", test.description, err)) default: - assert.Error(t, err, "expected error but got nil") + assert.Error(t, err, fmt.Sprintf("%s: expected error but got nil", test.description)) } - assert.Equal(t, test.expectedConfig, test.config, fmt.Sprintf("expected %v got %v", test.expectedConfig, test.config)) + assert.Equal(t, test.expectedConfig, test.config, fmt.Sprintf("%s: expected %v got %v", test.description, test.expectedConfig, test.config)) } } @@ -167,44 +141,6 @@ func TestParseGRPCConfig(t *testing.T) { }, errNotDuration, }, - { - "Parsing a grpc.Config with Alt-Prefix", - &grpc.Config{}, - &grpc.Config{ - URL: "val.com", - Timeout: time.Second, - }, - []Options{ - { - Environment: map[string]string{ - "MF-URL": "val.com", - "MF-GRPC-TIMEOUT": time.Second.String(), - }, - Prefix: "MF-", - AltPrefix: "MF-GRPC-", - }, - }, - nil, - }, - { - "Parsing a grpc.Config with Alt-Prefix and errors", - &grpc.Config{}, - &grpc.Config{ - URL: "val.com", - Timeout: time.Second, - }, - []Options{ - { - Environment: map[string]string{ - "MF-URL": "val.com", - "MF-GRPC-TIMEOUT": "not-duration", - }, - Prefix: "MF-", - AltPrefix: "MF-GRPC-", - }, - }, - errNotDuration, - }, { "Parsing conflicting configs", &grpc.Config{}, @@ -217,15 +153,12 @@ func TestParseGRPCConfig(t *testing.T) { []Options{ { Environment: map[string]string{ - "MF-URL": "val.com", - "MF-GRPC-TIMEOUT": "1s", - "MF-GRPC-CLIENT_TLS": "true", - "MF-GRPC-CA_CERTS": "cert", - "MF-CLIENT_TLS": "", - "MF-CA_CERTS": "", + "MF-URL": "val.com", + "MF-TIMEOUT": "1s", + "MF-CLIENT_TLS": "true", + "MF-CA_CERTS": "cert", }, - Prefix: "MF-", - AltPrefix: "MF-GRPC-", + Prefix: "MF-", }, }, nil, @@ -235,11 +168,11 @@ func TestParseGRPCConfig(t *testing.T) { err := Parse(test.config, test.options...) switch test.err { case nil: - assert.NoError(t, err, fmt.Sprintf("expected no error but got %v", err)) + assert.NoError(t, err, fmt.Sprintf("%s: expected no error but got %v", test.description, err)) default: - assert.Error(t, err, "expected error but got nil") + assert.Error(t, err, fmt.Sprintf("%s: expected error but got nil", test.description)) } - assert.Equal(t, test.expectedConfig, test.config, fmt.Sprintf("expected %v got %v", test.expectedConfig, test.config)) + assert.Equal(t, test.expectedConfig, test.config, fmt.Sprintf("%s: expected %v got %v", test.description, test.expectedConfig, test.config)) } } diff --git a/internal/server/coap/coap.go b/internal/server/coap/coap.go index fcb692d6094..5a097a33672 100644 --- a/internal/server/coap/coap.go +++ b/internal/server/coap/coap.go @@ -2,6 +2,7 @@ package coap import ( "context" + "crypto/tls" "fmt" "time" @@ -40,9 +41,26 @@ func New(ctx context.Context, cancel context.CancelFunc, name string, config ser func (s *Server) Start() error { errCh := make(chan error) s.Logger.Info(fmt.Sprintf("%s service started using http, exposed port %s", s.Name, s.Address)) - go func() { - errCh <- gocoap.ListenAndServe("udp", s.Address, s.handler) - }() + switch { + case s.Config.CertFile != "" || s.Config.KeyFile != "": + s.Logger.Info(fmt.Sprintf("%s service %s server listening at %s with TLS cert %s and key %s", s.Name, s.Protocol, s.Address, s.Config.CertFile, s.Config.KeyFile)) + certificate, err := tls.LoadX509KeyPair(s.Config.CertFile, s.Config.KeyFile) + if err != nil { + return fmt.Errorf("failed to load auth certificates: %w", err) + } + tlsConfig := &tls.Config{ + Certificates: []tls.Certificate{certificate}, + } + + go func() { + errCh <- gocoap.ListenAndServeTCPTLS("udp", s.Address, tlsConfig, s.handler) + }() + default: + s.Logger.Info(fmt.Sprintf("%s service %s server listening at %s without TLS", s.Name, s.Protocol, s.Address)) + go func() { + errCh <- gocoap.ListenAndServe("udp", s.Address, s.handler) + }() + } select { case <-s.Ctx.Done(): diff --git a/lora/README.md b/lora/README.md index 092fd645b7e..c347628d267 100644 --- a/lora/README.md +++ b/lora/README.md @@ -28,7 +28,7 @@ default values. | MF_THINGS_ES_PASS | Things service event source password | | | MF_THINGS_ES_DB | Things service event source DB | 0 | | MF_LORA_ADAPTER_EVENT_CONSUMER | Service event consumer name | lora | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | | MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | ## Deployment diff --git a/mqtt/README.md b/mqtt/README.md index d9bb443d31a..8b2a575e654 100644 --- a/mqtt/README.md +++ b/mqtt/README.md @@ -10,32 +10,30 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -|------------------------------------------|------------------------------------------------------------------|-----------------------| -| MF_MQTT_ADAPTER_LOG_LEVEL | mProxy Log level | info | -| MF_MQTT_ADAPTER_MQTT_PORT | mProxy port | 1883 | -| MF_MQTT_ADAPTER_MQTT_TARGET_HOST | MQTT broker host | 0.0.0.0 | -| MF_MQTT_ADAPTER_MQTT_TARGET_PORT | MQTT broker port | 1883 | -| MF_MQTT_ADAPTER_MQTT_TARGET_HEALTH_CHECK | URL of broker health check | "" | -| MF_MQTT_ADAPTER_WS_PORT | mProxy MQTT over WS port | 8080 | -| MF_MQTT_ADAPTER_WS_TARGET_HOST | MQTT broker host for MQTT over WS | localhost | -| MF_MQTT_ADAPTER_WS_TARGET_PORT | MQTT broker port for MQTT over WS | 8080 | -| MF_MQTT_ADAPTER_WS_TARGET_PATH | MQTT broker MQTT over WS path | /mqtt | -| MF_MQTT_ADAPTER_FORWARDER_TIMEOUT | MQTT forwarder for multiprotocol communication timeout | 30s | -| MF_BROKER_URL | Message broker broker URL | nats://127.0.0.1:4222 | -| MF_THINGS_AUTH_GRPC_URL | Things gRPC endpoint URL | localhost:7000 | -| MF_THINGS_AUTH_GRPC_TIMEOUT | Timeout in seconds for Things service gRPC calls | 1s | -| MF_JAEGER_URL | URL of Jaeger tracing service | "localhost:6831" | -| MF_MQTT_ADAPTER_CLIENT_TLS | gRPC client TLS | false | -| MF_MQTT_ADAPTER_CA_CERTS | CA certs for gRPC client TLS | "" | -| MF_MQTT_ADAPTER_INSTANCE | Instance name for event sourcing | "" | -| MF_MQTT_ADAPTER_ES_URL | Event sourcing URL | localhost:6379 | -| MF_MQTT_ADAPTER_ES_PASS | Event sourcing password | "" | -| MF_MQTT_ADAPTER_ES_DB | Event sourcing database | "0" | -| MF_AUTH_CACHE_URL | Users cache URL | localhost:6379 | -| MF_AUTH_CACHE_PASS | Users cache password | "" | -| MF_AUTH_CACHE_DB | Users cache database | "0" | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| ---------------------------------------- | ------------------------------------------------------ | -------------------------------- | +| MF_MQTT_ADAPTER_LOG_LEVEL | mProxy Log level | info | +| MF_MQTT_ADAPTER_MQTT_PORT | mProxy port | 1883 | +| MF_MQTT_ADAPTER_MQTT_TARGET_HOST | MQTT broker host | 0.0.0.0 | +| MF_MQTT_ADAPTER_MQTT_TARGET_PORT | MQTT broker port | 1883 | +| MF_MQTT_ADAPTER_FORWARDER_TIMEOUT | MQTT forwarder for multiprotocol communication timeout | 30s | +| MF_MQTT_ADAPTER_MQTT_TARGET_HEALTH_CHECK | URL of broker health check | "" | +| MF_MQTT_ADAPTER_WS_PORT | mProxy MQTT over WS port | 8080 | +| MF_MQTT_ADAPTER_WS_TARGET_HOST | MQTT broker host for MQTT over WS | localhost | +| MF_MQTT_ADAPTER_WS_TARGET_PORT | MQTT broker port for MQTT over WS | 8080 | +| MF_MQTT_ADAPTER_WS_TARGET_PATH | MQTT broker MQTT over WS path | /mqtt | +| MF_MQTT_ADAPTER_INSTANCE | Instance name for event sourcing | "" | +| MF_THINGS_AUTH_GRPC_URL | Things gRPC endpoint URL | localhost:7000 | +| MF_THINGS_AUTH_GRPC_TIMEOUT | Timeout in seconds for Things service gRPC calls | 1s | +| MF_THINGS_AUTH_GRPC_CLIENT_TLS | Enable TLS for Things service gRPC calls | false | +| MF_THINGS_AUTH_GRPC_CA_CERTS | CA certs for Things service gRPC calls | "" | +| MF_MQTT_ADAPTER_ES_URL | Event sourcing URL | localhost:6379 | +| MF_MQTT_ADAPTER_ES_PASS | Event sourcing password | "" | +| MF_MQTT_ADAPTER_ES_DB | Event sourcing database | "0" | +| MF_BROKER_URL | Message broker broker URL | nats://127.0.0.1:4222 | +| MF_JAEGER_URL | URL of Jaeger tracing service | "http://jaeger:14268/api/traces" | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_MQTT_ADAPTER_INSTANCE_ID | Instance ID for telemetry | "" | ## Deployment @@ -61,25 +59,26 @@ MF_MQTT_ADAPTER_LOG_LEVEL=[MQTT Adapter Log Level] \ MF_MQTT_ADAPTER_MQTT_PORT=[MQTT adapter MQTT port] MF_MQTT_ADAPTER_MQTT_TARGET_HOST=[MQTT broker host] \ MF_MQTT_ADAPTER_MQTT_TARGET_PORT=[MQTT broker MQTT port]] \ +MF_MQTT_ADAPTER_FORWARDER_TIMEOUT=[MQTT forwarder for multiprotocol support timeout] \ MF_MQTT_ADAPTER_MQTT_TARGET_HEALTH_CHECK=[MQTT health check URL] \ MF_MQTT_ADAPTER_WS_PORT=[MQTT adapter WS port] \ MF_MQTT_ADAPTER_WS_TARGET_HOST=[MQTT broker for MQTT over WS host] \ MF_MQTT_ADAPTER_WS_TARGET_PORT=[MQTT broker for MQTT over WS port]] \ MF_MQTT_ADAPTER_WS_TARGET_PATH=[MQTT adapter WS path] \ -MF_MQTT_ADAPTER_FORWARDER_TIMEOUT=[MQTT forwarder for multiprotocol support timeout] \ -MF_BROKER_URL=[Message broker instance URL] \ +MF_MQTT_ADAPTER_INSTANCE=[Instance for event sourcing] \ MF_THINGS_AUTH_GRPC_URL=[Things service Auth gRPC URL] \ MF_THINGS_AUTH_GRPC_TIMEOUT=[Things service Auth gRPC request timeout in seconds] \ -MF_JAEGER_URL=[Jaeger service URL] \ +MF_THINGS_AUTH_GRPC_CLIENT_TLS=[gRPC client TLS] \ +MF_THINGS_AUTH_GRPC_CA_CERTS=[CA certs for gRPC client] \ MF_MQTT_ADAPTER_CLIENT_TLS=[gRPC client TLS] \ MF_MQTT_ADAPTER_CA_CERTS=[CA certs for gRPC client] \ -MF_MQTT_ADAPTER_INSTANCE=[Instance for event sourcing] \ MF_MQTT_ADAPTER_ES_URL=[Event sourcing URL] \ MF_MQTT_ADAPTER_ES_PASS=[Event sourcing pass] \ MF_MQTT_ADAPTER_ES_DB=[Event sourcing database] \ -MF_AUTH_CACHE_URL=[Users cache URL] \ -MF_AUTH_CACHE_PASS=[Users cache pass] \ -MF_AUTH_CACHE_DB=[Users cache DB name] \ +MF_BROKER_URL=[Message broker instance URL] \ +MF_JAEGER_URL=[Jaeger service URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_MQTT_ADAPTER_INSTANCE_ID=[Instance ID] \ $GOBIN/mainflux-mqtt ``` diff --git a/opcua/README.md b/opcua/README.md index 6f1df5723b9..42d5817b327 100644 --- a/opcua/README.md +++ b/opcua/README.md @@ -28,7 +28,7 @@ default values. | MF_THINGS_ES_PASS | Things service event source password | | | MF_THINGS_ES_DB | Things service event source DB | 0 | | MF_OPCUA_ADAPTER_EVENT_CONSUMER | Service event consumer name | opcua | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | | MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | ## Deployment diff --git a/pkg/sdk/go/certs.go b/pkg/sdk/go/certs.go index a890ee2b438..8cb16b4ea2e 100644 --- a/pkg/sdk/go/certs.go +++ b/pkg/sdk/go/certs.go @@ -46,7 +46,7 @@ func (sdk mfSDK) IssueCert(thingID, valid, token string) (Cert, errors.SDKError) if err := json.Unmarshal(body, &c); err != nil { return Cert{}, errors.NewSDKError(err) } - + return c, nil } diff --git a/pkg/sdk/go/groups.go b/pkg/sdk/go/groups.go index 8a1caddbf8b..164f884d4c6 100644 --- a/pkg/sdk/go/groups.go +++ b/pkg/sdk/go/groups.go @@ -53,7 +53,7 @@ func (sdk mfSDK) CreateGroup(g Group, token string) (Group, errors.SDKError) { if err := json.Unmarshal(body, &g); err != nil { return Group{}, errors.NewSDKError(err) } - + return g, nil } @@ -81,7 +81,7 @@ func (sdk mfSDK) Groups(pm PageMetadata, token string) (GroupsPage, errors.SDKEr if err != nil { return GroupsPage{}, errors.NewSDKError(err) } - + return sdk.getGroups(url, token) } @@ -91,7 +91,7 @@ func (sdk mfSDK) Parents(id string, pm PageMetadata, token string) (GroupsPage, if err != nil { return GroupsPage{}, errors.NewSDKError(err) } - + return sdk.getGroups(url, token) } @@ -101,7 +101,7 @@ func (sdk mfSDK) Children(id string, pm PageMetadata, token string) (GroupsPage, if err != nil { return GroupsPage{}, errors.NewSDKError(err) } - + return sdk.getGroups(url, token) } @@ -115,7 +115,7 @@ func (sdk mfSDK) getGroups(url, token string) (GroupsPage, errors.SDKError) { if err := json.Unmarshal(body, &tp); err != nil { return GroupsPage{}, errors.NewSDKError(err) } - + return tp, nil } diff --git a/pkg/sdk/go/users.go b/pkg/sdk/go/users.go index fb312487dc7..579d47dbd74 100644 --- a/pkg/sdk/go/users.go +++ b/pkg/sdk/go/users.go @@ -140,7 +140,7 @@ func (sdk mfSDK) UpdateUser(user User, token string) (User, errors.SDKError) { if err := json.Unmarshal(body, &user); err != nil { return User{}, errors.NewSDKError(err) } - + return user, nil } @@ -161,7 +161,7 @@ func (sdk mfSDK) UpdateUserTags(user User, token string) (User, errors.SDKError) if err := json.Unmarshal(body, &user); err != nil { return User{}, errors.NewSDKError(err) } - + return user, nil } diff --git a/readers/cassandra/README.md b/readers/cassandra/README.md index 08666fb7339..09a5929f7c5 100644 --- a/readers/cassandra/README.md +++ b/readers/cassandra/README.md @@ -8,30 +8,33 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -|---------------------------------|-----------------------------------------------------|----------------| -| MF_CASSANDRA_READER_LOG_LEVEL | Service log level | info | -| MF_CASSANDRA_READER_PORT | Service HTTP port | 9003 | -| MF_CASSANDRA_READER_DB_CLUSTER | Cassandra cluster comma separated addresses | 127.0.0.1 | -| MF_CASSANDRA_READER_DB_USER | Cassandra DB username | | -| MF_CASSANDRA_READER_DB_PASS | Cassandra DB password | | -| MF_CASSANDRA_READER_DB_KEYSPACE | Cassandra keyspace name | messages | -| MF_CASSANDRA_READER_DB_PORT | Cassandra DB port | 9042 | -| MF_CASSANDRA_READER_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | -| MF_CASSANDRA_READER_CA_CERTS | Path to trusted CAs in PEM format | | -| MF_CASSANDRA_READER_SERVER_CERT | Path to server certificate in pem format | | -| MF_CASSANDRA_READER_SERVER_KEY | Path to server key in pem format | | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | -| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1 | -| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | -| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | - +| Variable | Description | Default | +| ------------------------------------ | --------------------------------------------------- | ------------------------------ | +| MF_CASSANDRA_READER_LOG_LEVEL | Cassandra service log level | debug | +| MF_CASSANDRA_READER_HTTP_HOST | Cassandra service HTTP host | localhost | +| MF_CASSANDRA_READER_HTTP_PORT | Cassandra service HTTP port | 9003 | +| MF_CASSANDRA_READER_HTTP_SERVER_CERT | Cassandra service HTTP server cert | "" | +| MF_CASSANDRA_READER_HTTP_SERVER_KEY | Cassandra service HTTP server key | "" | +| MF_CASSANDRA_CLUSTER | Cassandra cluster comma separated addresses | localhost | +| MF_CASSANDRA_USER | Cassandra DB username | mainflux | +| MF_CASSANDRA_PASS | Cassandra DB password | mainflux | +| MF_CASSANDRA_KEYSPACE | Cassandra keyspace name | messages | +| MF_CASSANDRA_PORT | Cassandra DB port | 9042 | +| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | +| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1 | +| MF_THINGS_AUTH_GRPC_CLIENT_TLS | Things service Auth gRPC TLS enabled | false | +| MF_THINGS_AUTH_GRPC_CA_CERTS | Things service Auth gRPC CA certificates | "" | +| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | +| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | +| MF_AUTH_GRPC_CLIENT_TLS | Users service gRPC TLS enabled | false | +| MF_AUTH_GRPC_CA_CERT | Users service gRPC CA certificates | "" | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_CASSANDRA_READER_INSTANCE_ID | Cassandra Reader instance ID | "" | ## Deployment -The service itself is distributed as Docker container. Check the [`cassandra-reader`](https://github.com/mainflux/mainflux/blob/master/docker/addons/cassandra-reader/docker-compose.yml#L15-L35) service section in +The service itself is distributed as Docker container. Check the [`cassandra-reader`](https://github.com/mainflux/mainflux/blob/master/docker/addons/cassandra-reader/docker-compose.yml#L15-L35) service section in docker-compose to see how service is deployed. To start the service, execute the following shell script: @@ -49,21 +52,28 @@ make cassandra-reader make install # Set the environment variables and run the service -MF_CASSANDRA_READER_PORT=[Service HTTP port] \ -MF_CASSANDRA_READER_DB_CLUSTER=[Cassandra cluster comma separated addresses] \ -MF_CASSANDRA_READER_DB_KEYSPACE=[Cassandra keyspace name] \ -MF_CASSANDRA_READER_DB_USER=[Cassandra DB username] \ -MF_CASSANDRA_READER_DB_PASS=[Cassandra DB password] \ -MF_CASSANDRA_READER_DB_PORT=[Cassandra DB port] \ -MF_CASSANDRA_READER_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ -MF_CASSANDRA_READER_CA_CERTS=[Path to trusted CAs in PEM format] \ -MF_CASSANDRA_READER_SERVER_CERT=[Path to server pem certificate file] \ -MF_CASSANDRA_READER_SERVER_KEY=[Path to server pem key file] \ -MF_JAEGER_URL=[Jaeger server URL] \ +MF_CASSANDRA_READER_LOG_LEVEL=[Cassandra Service log level] \ +MF_CASSANDRA_READER_HTTP_HOST=[Cassandra Service HTTP host] \ +MF_CASSANDRA_READER_HTTP_PORT=[Cassandra Service HTTP port] \ +MF_CASSANDRA_READER_HTTP_SERVER_CERT=[Cassandra Service HTTP server cert] \ +MF_CASSANDRA_READER_HTTP_SERVER_KEY=[Cassandra Service HTTP server key] \ +MF_CASSANDRA_CLUSTER=[Cassandra cluster comma separated addresses] \ +MF_CASSANDRA_KEYSPACE=[Cassandra keyspace name] \ +MF_CASSANDRA_USER=[Cassandra DB username] \ +MF_CASSANDRA_PASS=[Cassandra DB password] \ +MF_CASSANDRA_PORT=[Cassandra DB port] \ MF_THINGS_AUTH_GRPC_URL=[Things service Auth gRPC URL] \ MF_THINGS_AUTH_GRPC_TIMEOUT=[Things service Auth gRPC request timeout in seconds] \ +MF_THINGS_AUTH_GRPC_CLIENT_TLS=[Things service Auth gRPC TLS enabled] \ +MF_THINGS_AUTH_GRPC_CA_CERTS=[Things service Auth gRPC CA certificates] \ +MF_AUTH_GRPC_URL=[Users service gRPC URL] \ +MF_AUTH_GRPC_TIMEOUT=[Users service gRPC request timeout in seconds] \ +MF_AUTH_GRPC_CLIENT_TLS=[Users service gRPC TLS enabled] \ +MF_AUTH_GRPC_CA_CERT=[Users service gRPC CA certificates] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_CASSANDRA_READER_INSTANCE_ID=[Cassandra Reader instance ID] \ $GOBIN/mainflux-cassandra-reader - ``` ### Using docker-compose diff --git a/readers/influxdb/README.md b/readers/influxdb/README.md index ceb32b71c44..1073129316e 100644 --- a/readers/influxdb/README.md +++ b/readers/influxdb/README.md @@ -8,34 +8,37 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -|------------------------------|-----------------------------------------------------|-------------------| -| MF_INFLUX_READER_LOG_LEVEL | Service log level | info | -| MF_INFLUX_READER_PORT | Service HTTP port | 9005 | -| MF_INFLUXDB_HOST | InfluxDB host | localhost | -| MF_INFLUXDB_PORT | Default port of InfluxDB database | 8086 | -| MF_INFLUXDB_ADMIN_USER | Default user of InfluxDB database | mainflux | -| MF_INFLUXDB_ADMIN_PASSWORD | Default password of InfluxDB user | mainflux | -| MF_INFLUXDB_DB | InfluxDB database name | mainflux | -| MF_INFLUXDB_HOST | InfluxDB host name | mainflux-influxdb | -| MF_INFLUXDB_PROTOCOL | InfluxDB protocol | http | -| MF_INFLUXDB_TIMEOUT | InfluxDB client connection readiness timeout | 1s | -| MF_INFLUXDB_ORG | InfluxDB organization name | mainflux | -| MF_INFLUXDB_BUCKET | InfluxDB bucket name | mainflux-bucket | -| MF_INFLUXDB_TOKEN | InfluxDB API token | mainflux-token | -| MF_INFLUXDB_HTTP_ENABLED | InfluxDB http enabled status | true | -| MF_INFLUXDB_INIT_MODE | InfluxDB initialization mode | setup | -| MF_INFLUX_READER_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | -| MF_INFLUX_READER_CA_CERTS | Path to trusted CAs in PEM format | | -| MF_INFLUX_READER_SERVER_CERT | Path to server certificate in pem format | | -| MF_INFLUX_READER_SERVER_KEY | Path to server key in pem format | | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | -| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1s | -| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | -| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | - +| Variable | Description | Default | +| -------------------------------- | --------------------------------------------------- | ------------------------------ | +| MF_INFLUX_READER_LOG_LEVEL | Service log level | info | +| MF_INFLUX_READER_HTTP_HOST | Service HTTP host | localhost | +| MF_INFLUX_READER_HTTP_PORT | Service HTTP port | 9005 | +| MF_INFLUX_READER_SERVER_CERT | Service HTTP server cert | "" | +| MF_INFLUX_READER_SERVER_KEY | Service HTTP server key | "" | +| MF_INFLUXDB_PROTOCOL | InfluxDB protocol | http | +| MF_INFLUXDB_HOST | InfluxDB host name | localhost | +| MF_INFLUXDB_PORT | Default port of InfluxDB database | 8086 | +| MF_INFLUXDB_ADMIN_USER | Default user of InfluxDB database | mainflux | +| MF_INFLUXDB_ADMIN_PASSWORD | Default password of InfluxDB user | mainflux | +| MF_INFLUXDB_NAME | InfluxDB database name | mainflux | +| MF_INFLUXDB_BUCKET | InfluxDB bucket name | mainflux-bucket | +| MF_INFLUXDB_ORG | InfluxDB organization name | mainflux | +| MF_INFLUXDB_TOKEN | InfluxDB API token | mainflux-token | +| MF_INFLUXDB_DBURL | InfluxDB database URL | "" | +| MF_INFLUXDB_USER_AGENT | InfluxDB user agent | "" | +| MF_INFLUXDB_TIMEOUT | InfluxDB client connection readiness timeout | 1s | +| MF_INFLUXDB_INSECURE_SKIP_VERIFY | InfluxDB insecure skip verify | false | +| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | +| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1s | +| MF_THINGS_AUTH_GRPC_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | +| MF_THINGS_AUTH_GRPC_CA_CERTS | Path to trusted CAs in PEM format | "" | +| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | +| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | +| MF_AUTH_GRPC_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | +| MF_AUTH_GRPC_CA_CERTS | Path to trusted CAs in PEM format | "" | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_INFLUX_READER_INSTANCE_ID | InfluxDB reader instance ID | | ## Deployment @@ -56,26 +59,35 @@ make influxdb-reader make install # Set the environment variables and run the service -MF_INFLUX_READER_PORT=[Service HTTP port] \ -MF_INFLUXDB_DB=[InfluxDB database name] \ +MF_INFLUX_READER_LOG_LEVEL=[Service log level] \ +MF_INFLUX_READER_HTTP_HOST=[Service HTTP host] \ +MF_INFLUX_READER_HTTP_PORT=[Service HTTP port] \ +MF_INFLUX_READER_HTTP_SERVER_CERT=[Service HTTP server certificate] \ +MF_INFLUX_READER_HTTP_SERVER_KEY=[Service HTTP server key] \ +MF_INFLUXDB_PROTOCOL=[InfluxDB protocol] \ MF_INFLUXDB_HOST=[InfluxDB database host] \ -MF_INFLUXDB_ADMIN_USER=[InfluxDB database port] \ +MF_INFLUXDB_PORT=[InfluxDB database port] \ MF_INFLUXDB_ADMIN_USER=[InfluxDB admin user] \ MF_INFLUXDB_ADMIN_PASSWORD=[InfluxDB admin password] \ -MF_INFLUXDB_PROTOCOL=[InfluxDB protocol] \ -MF_INFLUXDB_TIMEOUT=[InfluxDB timeout] \ -MF_INFLUXDB_ORG=[InfluxDB org] \ +MF_INFLUXDB_NAME=[InfluxDB database name] \ MF_INFLUXDB_BUCKET=[InfluxDB bucket] \ +MF_INFLUXDB_ORG=[InfluxDB org] \ MF_INFLUXDB_TOKEN=[InfluxDB token] \ -MF_INFLUXDB_HTTP_ENABLED=[InfluxDB http enabled] \ -MF_INFLUXDB_INIT_MODE=[InfluxDB init mode] \ -MF_INFLUX_READER_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ -MF_INFLUX_READER_CA_CERTS=[Path to trusted CAs in PEM format] \ -MF_INFLUX_READER_SERVER_CERT=[Path to server pem certificate file] \ -MF_INFLUX_READER_SERVER_KEY=[Path to server pem key file] \ -MF_JAEGER_URL=[Jaeger server URL] \ +MF_INFLUXDB_DBURL=[InfluxDB database URL] \ +MF_INFLUXDB_USER_AGENT=[InfluxDB user agent] \ +MF_INFLUXDB_TIMEOUT=[InfluxDB timeout] \ +MF_INFLUXDB_INSECURE_SKIP_VERIFY=[InfluxDB insecure skip verify] \ MF_THINGS_AUTH_GRPC_URL=[Things service Auth gRPC URL] \ MF_THINGS_AURH_GRPC_TIMEOUT=[Things service Auth gRPC request timeout in seconds] \ +MF_THINGS_AUTH_GRPC_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ +MF_THINGS_AUTH_GRPC_CA_CERTS=[Path to trusted CAs in PEM format] \ +MF_AUTH_GRPC_URL=[Users service gRPC URL] \ +MF_AUTH_GRPC_TIMEOUT=[Users service gRPC request timeout in seconds] \ +MF_AUTH_GRPC_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ +MF_AUTH_GRPC_CA_CERTS=[Path to trusted CAs in PEM format] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_INFLUX_READER_INSTANCE_ID=[InfluxDB reader instance ID] \ $GOBIN/mainflux-influxdb ``` @@ -103,12 +115,12 @@ docker-compose -f docker/addons/influxdb-reader/docker-compose.yml up --env-file Service exposes [HTTP API](https://api.mainflux.io/?urls.primaryName=readers-openapi.yml) for fetching messages. Comparator Usage Guide: -| Comparator | Usage | Example | +| Comparator | Usage | Example | |----------------------|-----------------------------------------------------------------------------|------------------------------------| -| eq | Return values that are equal to the query | eq["active"] -> "active" | -| ge | Return values that are substrings of the query | ge["tiv"] -> "active" and "tiv" | -| gt | Return values that are substrings of the query and not equal to the query | gt["tiv"] -> "active" | -| le | Return values that are superstrings of the query | le["active"] -> "tiv" | -| lt | Return values that are superstrings of the query and not equal to the query | lt["active"] -> "active" and "tiv" | +| eq | Return values that are equal to the query | eq["active"] -> "active" | +| ge | Return values that are substrings of the query | ge["tiv"] -> "active" and "tiv" | +| gt | Return values that are substrings of the query and not equal to the query | gt["tiv"] -> "active" | +| le | Return values that are superstrings of the query | le["active"] -> "tiv" | +| lt | Return values that are superstrings of the query and not equal to the query | lt["active"] -> "active" and "tiv" | Official docs can be found [here](https://docs.mainflux.io). diff --git a/readers/mongodb/README.md b/readers/mongodb/README.md index d5857a6a916..8ee072f5396 100644 --- a/readers/mongodb/README.md +++ b/readers/mongodb/README.md @@ -8,28 +8,31 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -|-----------------------------|-----------------------------------------------------|----------------| -| MF_MONGO_READER_LOG_LEVEL | Service log level | info | -| MF_MONGO_READER_PORT | Service HTTP port | 9007 | -| MF_MONGO_READER_DB | MongoDB database name | messages | -| MF_MONGO_READER_DB_HOST | MongoDB database host | localhost | -| MF_MONGO_READER_DB_PORT | MongoDB database port | 27017 | -| MF_MONGO_READER_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | -| MF_MONGO_READER_CA_CERTS | Path to trusted CAs in PEM format | | -| MF_MONGO_SERVER_CERT | Path to server certificate in pem format | | -| MF_MONGO_SERVER_KEY | Path to server key in pem format | | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | -| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1s | -| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | -| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | - +| Variable | Description | Default | +| -------------------------------- | --------------------------------------------------- | ------------------------------ | +| MF_MONGO_READER_LOG_LEVEL | Service log level | info | +| MF_MONGO_READER_HTTP_HOST | Service HTTP host | localhost | +| MF_MONGO_READER_HTTP_PORT | Service HTTP port | 9007 | +| MF_MONGO_READER_HTTP_SERVER_CERT | Service HTTP server cert | "" | +| MF_MONGO_READER_HTTP_SERVER_KEY | Service HTTP server key | "" | +| MF_MONGO_NAME | MongoDB database name | messages | +| MF_MONGO_HOST | MongoDB database host | localhost | +| MF_MONGO_PORT | MongoDB database port | 27017 | +| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | +| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1s | +| MF_THINGS_AUTH_GRPC_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | +| MF_THINGS_AUTH_GRPC_CA_CERTS | Path to trusted CAs in PEM format | "" | +| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | +| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | +| MF_AUTH_GRPC_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | +| MF_AUTH_GRPC_CA_CERT | Path to trusted CAs in PEM format | "" | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_MONGO_READER_INSTANCE_ID | Service instance ID | "" | ## Deployment -The service itself is distributed as Docker container. Check the [`mongodb-reader`](https://github.com/mainflux/mainflux/blob/master/docker/addons/mongodb-reader/docker-compose.yml#L16-L37) service section in +The service itself is distributed as Docker container. Check the [`mongodb-reader`](https://github.com/mainflux/mainflux/blob/master/docker/addons/mongodb-reader/docker-compose.yml#L16-L37) service section in docker-compose to see how service is deployed. To start the service, execute the following shell script: @@ -47,17 +50,25 @@ make mongodb-reader make install # Set the environment variables and run the service -MF_MONGO_READER_PORT=[Service HTTP port] \ -MF_MONGO_READER_DB=[MongoDB database name] \ -MF_MONGO_READER_DB_HOST=[MongoDB database host] \ -MF_MONGO_READER_DB_PORT=[MongoDB database port] \ -MF_MONGO_READER_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ -MF_MONGO_READER_CA_CERTS=[Path to trusted CAs in PEM format] \ -MF_JAEGER_URL=[Jaeger server URL] \ -MF_MONGO_READER_SERVER_CERT=[Path to server pem certificate file] \ -MF_MONGO_READER_SERVER_KEY=[Path to server pem key file] \ +MF_MONGO_READER_LOG_LEVEL=[Service log level] \ +MF_MONGO_READER_HTTP_HOST=[Service HTTP host] \ +MF_MONGO_READER_HTTP_PORT=[Service HTTP port] \ +MF_MONGO_READER_HTTP_SERVER_CERT=[Path to server pem certificate file] \ +MF_MONGO_READER_HTTP_SERVER_KEY=[Path to server pem key file] \ +MF_MONGO_NAME=[MongoDB database name] \ +MF_MONGO_HOST=[MongoDB database host] \ +MF_MONGO_PORT=[MongoDB database port] \ MF_THINGS_AUTH_GRPC_URL=[Things service Auth gRPC URL] \ MF_THINGS_AUTH_GRPC_TIMEOUT=[Things service Auth gRPC request timeout in seconds] \ +MF_THINGS_AUTH_GRPC_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ +MF_THINGS_AUTH_GRPC_CA_CERTS=[Path to trusted CAs in PEM format] \ +MF_AUTH_GRPC_URL=[Users service gRPC URL] \ +MF_AUTH_GRPC_TIMEOUT=[Users service gRPC request timeout in seconds] \ +MF_AUTH_GRPC_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ +MF_AUTH_GRPC_CA_CERT=[Path to trusted CAs in PEM format] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_MONGO_READER_INSTANCE_ID=[Service instance ID] \ $GOBIN/mainflux-mongodb-reader ``` diff --git a/readers/postgres/README.md b/readers/postgres/README.md index 36814e0b0dc..ab5c86bd418 100644 --- a/readers/postgres/README.md +++ b/readers/postgres/README.md @@ -8,31 +8,37 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -|-------------------------------------|-----------------------------------------------|----------------| -| MF_POSTGRES_READER_LOG_LEVEL | Service log level | info | -| MF_POSTGRES_READER_PORT | Service HTTP port | 9009 | -| MF_POSTGRES_READER_CLIENT_TLS | TLS mode flag | false | -| MF_POSTGRES_READER_CA_CERTS | Path to trusted CAs in PEM format | | -| MF_POSTGRES_READER_DB_HOST | Postgres DB host | postgres | -| MF_POSTGRES_READER_DB_PORT | Postgres DB port | 5432 | -| MF_POSTGRES_READER_DB_USER | Postgres user | mainflux | -| MF_POSTGRES_READER_DB_PASS | Postgres password | mainflux | -| MF_POSTGRES_READER_DB | Postgres database name | messages | -| MF_POSTGRES_READER_DB_SSL_MODE | Postgres SSL mode | disabled | -| MF_POSTGRES_READER_DB_SSL_CERT | Postgres SSL certificate path | "" | -| MF_POSTGRES_READER_DB_SSL_KEY | Postgres SSL key | "" | -| MF_POSTGRES_READER_DB_SSL_ROOT_CERT | Postgres SSL root certificate path | "" | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | -| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC timeout in seconds | 1s | -| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | -| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| ----------------------------------- | --------------------------------------------- | ------------------------------ | +| MF_POSTGRES_READER_LOG_LEVEL | Service log level | info | +| MF_POSTGRES_READER_HTTP_HOST | Service HTTP host | localhost | +| MF_POSTGRES_READER_HTTP_PORT | Service HTTP port | 9009 | +| MF_POSTGRES_READER_HTTP_SERVER_CERT | Service HTTP server cert | "" | +| MF_POSTGRES_READER_HTTP_SERVER_KEY | Service HTTP server key | "" | +| MF_POSTGRES_HOST | Postgres DB host | localhost | +| MF_POSTGRES_PORT | Postgres DB port | 5432 | +| MF_POSTGRES_USER | Postgres user | mainflux | +| MF_POSTGRES_PASS | Postgres password | mainflux | +| MF_POSTGRES_NAME | Postgres database name | messages | +| MF_POSTGRES_SSL_MODE | Postgres SSL mode | disabled | +| MF_POSTGRES_SSL_CERT | Postgres SSL certificate path | "" | +| MF_POSTGRES_SSL_KEY | Postgres SSL key | "" | +| MF_POSTGRES_SSL_ROOT_CERT | Postgres SSL root certificate path | "" | +| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | +| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC timeout in seconds | 1s | +| MF_THINGS_AUTH_GRPC_CLIENT_TLS | Things service Auth gRPC TLS mode flag | false | +| MF_THINGS_AUTH_GRPC_CA_CERTS | Things service Auth gRPC CA certificates | "" | +| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | +| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | +| MF_AUTH_GRPC_CLIENT_TLS | Users service gRPC TLS mode flag | false | +| MF_AUTH_GRPC_CA_CERTS | Users service gRPC CA certificates | "" | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_POSTGRES_READER_INSTANCE_ID | Postgres reader instance ID | | ## Deployment -The service itself is distributed as Docker container. Check the [`postgres-reader`](https://github.com/mainflux/mainflux/blob/master/docker/addons/postgres-reader/docker-compose.yml#L17-L41) service section in +The service itself is distributed as Docker container. Check the [`postgres-reader`](https://github.com/mainflux/mainflux/blob/master/docker/addons/postgres-reader/docker-compose.yml#L17-L41) service section in docker-compose to see how service is deployed. To start the service, execute the following shell script: @@ -51,21 +57,30 @@ make install # Set the environment variables and run the service MF_POSTGRES_READER_LOG_LEVEL=[Service log level] \ -MF_POSTGRES_READER_PORT=[Service HTTP port] \ -MF_POSTGRES_READER_CLIENT_TLS =[TLS mode flag] \ -MF_POSTGRES_READER_CA_CERTS=[Path to trusted CAs in PEM format] \ -MF_POSTGRES_READER_DB_HOST=[Postgres host] \ -MF_POSTGRES_READER_DB_PORT=[Postgres port] \ -MF_POSTGRES_READER_DB_USER=[Postgres user] \ -MF_POSTGRES_READER_DB_PASS=[Postgres password] \ -MF_POSTGRES_READER_DB=[Postgres database name] \ -MF_POSTGRES_READER_DB_SSL_MODE=[Postgres SSL mode] \ -MF_POSTGRES_READER_DB_SSL_CERT=[Postgres SSL cert] \ -MF_POSTGRES_READER_DB_SSL_KEY=[Postgres SSL key] \ -MF_POSTGRES_READER_DB_SSL_ROOT_CERT=[Postgres SSL Root cert] \ -MF_JAEGER_URL=[Jaeger server URL] \ +MF_POSTGRES_READER_HTTP_HOST=[Service HTTP host] \ +MF_POSTGRES_READER_HTTP_PORT=[Service HTTP port] \ +MF_POSTGRES_READER_HTTP_SERVER_CERT=[Service HTTPS server certificate path] \ +MF_POSTGRES_READER_HTTP_SERVER_KEY=[Service HTTPS server key path] \ +MF_POSTGRES_HOST=[Postgres host] \ +MF_POSTGRES_PORT=[Postgres port] \ +MF_POSTGRES_USER=[Postgres user] \ +MF_POSTGRES_PASS=[Postgres password] \ +MF_POSTGRES_NAME=[Postgres database name] \ +MF_POSTGRES_SSL_MODE=[Postgres SSL mode] \ +MF_POSTGRES_SSL_CERT=[Postgres SSL cert] \ +MF_POSTGRES_SSL_KEY=[Postgres SSL key] \ +MF_POSTGRES_SSL_ROOT_CERT=[Postgres SSL Root cert] \ MF_THINGS_AUTH_GRPC_URL=[Things service Auth GRPC URL] \ MF_THINGS_AUTH_GRPC_TIMEOUT=[Things service Auth gRPC request timeout in seconds] \ +MF_THINGS_AUTH_GRPC_CLIENT_TLS=[Things service Auth gRPC TLS mode flag] \ +MF_THINGS_AUTH_GRPC_CA_CERTS=[Things service Auth gRPC CA certificates] \ +MF_AUTH_GRPC_URL=[Users service gRPC URL] \ +MF_AUTH_GRPC_TIMEOUT=[Users service gRPC request timeout in seconds] \ +MF_AUTH_GRPC_CLIENT_TLS=[Users service gRPC TLS mode flag] \ +MF_AUTH_GRPC_CA_CERTS=[Users service gRPC CA certificates] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_POSTGRES_READER_INSTANCE_ID=[Postgres reader instance ID] \ $GOBIN/mainflux-postgres-reader ``` @@ -74,12 +89,13 @@ $GOBIN/mainflux-postgres-reader Starting service will start consuming normalized messages in SenML format. Comparator Usage Guide: -| Comparator | Usage | Example | -|----------------------|-----------------------------------------------------------------------------|------------------------------------| -| eq | Return values that are equal to the query | eq["active"] -> "active" | -| ge | Return values that are substrings of the query | ge["tiv"] -> "active" and "tiv" | -| gt | Return values that are substrings of the query and not equal to the query | gt["tiv"] -> "active" | -| le | Return values that are superstrings of the query | le["active"] -> "tiv" | -| lt | Return values that are superstrings of the query and not equal to the query | lt["active"] -> "active" and "tiv" | + +| Comparator | Usage | Example | +| ---------- | --------------------------------------------------------------------------- | ---------------------------------- | +| eq | Return values that are equal to the query | eq["active"] -> "active" | +| ge | Return values that are substrings of the query | ge["tiv"] -> "active" and "tiv" | +| gt | Return values that are substrings of the query and not equal to the query | gt["tiv"] -> "active" | +| le | Return values that are superstrings of the query | le["active"] -> "tiv" | +| lt | Return values that are superstrings of the query and not equal to the query | lt["active"] -> "active" and "tiv" | Official docs can be found [here](https://docs.mainflux.io). diff --git a/readers/timescale/README.md b/readers/timescale/README.md index 5e40992e456..b0694d0635c 100644 --- a/readers/timescale/README.md +++ b/readers/timescale/README.md @@ -8,25 +8,33 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -|--------------------------------------|---------------------------------------------|----------------| -| MF_TIMESCALE_READER_LOG_LEVEL | Service log level | info | -| MF_TIMESCALE_READER_PORT | Service HTTP port | 9011 | -| MF_TIMESCALE_READER_CLIENT_TLS | TLS mode flag | false | -| MF_TIMESCALE_READER_CA_CERTS | Path to trusted CAs in PEM format | | -| MF_TIMESCALE_READER_DB_HOST | Timescale DB host | localhost | -| MF_TIMESCALE_READER_DB_PORT | Timescale DB port | 5432 | -| MF_TIMESCALE_READER_DB_USER | Timescale user | mainflux | -| MF_TIMESCALE_READER_DB_PASS | Timescale password | mainflux | -| MF_TIMESCALE_READER_DB | Timescale database name | messages | -| MF_TIMESCALE_READER_DB_SSL_MODE | Timescale SSL mode | disabled | -| MF_TIMESCALE_READER_DB_SSL_CERT | Timescale SSL certificate path | "" | -| MF_TIMESCALE_READER_DB_SSL_KEY | Timescale SSL key | "" | -| MF_TIMESCALE_READER_DB_SSL_ROOT_CERT | Timescale SSL root certificate path | "" | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | -| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC timeout in seconds | 1s | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| ------------------------------------ | ------------------------------------------- | ------------------------------ | +| MF_TIMESCALE_READER_LOG_LEVEL | Service log level | info | +| MF_TIMESCALE_READER_HTTP_HOST | Service HTTP host | localhost | +| MF_TIMESCALE_READER_HTTP_PORT | Service HTTP port | 8180 | +| MF_TIMESCALE_READER_HTTP_SERVER_CERT | Service HTTP server certificate path | "" | +| MF_TIMESCALE_READER_HTTP_SERVER_KEY | Service HTTP server key path | "" | +| MF_TIMESCALE_HOST | Timescale DB host | localhost | +| MF_TIMESCALE_PORT | Timescale DB port | 5432 | +| MF_TIMESCALE_USER | Timescale user | mainflux | +| MF_TIMESCALE_PASS | Timescale password | mainflux | +| MF_TIMESCALE_NAME | Timescale database name | messages | +| MF_TIMESCALE_SSL_MODE | Timescale SSL mode | disabled | +| MF_TIMESCALE_SSL_CERT | Timescale SSL certificate path | "" | +| MF_TIMESCALE_SSL_KEY | Timescale SSL key | "" | +| MF_TIMESCALE_SSL_ROOT_CERT | Timescale SSL root certificate path | "" | +| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | +| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC timeout in seconds | 1s | +| MF_THINGS_AUTH_GRPC_CLIENT_TLS | Things service Auth gRPC TLS enabled flag | false | +| MF_THINGS_AUTH_GRPC_CA_CERTS | Things service Auth gRPC CA certificates | "" | +| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | +| MF_AUTH_GRPC_TIMEOUT | Users service gRPC timeout in seconds | 1s | +| MF_AUTH_GRPC_CLIENT_TLS | Users service gRPC TLS enabled flag | false | +| MF_AUTH_GRPC_CA_CERT | Users service gRPC CA certificate | "" | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_TIMESCALE_READER_INSTANCE_ID | Timescale reader instance ID | "" | ## Deployment @@ -48,21 +56,30 @@ make install # Set the environment variables and run the service MF_TIMESCALE_READER_LOG_LEVEL=[Service log level] \ -MF_TIMESCALE_READER_PORT=[Service HTTP port] \ -MF_TIMESCALE_READER_CLIENT_TLS =[TLS mode flag] \ -MF_TIMESCALE_READER_CA_CERTS=[Path to trusted CAs in PEM format] \ -MF_TIMESCALE_READER_DB_HOST=[Timescale host] \ -MF_TIMESCALE_READER_DB_PORT=[Timescale port] \ -MF_TIMESCALE_READER_DB_USER=[Timescale user] \ -MF_TIMESCALE_READER_DB_PASS=[Timescale password] \ -MF_TIMESCALE_READER_DB=[Timescale database name] \ -MF_TIMESCALE_READER_DB_SSL_MODE=[Timescale SSL mode] \ -MF_TIMESCALE_READER_DB_SSL_CERT=[Timescale SSL cert] \ -MF_TIMESCALE_READER_DB_SSL_KEY=[Timescale SSL key] \ -MF_TIMESCALE_READER_DB_SSL_ROOT_CERT=[Timescale SSL Root cert] \ -MF_JAEGER_URL=[Jaeger server URL] \ +MF_TIMESCALE_READER_HTTP_HOST=[Service HTTP host] \ +MF_TIMESCALE_READER_HTTP_PORT=[Service HTTP port] \ +MF_TIMESCALE_READER_HTTP_SERVER_CERT=[Service HTTP server cert] \ +MF_TIMESCALE_READER_HTTP_SERVER_KEY=[Service HTTP server key] \ +MF_TIMESCALE_HOST=[Timescale host] \ +MF_TIMESCALE_PORT=[Timescale port] \ +MF_TIMESCALE_USER=[Timescale user] \ +MF_TIMESCALE_PASS=[Timescale password] \ +MF_TIMESCALE_NAME=[Timescale database name] \ +MF_TIMESCALE_SSL_MODE=[Timescale SSL mode] \ +MF_TIMESCALE_SSL_CERT=[Timescale SSL cert] \ +MF_TIMESCALE_SSL_KEY=[Timescale SSL key] \ +MF_TIMESCALE_SSL_ROOT_CERT=[Timescale SSL Root cert] \ MF_THINGS_AUTH_GRPC_URL=[Things service Auth GRPC URL] \ MF_THINGS_AUTH_GRPC_TIMEOUT=[Things service Auth gRPC request timeout in seconds] \ +MF_THINGS_AUTH_GRPC_CLIENT_TLS=[Things service Auth gRPC TLS enabled flag] \ +MF_THINGS_AUTH_GRPC_CA_CERTS=[Things service Auth gRPC CA certificates] \ +MF_AUTH_GRPC_URL=[Users service Auth gRPC URL] \ +MF_AUTH_GRPC_TIMEOUT=[Users service Auth gRPC request timeout in seconds] \ +MF_AUTH_GRPC_CLIENT_TLS=[Users service Auth gRPC TLS enabled flag] \ +MF_AUTH_GRPC_CA_CERT=[Users service Auth gRPC CA certificates] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_TIMESCALE_READER_INSTANCE_ID=[Timescale reader instance ID] \ $GOBIN/mainflux-timescale-reader ``` @@ -71,12 +88,12 @@ $GOBIN/mainflux-timescale-reader Starting service will start consuming normalized messages in SenML format. Comparator Usage Guide: -| Comparator | Usage | Example | +| Comparator | Usage | Example | |----------------------|-----------------------------------------------------------------------------|------------------------------------| -| eq | Return values that are equal to the query | eq["active"] -> "active" | -| ge | Return values that are substrings of the query | ge["tiv"] -> "active" and "tiv" | -| gt | Return values that are substrings of the query and not equal to the query | gt["tiv"] -> "active" | -| le | Return values that are superstrings of the query | le["active"] -> "tiv" | -| lt | Return values that are superstrings of the query and not equal to the query | lt["active"] -> "active" and "tiv" | +| eq | Return values that are equal to the query | eq["active"] -> "active" | +| ge | Return values that are substrings of the query | ge["tiv"] -> "active" and "tiv" | +| gt | Return values that are substrings of the query and not equal to the query | gt["tiv"] -> "active" | +| le | Return values that are superstrings of the query | le["active"] -> "tiv" | +| lt | Return values that are superstrings of the query and not equal to the query | lt["active"] -> "active" and "tiv" | Official docs can be found [here](https://docs.mainflux.io). diff --git a/scripts/run.sh b/scripts/run.sh index 1632d4ec089..936259215a4 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -53,7 +53,7 @@ MF_HTTP_ADAPTER_LOG_LEVEL=info MF_HTTP_ADAPTER_PORT=8008 MF_THINGS_AUTH_GRPC_URL ### # WS ### -MF_WS_ADAPTER_LOG_LEVEL=info MF_WS_ADAPTER_PORT=8190 MF_THINGS_AUTH_GRPC_URL=localhost:7000 $BUILD_DIR/mainflux-ws & +MF_WS_ADAPTER_LOG_LEVEL=info MF_WS_ADAPTER_HTTP_PORT=8190 MF_THINGS_AUTH_GRPC_URL=localhost:7000 $BUILD_DIR/mainflux-ws & ### # MQTT diff --git a/things/README.md b/things/README.md index eba38954796..c4281ef9401 100644 --- a/things/README.md +++ b/things/README.md @@ -16,44 +16,48 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -| ---------------------------- | ----------------------------------------------------------------------- | -------------- | -| MF_THINGS_LOG_LEVEL | Log level for Things (debug, info, warn, error) | info | -| MF_THINGS_DB_HOST | Database host address | localhost | -| MF_THINGS_DB_PORT | Database host port | 5432 | -| MF_THINGS_DB_USER | Database user | mainflux | -| MF_THINGS_DB_PASS | Database password | mainflux | -| MF_THINGS_DB | Name of the database used by the service | things | -| MF_THINGS_DB_SSL_MODE | Database connection SSL mode (disable, require, verify-ca, verify-full) | disable | -| MF_THINGS_DB_SSL_CERT | Path to the PEM encoded certificate file | | -| MF_THINGS_DB_SSL_KEY | Path to the PEM encoded key file | | -| MF_THINGS_DB_SSL_ROOT_CERT | Path to the PEM encoded root certificate file | | -| MF_THINGS_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | -| MF_THINGS_CA_CERTS | Path to trusted CAs in PEM format | | -| MF_THINGS_CACHE_URL | Cache database URL | localhost:6379 | -| MF_THINGS_CACHE_PASS | Cache database password | | -| MF_THINGS_CACHE_DB | Cache instance name | 0 | -| MF_THINGS_CACHE_KEY_DURATION | Cache key duration in seconds | 3600 | -| MF_THINGS_ES_URL | Event store URL | localhost:6379 | -| MF_THINGS_ES_PASS | Event store password | | -| MF_THINGS_ES_DB | Event store instance name | 0 | -| MF_THINGS_HTTP_PORT | Things service HTTP port | 9000 | -| MF_THINGS_AUTH_HTTP_PORT | Things service Auth HTTP port | 9001 | -| MF_THINGS_AUTH_GRPC_PORT | Things service Auth gRPC port | 7000 | -| MF_THINGS_SERVER_CERT | Path to server certificate in pem format | | -| MF_THINGS_SERVER_KEY | Path to server key in pem format | | -| MF_THINGS_STANDALONE_ID | User ID for standalone mode (no gRPC communication with users) | | -| MF_THINGS_STANDALONE_TOKEN | User token for standalone mode that should be passed in auth header | | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | -| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server. | true | +| Variable | Description | Default | +| ---------------------------- | ----------------------------------------------------------------------- | ------------------------------ | +| MF_THINGS_LOG_LEVEL | Log level for Things (debug, info, warn, error) | info | +| MF_THINGS_HTTP_HOST | Things service HTTP host | localhost | +| MF_THINGS_HTTP_PORT | Things service HTTP port | 9000 | +| MF_THINGS_SERVER_CERT | Path to the PEM encoded server certificate file | "" | +| MF_THINGS_SERVER_KEY | Path to the PEM encoded server key file | "" | +| MF_THINGS_GRPC_HOST | Things service gRPC host | localhost | +| MF_THINGS_GRPC_PORT | Things service gRPC port | 7000 | +| MF_THINGS_GRPC_SERVER_CERT | Path to the PEM encoded server certificate file | "" | +| MF_THINGS_GRPC_SERVER_KEY | Path to the PEM encoded server key file | "" | +| MF_THINGS_DB_HOST | Database host address | localhost | +| MF_THINGS_DB_PORT | Database host port | 5432 | +| MF_THINGS_DB_USER | Database user | mainflux | +| MF_THINGS_DB_PASS | Database password | mainflux | +| MF_THINGS_DB_NAME | Name of the database used by the service | things | +| MF_THINGS_DB_SSL_MODE | Database connection SSL mode (disable, require, verify-ca, verify-full) | disable | +| MF_THINGS_DB_SSL_CERT | Path to the PEM encoded certificate file | "" | +| MF_THINGS_DB_SSL_KEY | Path to the PEM encoded key file | "" | +| MF_THINGS_DB_SSL_ROOT_CERT | Path to the PEM encoded root certificate file | "" | +| MF_THINGS_CACHE_URL | Cache database URL | localhost:6379 | +| MF_THINGS_CACHE_PASS | Cache database password | "" | +| MF_THINGS_CACHE_DB | Cache instance name | 0 | +| MF_THINGS_CACHE_KEY_DURATION | Cache key duration in seconds | 3600 | +| MF_THINGS_ES_URL | Event store URL | localhost:6379 | +| MF_THINGS_ES_PASS | Event store password | "" | +| MF_THINGS_ES_DB | Event store instance name | 0 | +| MF_THINGS_STANDALONE_ID | User ID for standalone mode (no gRPC communication with users) | "" | +| MF_THINGS_STANDALONE_TOKEN | User token for standalone mode that should be passed in auth header | "" | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | +| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | +| MF_AUTH_GRPC_CLIENT_TLS | Enable TLS for gRPC client | false | +| MF_AUTH_GRPC_CA_CERT | Path to the CA certificate file | "" | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server. | true | +| MF_THINGS_INSTANCE_ID | Things instance ID | "" | **Note** that if you want `things` service to have only one user locally, you should use `MF_THINGS_STANDALONE` env vars. By specifying these, you don't need `auth` service in your deployment for users' authorization. ## Deployment -The service itself is distributed as Docker container. Check the [`things `](https://github.com/mainflux/mainflux/blob/master/docker/docker-compose.yml#L167-L194) service section in +The service itself is distributed as Docker container. Check the [`things `](https://github.com/mainflux/mainflux/blob/master/docker/docker-compose.yml#L167-L194) service section in docker-compose to see how service is deployed. To start the service outside of the container, execute the following shell script: @@ -72,32 +76,39 @@ make install # set the environment variables and run the service MF_THINGS_LOG_LEVEL=[Things log level] \ +MF_THINGS_STANDALONE_ID=[User ID for standalone mode (no gRPC communication with auth)] \ +MF_THINGS_STANDALONE_TOKEN=[User token for standalone mode that should be passed in auth header] \ +MF_THINGS_CACHE_KEY_DURATION=[Cache key duration in seconds] \ +MF_THINGS_HTTP_HOST=[Things service HTTP host] \ +MF_THINGS_HTTP_PORT=[Things service HTTP port] \ +MF_THINGS_HTTP_SERVER_CERT=[Path to server certificate in pem format] \ +MF_THINGS_HTTP_SERVER_KEY=[Path to server key in pem format] \ +MF_THINGS_GRPC_HOST=[Things service gRPC host] \ +MF_THINGS_GRPC_PORT=[Things service gRPC port] \ +MF_THINGS_GRPC_SERVER_CERT=[Path to server certificate in pem format] \ +MF_THINGS_GRPC_SERVER_KEY=[Path to server key in pem format] \ MF_THINGS_DB_HOST=[Database host address] \ MF_THINGS_DB_PORT=[Database host port] \ MF_THINGS_DB_USER=[Database user] \ MF_THINGS_DB_PASS=[Database password] \ -MF_THINGS_DB=[Name of the database used by the service] \ +MF_THINGS_DB_NAME=[Name of the database used by the service] \ MF_THINGS_DB_SSL_MODE=[SSL mode to connect to the database with] \ MF_THINGS_DB_SSL_CERT=[Path to the PEM encoded certificate file] \ MF_THINGS_DB_SSL_KEY=[Path to the PEM encoded key file] \ MF_THINGS_DB_SSL_ROOT_CERT=[Path to the PEM encoded root certificate file] \ -MF_HTTP_ADAPTER_CA_CERTS=[Path to trusted CAs in PEM format] \ MF_THINGS_CACHE_URL=[Cache database URL] \ MF_THINGS_CACHE_PASS=[Cache database password] \ MF_THINGS_CACHE_DB=[Cache instance name] \ MF_THINGS_ES_URL=[Event store URL] \ MF_THINGS_ES_PASS=[Event store password] \ MF_THINGS_ES_DB=[Event store instance name] \ -MF_THINGS_HTTP_PORT=[Things service HTTP port] \ -MF_THINGS_AUTH_HTTP_PORT=[Things service Auth HTTP port] \ -MF_THINGS_AUTH_GRPC_PORT=[Things service Auth gRPC port] \ -MF_THINGS_SERVER_CERT=[Path to server certificate] \ -MF_THINGS_SERVER_KEY=[Path to server key] \ -MF_THINGS_STANDALONE_EMAIL=[User email for standalone mode (no gRPC communication with auth)] \ -MF_THINGS_STANDALONE_TOKEN=[User token for standalone mode that should be passed in auth header] \ -MF_JAEGER_URL=[Jaeger server URL] \ MF_AUTH_GRPC_URL=[Users service gRPC URL] \ MF_AUTH_GRPC_TIMEOUT=[Users service gRPC request timeout in seconds] \ +MF_AUTH_GRPC_CLIENT_TLS=[Enable TLS for gRPC client] \ +MF_AUTH_GRPC_CA_CERT=[Path to trusted CA certificate file] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_THINGS_INSTANCE_ID=[Things instance ID] \ $GOBIN/mainflux-things ``` diff --git a/things/clients/service.go b/things/clients/service.go index cf541b49619..0581942ed2a 100644 --- a/things/clients/service.go +++ b/things/clients/service.go @@ -97,7 +97,6 @@ func (svc service) ListClients(ctx context.Context, token string, pm mfclients.P return mfclients.ClientsPage{}, err } - switch err = svc.checkAdmin(ctx, userID, thingsObjectKey, listRelationKey); err { // If the user is admin, fetch all things from database. case nil: diff --git a/twins/README.md b/twins/README.md index d658f1609e7..68385f405be 100644 --- a/twins/README.md +++ b/twins/README.md @@ -12,33 +12,32 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -|----------------------------|----------------------------------------------------------------------|-----------------------| -| MF_TWINS_LOG_LEVEL | Log level for twin service (debug, info, warn, error) | info | -| MF_TWINS_HTTP_PORT | Twins service HTTP port | 9018 | -| MF_TWINS_SERVER_CERT | Path to server certificate in PEM format | | -| MF_TWINS_SERVER_KEY | Path to server key in PEM format | | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_TWINS_DB | Database name | mainflux | -| MF_TWINS_DB_HOST | Database host address | localhost | -| MF_TWINS_DB_PORT | Database host port | 27017 | -| MF_THINGS_STANDALONE_ID | User ID for standalone mode (no gRPC communication with users) | | -| MF_THINGS_STANDALONE_TOKEN | User token for standalone mode that should be passed in auth header | | -| MF_TWINS_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | -| MF_TWINS_CA_CERTS | Path to trusted CAs in PEM format | | -| MF_TWINS_CHANNEL_ID | Message broker notifications channel ID | | -| MF_BROKER_URL | Mainflux Message broker URL | nats://localhost:4222 | -| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | -| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | -| MF_TWINS_CACHE_URL | Cache database URL | localhost:6379 | -| MF_TWINS_CACHE_PASS | Cache database password | | -| MF_TWINS_CACHE_DB | Cache instance name | 0 | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | - +| Variable | Description | Default | +| -------------------------- | ------------------------------------------------------------------- | ------------------------------ | +| MF_TWINS_LOG_LEVEL | Log level for twin service (debug, info, warn, error) | info | +| MF_TWINS_HTTP_PORT | Twins service HTTP port | 9018 | +| MF_TWINS_SERVER_CERT | Path to server certificate in PEM format | | +| MF_TWINS_SERVER_KEY | Path to server key in PEM format | | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_TWINS_DB | Database name | mainflux | +| MF_TWINS_DB_HOST | Database host address | localhost | +| MF_TWINS_DB_PORT | Database host port | 27017 | +| MF_THINGS_STANDALONE_ID | User ID for standalone mode (no gRPC communication with users) | | +| MF_THINGS_STANDALONE_TOKEN | User token for standalone mode that should be passed in auth header | | +| MF_TWINS_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | +| MF_TWINS_CA_CERTS | Path to trusted CAs in PEM format | | +| MF_TWINS_CHANNEL_ID | Message broker notifications channel ID | | +| MF_BROKER_URL | Mainflux Message broker URL | nats://localhost:4222 | +| MF_AUTH_GRPC_URL | Users service gRPC URL | localhost:7001 | +| MF_AUTH_GRPC_TIMEOUT | Users service gRPC request timeout in seconds | 1s | +| MF_TWINS_CACHE_URL | Cache database URL | localhost:6379 | +| MF_TWINS_CACHE_PASS | Cache database password | | +| MF_TWINS_CACHE_DB | Cache instance name | 0 | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | ## Deployment -The service itself is distributed as Docker container. Check the [`twins`](https://github.com/mainflux/mainflux/blob/master/docker/addons/twins/docker-compose.yml#L35-L58) service section in +The service itself is distributed as Docker container. Check the [`twins`](https://github.com/mainflux/mainflux/blob/master/docker/addons/twins/docker-compose.yml#L35-L58) service section in docker-compose to see how service is deployed. To start the service outside of the container, execute the following shell @@ -57,21 +56,22 @@ make twins make install # set the environment variables and run the service -MF_TWINS_LOG_LEVEL: [Twins log level] \ -MF_TWINS_HTTP_PORT: [Service HTTP port] \ -MF_TWINS_SERVER_CERT: [String path to server cert in pem format] \ -MF_TWINS_SERVER_KEY: [String path to server key in pem format] \ -MF_JAEGER_URL: [Jaeger server URL] MF_TWINS_DB: [Database name] \ -MF_TWINS_DB_HOST: [Database host address] \ -MF_TWINS_DB_PORT: [Database host port] \ +MF_TWINS_LOG_LEVEL=[Twins log level] \ +MF_TWINS_HTTP_PORT=[Service HTTP port] \ +MF_TWINS_SERVER_CERT=[String path to server cert in pem format] \ +MF_TWINS_SERVER_KEY=[String path to server key in pem format] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_TWINS_DB=[Database name] \ +MF_TWINS_DB_HOST=[Database host address] \ +MF_TWINS_DB_PORT=[Database host port] \ MF_THINGS_STANDALONE_EMAIL=[User email for standalone mode (no gRPC communication with auth)] \ MF_THINGS_STANDALONE_TOKEN=[User token for standalone mode that should be passed in auth header] \ -MF_TWINS_CLIENT_TLS: [Flag that indicates if TLS should be turned on] \ -MF_TWINS_CA_CERTS: [Path to trusted CAs in PEM format] \ -MF_TWINS_CHANNEL_ID: [Message broker notifications channel ID] \ -MF_BROKER_URL: [Mainflux Message broker URL] \ -MF_AUTH_GRPC_URL: [Users service gRPC URL] \ -MF_AUTH_GRPC_TIMEOUT: [Users service gRPC request timeout in seconds] \ +MF_TWINS_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ +MF_TWINS_CA_CERTS=[Path to trusted CAs in PEM format] \ +MF_TWINS_CHANNEL_ID=[Message broker notifications channel ID] \ +MF_BROKER_URL=[Mainflux Message broker URL] \ +MF_AUTH_GRPC_URL=[Users service gRPC URL] \ +MF_AUTH_GRPC_TIMEOUT=[Users service gRPC request timeout in seconds] \ $GOBIN/mainflux-twins ``` diff --git a/users/README.md b/users/README.md index b3e6675efb9..b2309eb5aef 100644 --- a/users/README.md +++ b/users/README.md @@ -16,39 +16,43 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -| ------------------------------- | ----------------------------------------------------------------------- | -------------- | -| MF_USERS_LOG_LEVEL | Log level for Users (debug, info, warn, error) | info | -| MF_USERS_DB_HOST | Database host address | localhost | -| MF_USERS_DB_PORT | Database host port | 5432 | -| MF_USERS_DB_USER | Database user | mainflux | -| MF_USERS_DB_PASS | Database password | mainflux | -| MF_USERS_DB | Name of the database used by the service | users | -| MF_USERS_DB_SSL_MODE | Database connection SSL mode (disable, require, verify-ca, verify-full) | disable | -| MF_USERS_DB_SSL_CERT | Path to the PEM encoded certificate file | | -| MF_USERS_DB_SSL_KEY | Path to the PEM encoded key file | | -| MF_USERS_DB_SSL_ROOT_CERT | Path to the PEM encoded root certificate file | | -| MF_USERS_HTTP_PORT | Users service HTTP port | 9002 | -| MF_USERS_GRPC_PORT | Users service GRPC port | 7001 | -| MF_USERS_GRPC_TIMEOUT | Users service GRPC Timeout | 1s | -| MF_USERS_SERVER_CERT | Path to server certificate in pem format | | -| MF_USERS_SERVER_KEY | Path to server key in pem format | | -| MF_USERS_SECRET_KEY | Default secret key used to generate tokens | mainflux | -| MF_USERS_ADMIN_EMAIL | Default user, created on startup | | -| MF_USERS_ADMIN_PASSWORD | Default user password, created on startup | | -| MF_USERS_PASS_REGEX | Password regex | `^.{8,}$$` | -| MF_USERS_ACCESS_TOKEN_DURATION | Duration for an access token to be valid | 15m | -| MF_USERS_REFRESH_TOKEN_DURATION | Duration for a refresh token to be valid | 24h | -| MF_TOKEN_RESET_ENDPOINT | Password request reset endpoint, for constructing link | /reset-request | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_EMAIL_HOST | Mail server host | localhost | -| MF_EMAIL_PORT | Mail server port | 25 | -| MF_EMAIL_USERNAME | Mail server username | | -| MF_EMAIL_PASSWORD | Mail server password | | -| MF_EMAIL_FROM_ADDRESS | Email "from" address | | -| MF_EMAIL_FROM_NAME | Email "from" name | | -| MF_EMAIL_TEMPLATE | Email template for sending emails with password reset link | email.tmpl | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server. | true | +| Variable | Description | Default | +| ------------------------------- | ----------------------------------------------------------------------- | ------------------------------ | +| MF_USERS_LOG_LEVEL | Log level for Users (debug, info, warn, error) | info | +| MF_USERS_SECRET_KEY | Default secret key used to generate tokens | mainflux | +| MF_USERS_ADMIN_EMAIL | Default user, created on startup | admin@example.com | +| MF_USERS_ADMIN_PASSWORD | Default user password, created on startup | 12345678 | +| MF_USERS_PASS_REGEX | Password regex | `^.{8,}$` | +| MF_USERS_ACCESS_TOKEN_DURATION | Duration for an access token to be valid | 15m | +| MF_USERS_REFRESH_TOKEN_DURATION | Duration for a refresh token to be valid | 24h | +| MF_TOKEN_RESET_ENDPOINT | Password request reset endpoint, for constructing link | /reset-request | +| MF_USERS_HTTP_HOST | Users service HTTP host | localhost | +| MF_USERS_HTTP_PORT | Users service HTTP port | 9002 | +| MF_USERS_HTTP_SERVER_CERT | Path to server certificate in pem format | "" | +| MF_USERS_HTTP_SERVER_KEY | Path to server key in pem format | "" | +| MF_USERS_GRPC_HOST | Users service GRPC host | localhost | +| MF_USERS_GRPC_PORT | Users service GRPC port | 7001 | +| MF_USERS_GRPC_SERVER_CERT | Path to server certificate in pem format | "" | +| MF_USERS_GRPC_SERVER_KEY | Path to server key in pem format | "" | +| MF_USERS_DB_HOST | Database host address | localhost | +| MF_USERS_DB_PORT | Database host port | 5432 | +| MF_USERS_DB_USER | Database user | mainflux | +| MF_USERS_DB_PASS | Database password | mainflux | +| MF_USERS_DB_NAME | Name of the database used by the service | users | +| MF_USERS_DB_SSL_MODE | Database connection SSL mode (disable, require, verify-ca, verify-full) | disable | +| MF_USERS_DB_SSL_CERT | Path to the PEM encoded certificate file | "" | +| MF_USERS_DB_SSL_KEY | Path to the PEM encoded key file | "" | +| MF_USERS_DB_SSL_ROOT_CERT | Path to the PEM encoded root certificate file | "" | +| MF_EMAIL_HOST | Mail server host | localhost | +| MF_EMAIL_PORT | Mail server port | 25 | +| MF_EMAIL_USERNAME | Mail server username | | +| MF_EMAIL_PASSWORD | Mail server password | | +| MF_EMAIL_FROM_ADDRESS | Email "from" address | | +| MF_EMAIL_FROM_NAME | Email "from" name | | +| MF_EMAIL_TEMPLATE | Email template for sending emails with password reset link | email.tmpl | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server. | true | +| MF_INSTANCE_ID | Mainflux instance ID | "" | ## Deployment @@ -70,28 +74,30 @@ make install # set the environment variables and run the service MF_USERS_LOG_LEVEL=[Users log level] \ +MF_USERS_SECRET_KEY=[Secret key used to generate tokens] \ +MF_USERS_ADMIN_EMAIL=[Default user, created on startup] \ +MF_USERS_ADMIN_PASSWORD=[Default user password, created on startup] \ +MF_USERS_PASS_REGEX=[Password regex] \ +MF_USERS_ACCESS_TOKEN_DURATION=[Duration for an access token to be valid] \ +MF_USERS_REFRESH_TOKEN_DURATION=[Duration for a refresh token to be valid] \ +MF_TOKEN_RESET_ENDPOINT=[Password reset token endpoint] \ +MF_USERS_HTTP_HOST=[Service HTTP host] \ +MF_USERS_HTTP_PORT=[Service HTTP port] \ +MF_USERS_HTTP_SERVER_CERT=[Path to server certificate] \ +MF_USERS_HTTP_SERVER_KEY=[Path to server key] \ +MF_USERS_GRPC_HOST=[Service GRPC host] \ +MF_USERS_GRPC_PORT=[Service GRPC port] \ +MF_USERS_GRPC_SERVER_CERT=[Path to server certificate] \ +MF_USERS_GRPC_SERVER_KEY=[Path to server key] \ MF_USERS_DB_HOST=[Database host address] \ MF_USERS_DB_PORT=[Database host port] \ MF_USERS_DB_USER=[Database user] \ MF_USERS_DB_PASS=[Database password] \ -MF_USERS_DB=[Name of the database used by the service] \ +MF_USERS_DB_NAME=[Name of the database used by the service] \ MF_USERS_DB_SSL_MODE=[SSL mode to connect to the database with] \ MF_USERS_DB_SSL_CERT=[Path to the PEM encoded certificate file] \ MF_USERS_DB_SSL_KEY=[Path to the PEM encoded key file] \ MF_USERS_DB_SSL_ROOT_CERT=[Path to the PEM encoded root certificate file] \ -MF_USERS_HTTP_PORT=[Service HTTP port] \ -MF_USERS_GRPC_PORT=[Service GRPC port] \ -MF_USERS_GRPC_TIMEOUT=[Service GRPC Timeout] \ -MF_USERS_SERVER_CERT=[Path to server certificate] \ -MF_USERS_SERVER_KEY=[Path to server key] \ -MF_USERS_SECRET_KEY=[Secret key used to generate tokens] \ -MF_USERS_ADMIN_EMAIL=[Default user, created on startup] \ -MF_USERS_ADMIN_PASSWORD=[Default user password, created on startup] \ -MF_USERS_PASS_REGEX=[Password regex] \ -MF_USERS_ACCESS_TOKEN_DURATION=[Duration for an access token to be valid] \ -MF_USERS_REFRESH_TOKEN_DURATION=[Duration for a refresh token to be valid] \ -MF_TOKEN_RESET_ENDPOINT=[Password reset token endpoint] \ -MF_JAEGER_URL=[Jaeger server URL] \ MF_EMAIL_HOST=[Mail server host] \ MF_EMAIL_PORT=[Mail server port] \ MF_EMAIL_USERNAME=[Mail server username] \ @@ -99,6 +105,9 @@ MF_EMAIL_PASSWORD=[Mail server password] \ MF_EMAIL_FROM_ADDRESS=[Email from address] \ MF_EMAIL_FROM_NAME=[Email from name] \ MF_EMAIL_TEMPLATE=[Email template file] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to Jaeger (true/false)] \ +MF_USERS_INSTANCE_ID=[Instance ID] \ $GOBIN/mainflux-users ``` @@ -109,4 +118,4 @@ If `MF_EMAIL_TEMPLATE` doesn't point to any file service will function but passw For more information about service capabilities and its usage, please check out the [API documentation](https://api.mainflux.io/?urls.primaryName=users-openapi.yml). -[doc]: https://docs.mainflux.io \ No newline at end of file +[doc]: https://docs.mainflux.io diff --git a/ws/README.md b/ws/README.md index 17056fdd1a3..b93a6319e5d 100644 --- a/ws/README.md +++ b/ws/README.md @@ -8,21 +8,25 @@ The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values. -| Variable | Description | Default | -|------------------------------|-----------------------------------------------------|-----------------------| -| MF_WS_ADAPTER_PORT | Service WS port | 8190 | -| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | -| MF_WS_ADAPTER_LOG_LEVEL | Log level for the WS Adapter | info | -| MF_WS_ADAPTER_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | -| MF_WS_ADAPTER_CA_CERTS | Path to trusted CAs in PEM format | | -| MF_JAEGER_URL | Jaeger server URL | localhost:6831 | -| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | -| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1s | -| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| Variable | Description | Default | +| ------------------------------ | --------------------------------------------------- | ------------------------------ | +| MF_WS_ADAPTER_LOG_LEVEL | Log level for the WS Adapter | info | +| MF_WS_ADAPTER_HTTP_HOST | Service WS host | | +| MF_WS_ADAPTER_HTTP_PORT | Service WS port | 8190 | +| MF_WS_ADAPTER_HTTP_SERVER_CERT | Service WS server certificate | | +| MF_WS_ADAPTER_HTTP_SERVER_KEY | Service WS server key | | +| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:7000 | +| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1s | +| MF_THINGS_AUTH_GRPC_CLIENT_TLS | Flag that indicates if TLS should be turned on | false | +| MF_THINGS_AUTH_GRPC_CA_CERTS | Path to trusted CAs in PEM format | | +| MF_BROKER_URL | Message broker instance URL | nats://localhost:4222 | +| MF_JAEGER_URL | Jaeger server URL | http://jaeger:14268/api/traces | +| MF_SEND_TELEMETRY | Send telemetry to mainflux call home server | true | +| MF_WS_ADAPTER_INSTANCE_ID | Service instance ID | "" | ## Deployment -The service is distributed as Docker container. Check the [`ws-adapter`](https://github.com/mainflux/mainflux/blob/master/docker/docker-compose.yml#L350-L368) service section in docker-compose to see how the service is deployed. +The service is distributed as Docker container. Check the [`ws-adapter`](https://github.com/mainflux/mainflux/blob/master/docker/docker-compose.yml#L350-L368) service section in docker-compose to see how the service is deployed. Running this service outside of container requires working instance of the message broker service. To start the service outside of the container, execute the following shell script: @@ -40,14 +44,19 @@ make ws make install # set the environment variables and run the service -MF_Broker_URL=[Message broker instance URL] \ -MF_WS_ADAPTER_PORT=[Service WS port] \ MF_WS_ADAPTER_LOG_LEVEL=[WS adapter log level] \ -MF_WS_ADAPTER_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ -MF_WS_ADAPTER_CA_CERTS=[Path to trusted CAs in PEM format] \ -MF_JAEGER_URL=[Jaeger server URL] \ +MF_WS_ADAPTER_HTTP_HOST=[Service WS host] \ +MF_WS_ADAPTER_HTTP_PORT=[Service WS port] \ +MF_WS_ADAPTER_HTTP_SERVER_CERT=[Service WS server certificate] \ +MF_WS_ADAPTER_HTTP_SERVER_KEY=[Service WS server key] \ MF_THINGS_AUTH_GRPC_URL=[Things service Auth gRPC URL] \ MF_THINGS_AUTH_GRPC_TIMEOUT=[Things service Auth gRPC request timeout in seconds] \ +MF_THINGS_AUTH_GRPC_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \ +MF_THINGS_AUTH_GRPC_CA_CERTS=[Path to trusted CAs in PEM format] \ +MF_BROKER_URL=[Message broker instance URL] \ +MF_JAEGER_URL=[Jaeger server URL] \ +MF_SEND_TELEMETRY=[Send telemetry to mainflux call home server] \ +MF_WS_ADAPTER_INSTANCE_ID=[Service instance ID] \ $GOBIN/mainflux-ws ```