Installation with Docker
On a single server without Kubernetes, MSC runs with Docker Compose. Docker starts the services in the right order, checks their health and restarts a service that fails. PostgreSQL (with TimescaleDB) and Redis run as containers alongside.
Prerequisites
- Linux with Docker Engine 24 or later and the Compose plugin (
docker compose version). - A reverse proxy with TLS in front of the interface, the sign-in and the PKI, for example Caddy, Traefik or nginx.
The services listen on
127.0.0.1only for it. - Free ports 8883 to 8885 for the radio protocols of the base stations; they do not go through the reverse proxy.
Setting up
The files are in the directory deploy/compose of the delivery.
cp .env.example .env # version, host names, ports
./init-secrets.sh admin@example.com # creates ./secrets once
docker compose up -d
init-secrets.sh creates one file per secret under ./secrets: the passwords of the database and of Redis, the key
of the PKI, the installation id and, for every service and the interface, a key pair (client-keys-<client> and
client-keys-<client>-public) they authenticate with at the identity instead of a shared secret (private_key_jwt).
The script needs openssl for that. The identity gets the public keys only. The directory is readable by the operator only. An
existing file is left unchanged, so the script can safely be run again. The password of the first administrator is in
secrets/identity-admin-password afterwards.
The services read their secrets as files under /run/secrets in the container. No secret is in an environment
variable or in .env.
Back up ./secrets separately from the volumes. Without secrets/pki-pki-secret the private keys of the PKI can no
longer be opened.
First sign-in
Sign in at the interface with the e-mail address you gave init-secrets.sh (it is also in secrets/identity-admin-email) and the
password in secrets/identity-admin-password (cat secrets/identity-admin-password). The script makes it at random: 24 characters
of letters, digits and ., _, -, with upper and lower case, a digit and a special character, so that it meets the password rules of the
identity (at least 8 characters, an upper-case letter, a lower-case letter, a digit, a special character). The first sign-in asks for a new password at once, before any application gets
anything; the generated one is good for that only and expires after 72 hours. Then you install the license (see License).
If the sign-in fails:
docker compose ps: ifidentityisrestartingorexited(the other services wait for it), the service refused to start.docker compose logs identitygives the cause in one line with the codeidentity.admin-user.password-invalid(the password breaks the rules or is still the placeholderREPLACE-ME) oridentity.admin-user.creation-refused(an e-mail address the service does not accept, say). The password itself is never in it. If a password of your own breaks the rules, the service does not run and there is no administrator yet; you make the password again:rm secrets/identity-admin-password && ./init-secrets.sh admin@example.com && docker compose up -d. A password of your own goes intosecrets/identity-admin-password, within the rules above.- If
identityruns (healthy) and you still cannot sign in: check the address insecrets/identity-admin-email(the user name is the address) and whether the 72 hours of the first password have passed;docker compose restart identitygives it again for another period as long as nobody has signed in.
Reverse proxy
Public name (.env) | Target |
|---|---|
MSC_APP_HOST | http://127.0.0.1:8080 (interface) |
MSC_IDENTITY_HOST | http://127.0.0.1:8081 (sign-in) |
MSC_PKI_HOST | http://127.0.0.1:8082, only the path /api/v1/pki/public |
The proxy must pass WebSockets through (live views of the interface) and set the headers X-Forwarded-For and
X-Forwarded-Proto.
Your own CA in front of the interface
The interface calls the identity (the sign-in) from its server on the identity's public address: discovery document, token, user info and sign-out go over https:// and the name of the identity (AUTH_IDENTITY_URL). It is the process of the interface that does this, not the browser. It is the only public address the interface calls itself; its connections to the Service Center, PKI and Messaging run internally over http (see "Network and encryption"). Two things have to hold:
- The name of the identity resolves and is reachable from the interface. The server of the interface must reach the public address of its own reverse proxy (hairpin).
- The interface trusts the certificate of the proxy. If it comes from a private or company CA, Node does not know that CA and refuses the call.
When nothing needs to be done: the certificate comes from a publicly trusted CA (such as Let's Encrypt; Node ships their roots) and the name resolves. Then this section does not apply.
How to recognise it: sign-in fails, and the log of the interface says [auth/callback] sign-in failed. The cause shows in a call from the environment of the interface (command below): with a CA Node does not trust it reports UNABLE_TO_VERIFY_LEAF_SIGNATURE; if the name does not resolve, ENOTFOUND or EAI_AGAIN; if it is not reachable, ECONNREFUSED or ETIMEDOUT. 200 means all is well.
Steps:
- Put the certificate of the CA (PEM, the CA's certificate only, never a key) at
deploy/compose/ca/ca.pem(mkdir ca). - Copy
compose.ca.example.yamltocompose.ca.yaml. It mounts the directory./cainto the interface and setsNODE_EXTRA_CA_CERTS=/etc/noritec/ca/ca.pem;compose.yamlstays unchanged. - If the name of the identity does not resolve in the container (a name only known internally, an address the server cannot reach), enable the
extra_hostslines in the file and enter the address of the proxy. This is the exception; if the name is in DNS and the server reaches its own public address, it is not needed. - Start with both files (if the files for the license or the listening ports come too, give those with
-fas well):
docker compose -f compose.yaml -f compose.ca.yaml up -d
docker compose -f compose.yaml -f compose.ca.yaml logs ui # on an error
Afterwards run the same call; it must answer 200:
docker compose -f compose.yaml -f compose.ca.yaml exec ui node -e "fetch('https://<MSC_IDENTITY_HOST>/.well-known/openid-configuration').then(r => console.log(r.status), e => console.log(e.cause?.code ?? e.message))"
The service does not start
A service that cannot start because of its configuration ends with exit code 78 and writes as the last line of its log what to do: a code, the setting and what is wrong with it. A password or key is never in it. The log shows it as crit: Noritec.ServiceDefaults.Startup[0] with the message below; any other failure at the start ends with exit code 1, and its stack trace stands before it.
docker compose ps: A service that showsRestarting (78)is configured wrongly (78 is the usual code for it,EX_CONFIGofsysexits.h). The services that wait for it showCreated.docker compose logs --tail 5 <service>: the message is the last line.- Correct the setting it names (in
.env, undersecrets/or incompose.yaml) and start again withdocker compose up -d.
Docker has no exception by exit code: it keeps restarting the service until the setting is right. That does no harm; the message stays the same.
Checking
docker compose ps
Every service has a health check on /ready. docker compose ps shows healthy as soon as its dependencies are
reachable. A service starts only once the services it waits for are healthy. On the first start the services migrate
their databases, which can take a few minutes. The page System → Overview of the interface shows every
service with its version and state.
Listen address of the gateway
BSSCI (8883), SCACI (8884) and enrollment (8885) of the gateway listen on all interfaces by default, as do dispatch and scheduling between the services. Each interface has a setting ListenAddress for this: an IP address of this machine, 0.0.0.0 (all IPv4 interfaces) or * (all interfaces, IPv4 and IPv6). An address that is not a network connection of this machine stops the interface from starting, with a message naming the setting and the value.
Inside the container the default stays, because there is only the address of the container. Where the machine publishes the ports is set in the .env file, for example for a field network with MSC_BSSCI_PORT=192.168.10.5:8883; Compose turns that into 192.168.10.5:8883:8883. Without an address Docker publishes on all interfaces of the machine.
Network and encryption
The services of MSC speak plain http to each other, without TLS: the interface to the services, the services to the identity and the PKI, the gateway to the Service Center. This is intended: the protection of these connections lies in the operating mode, not in each service. The identity therefore accepts the direct http calls of the services at their endpoints (InternalHttp__Enabled, set in the settings), at the endpoints the services need (discovery document, key set, token); every other endpoint and the pages still ask for https.
Encrypted are the connections that leave the network: the browser to the reverse proxy or ingress (TLS ends there), base stations and devices at the gateway (BSSCI and enrolment, TLS with a client certificate) and an Application Center of another installation at the gateway (SCACI and its enrolment). Which connection is TLS is in the code of the services and in the settings of this operating mode; whatever is not named here is http.
Requirement on the reverse proxy or ingress: it offers only https to the outside (redirect http to https or close the port). The identity accepts http at the endpoints named, wherever it comes from; the entry of the installation is what keeps it from the outside.
Prerequisite: all services of a product run on one host. Then the traffic between them does not leave the host (with Compose the network of the containers on this host). Do not spread the services of a product over several hosts; such an installation is not supported. PostgreSQL and Redis belong to the installation and, going by the settings, also speak without TLS; if they run on another machine, secure these connections in the syntax of the driver (Npgsql: SSL Mode, StackExchange.Redis: ssl=true).
Upgrading
Set MSC_VERSION in .env to the new version, then:
docker compose pull && docker compose up -d
Backing up
- The volumes
postgres-data(all databases) andredis-data. - The directory
secrets.