Skip to content

Installation

This is the single, authoritative installation guide for the µBSS platform. It covers a complete greenfield deployment end to end and leans on the bundled scripts in sbin/ to keep the flow short.

There are two supported paths:

  • Path A — Build & run from source (single host: development, evaluation, or an all-in-one node). Build in place under $BSS_HOME and run the roles directly.
  • Path B — Package & deploy (separate build host → one or more target prefixes/pods). Build once, produce versioned archives with pack.sh, and install them with unpack.sh.

Everything resolves through the BSS_HOME environment variable (the FHS root). In development it is the repository root; in production each component resolves from BACKEND_PREFIX / FRONTEND_PREFIX (and DOCS_PREFIX for the docs), falling back to BSS_HOME.

Scripts, not steps

Prefer the scripts over manual commands — install.sh, build.sh, dev_env.sh, run.sh, pack.sh, unpack.sh, set_env.sh. They are the same code paths the project tests and ships with, so the documented flow stays in sync with reality.

Prerequisites

Component Used by Notes
C++20 toolchain + CMake ≥ 3.10 engine build clang or gcc
ACE, Protobuf, gRPC, OpenSSL engine build_ace.sh can bootstrap ACE if absent
MySQL Connector/C++ (X DevAPI), Plutobook, Inja, nlohmann/json, tomlplusplus engine native libs
protoc + grpc_php_plugin PHP stub generation invoked by build.sh / generate-proto.sh
PHP 8.1+ (ext-grpc, ext-pdo, ext-intl, ext-mbstring) + Composer CRM frontend ext-grpc is built from PECL on Ubuntu/Debian (not in APT)
MySQL 8 data billing + crm_auth schemas
Python 3.11+ test suite (optional) tested up to 3.15
MkDocs + Material docs site (optional) auto-installed by unpack.sh when rendering docs

On macOS most native dependencies are available via Homebrew; on Ubuntu/Debian via APT. install.sh provisions them all for you (see step 2) — the table is the manual reference.


Path A — Build & run from source

1. Set BSS_HOME

cd micro.bss
export BSS_HOME="$(pwd)"

2. Provision dependencies, build & install

On a fresh host, provision the build/runtime dependencies first. install.sh installs them (Homebrew on macOS, APT on Ubuntu/Debian, bootstrapping ACE from source if absent) and then bundles the third-party shared libraries into the root lib. On Linux it bundles the full ldd dependency closure (minus the core glibc/loader libs), so the packaged platform runs on a target host with no engine dependencies installed at all — see Scripts → install.sh. On Ubuntu/Debian it also builds the PHP grpc extension from PECL (it is not packaged in APT) and enables it for the CRM:

bash sbin/install.sh      # deps + bundle third-party libs
bash sbin/build.sh        # compile the engine + CRM stubs

build.sh configures CMake with -DBSS_HOME_DEFAULT=$BSS_HOME, compiles the engine into bin and usr/lib, regenerates the PHP gRPC stubs, and runs composer install for the CRM. After upgrading a system library, re-bundle with install.sh --bundle-libs. The bundled libraries are host-specific and git-ignored. See Scripts → install.sh for details and flags.

3. Database schema

# billing schema + seed data — load in order:
mysql billing < usr/src/sql/billing_01_structure.sql        # tables, indexes (incl. roaming)
mysql billing < usr/src/sql/billing_02_reference_data.sql   # reference / catalogue data
mysql billing < usr/src/sql/billing_03_subscriber_data.sql  # sample subscriber data
mysql < usr/src/sql/crm/crm_auth.sql                        # CRM auth schema

Or use sbin/microbss_db_reset.sh, which loads the three billing files in order.

4. Environment & secrets

dev_env.sh is sourced (not executed) so its exports land in your shell — keep it sourced from your ~/.bashrc. It is the single source of truth for the platform's environment variables: it generates the PAN-token key once into var/lib/secrets/, reads the JWT secret from etc/.jwt_secret, and exports MICROBSS_DB_* (including MICROBSS_TEST_DB_PORT), the derived CRM_DB_* frontend variables, CERTS_PATH, MICROBSS_GRPC_* and the JWT/PAN variables. The other scripts (notably set_env.sh) consume these rather than defining their own defaults.

The JWT secret does not exist on a fresh tree — set_env.sh creates it — so the first source prints a note and returns non-zero after exporting the DB settings. Create the secret and the local override files, then re-source:

# Set real DB credentials first (defaults assume a local dev MySQL):
export MICROBSS_DB_USERNAME=<user> MICROBSS_DB_PASSWORD=<pass>
source sbin/dev_env.sh        # fresh tree: notes the missing etc/.jwt_secret
bash sbin/set_env.sh --all    # creates etc/.jwt_secret + db.local.env / config.local.php
source sbin/dev_env.sh        # now exports MICROBSS_JWT_SECRET too

In a source tree $CERTS_PATH defaults to etc/certs itself, so the certificate-copy part of set_env.sh --all is a no-op here; step 5 writes the certificates in place.

5. TLS certificates

The CRM gRPC endpoint requires TLS material. A self-signed dev CA + server certificate (CN=localhost):

C="$BSS_HOME/etc/certs"; install -d "$C"
openssl genrsa -out "$C/ca.key" 2048
openssl req -x509 -new -nodes -key "$C/ca.key" -sha256 -days 3650 \
  -subj "/O=microbss/CN=microbss-ca" \
    -addext "keyUsage=critical,keyCertSign,cRLSign" -out "$C/ca.crt"
openssl genrsa -out "$C/server.key" 2048
openssl req -new -key "$C/server.key" -subj "/O=microbss/CN=localhost" -out "$C/server.csr"
printf 'subjectAltName=DNS:localhost,IP:127.0.0.1\nauthorityKeyIdentifier=keyid,issuer\nbasicConstraints=CA:FALSE\nkeyUsage=critical,digitalSignature,keyEncipherment\nextendedKeyUsage=serverAuth\n' > "$C/san.cnf"
openssl x509 -req -in "$C/server.csr" -CA "$C/ca.crt" -CAkey "$C/ca.key" -CAcreateserial \
  -days 3650 -sha256 -extfile "$C/san.cnf" -out "$C/server.crt"
rm -f "$C/server.csr" "$C/san.cnf"; chmod 600 "$C/server.key" "$C/ca.key"

Alternatively, pack.sh --with-certs (see Scripts) regenerates this same CA/server pair interactively at pack time and ships it inside the backend archive, so unpack.sh installs it in one step instead of running these commands by hand on the target.

6. License

The platform is secure-by-default and will not start unlicensed. The one-time dev key setup mints a keypair, embeds the public key into the binary, and issues a hardware-bound license:

L="$BSS_HOME/var/lib/license"; install -d "$L"
licensing --keygen --out-priv "$L/license_private.pem" --out-pub "$L/license_public.pem"
#   → paste the printed EMBEDDED_PUB_KEY into
#     usr/src/security/license_validator.cpp AND
#     usr/src/licensing.cpp, then rebuild (step 2):
licensing --issue --customer dev --expires 2027-12-31 --features 0x7F --localhost \
          --privkey "$L/license_private.pem" --out "$L/platform.lic"

Alternatively, pack.sh --with-license (see Scripts) mints a production, YubiKey-signed license interactively at pack time and ships it inside the backend archive, so unpack.sh installs it in one step instead of issuing it by hand on the target.

See Licensing for the feature-mask bits and validation model.

7. Run

bash sbin/run.sh all      # start every role
bash sbin/status.sh       # list running roles
bash sbin/kill.sh  all    # stop everything

run.sh all starts the billing cycles, CDR loader, prepaid/DIAMETER acceptor, CRM gRPC service, bill formatter, and the mediation and roaming roles. The CRM gRPC service listens on :50051 and the prepaid/DIAMETER acceptor on :10100. See the role reference below.

8. CRM frontend

Point a PHP-capable web server (Apache/Nginx) at var/www.

Change the default login

The seeded administrator is admin / Admin@1234. Change it immediately after first login.

9. Verify (optional)

Run the regression suite against the live platform (one-time virtualenv setup is in Testing):

cd usr/share/tests/backend
./run_tests.sh

See Testing for the test-harness setup.

10. Documentation site (optional)

Render this documentation as a static site:

cd usr/share/doc
mkdocs build --site-dir /var/www/html/docs

(unpack.sh can do this for you on a target host — see Path B.)


Path B — Package & deploy

The engine, CRM and documentation deploy as independent units into separate prefixes (ideal for separate Kubernetes pods), or together into one FHS root (all, the canonical single-host layout). pack.sh manages four areas — backend, frontend, docs, tests (the standalone e2e acceptance pack) — or all.

1. Build, then package (build host)

export BSS_HOME="$(pwd)"
bash sbin/build.sh

# One archive per area, or 'all' for a combined bundle. Config files ship as
# *.template only (never live configs or secrets).
sbin/pack.sh --load backend  --version 1.0.0
sbin/pack.sh --load frontend --version 1.0.0
sbin/pack.sh --load docs     --version 1.0.0
sbin/pack.sh --load tests    --version 1.0.0
sbin/pack.sh --load all      --version 1.0.0

Archives are written to $BSS_HOME/dist/ as microbss-<area>-<version>-<arch>.tar.gz (frontend, docs and tests are noarch). Build Linux releases on a host matching the target's distro and PHP minor version: the backend archive carries the build host's PHP grpc extension for the CRM.

2. Install on the target (unpack.sh)

unpack.sh auto-detects the area from the archive name and installs self-contained into the chosen prefix. Each area writes only its own config subtree.

# Backend → /opt/microbss/backend
sbin/unpack.sh dist/microbss-backend-1.0.0-x86_64.tar.gz  --backend-prefix /opt/microbss/backend

# Frontend → /var/www
sbin/unpack.sh dist/microbss-frontend-1.0.0-noarch.tar.gz --frontend-prefix /var/www

# Docs: place sources under <docs-prefix>/usr/share/doc and render the HTML site
sbin/unpack.sh dist/microbss-docs-1.0.0-noarch.tar.gz \
    --docs-prefix /opt/microbss/backend --docs-site-dir /var/www/html/docs

Single-host (canonical) install of the combined archive, with the database credentials exported so the schemas are created in the same step:

export BACKEND_PREFIX=/opt/micro.bss FRONTEND_PREFIX=/opt/micro.bss DOCS_PREFIX=/opt/micro.bss
export MICROBSS_DB_USERNAME=<user> MICROBSS_DB_PASSWORD=<pass>
sbin/unpack.sh microbss-all-1.0.0-x86_64.tar.gz

unpack.sh runs composer install for the frontend (first enabling the bundled PHP grpc extension if the host's PHP lacks it), ldconfig for the backend, instantiates config files from the shipped *.templates, builds the test-suite virtualenvs, creates any missing billing / crm_auth database from the shipped SQL install set (existing databases are never touched), and (for docs) renders the MkDocs site — installing MkDocs + Material if needed. Useful flags: --force (overwrite existing configs), --no-composer, --no-db, --no-venv, --no-ldconfig, --no-docs-build, --dry-run.

The backend ldconfig step writes /etc/ld.so.conf.d/microbss.conf (registering only the platform's own usr/lib; the bundled third-party lib stays private to the platform so it cannot shadow the host's system libraries) and runs ldconfig, both of which need root. You do not need to run the whole script as root: when invoked as a normal user unpack.sh elevates just that step via sudo, and if sudo is unavailable it warns and skips it (the binaries' RPATH already resolves the bundled libs, so this step is an optimisation, not a hard dependency — --no-ldconfig silences the warning).

3. Configure secrets & endpoint (set_env.sh)

source sbin/dev_env.sh                                             # populate the environment first
sbin/set_env.sh --all                                              # JWT + DB settings + HTTPS certs
source sbin/dev_env.sh                                             # re-source: picks up the new JWT secret
sbin/set_env.sh --output-k8s-secret --k8s-namespace prod | kubectl apply -f -

On a fresh install the first source sbin/dev_env.sh prints a note and returns non-zero: etc/.jwt_secret does not exist yet. That is expected; it has still exported the DB settings set_env.sh needs. set_env.sh reads the database settings from the environment (MICROBSS_DB_*, CRM_DB_*) and writes them into the backend app.local.env + db.local.env and the frontend config.local.php, then copies the HTTPS certificates from $CERTS_PATH into the backend etc/certs. It defines no DB defaults of its own, so source dev_env.sh (or otherwise export those variables) first. From then on dev_env.sh reads the DB settings back from etc/db.local.env, so a fresh login shell needs no exports.

In production the engine reads paths from BACKEND_PREFIX and the CRM from FRONTEND_PREFIX. Secrets such as JWT_SECRET and BACKEND_GRPC_ENDPOINT are read environment-variable-first, so Kubernetes can inject them without writing files.

4. Finish on the target

The schemas were created by unpack.sh (or load them by hand, step A.3). Seed TLS material (A.5) and the license (A.6) on the target host, unless the archive was packed with --with-certs / --with-license, then start the roles with run.sh (A.7). A license copied from another installation must go in without its var/lib/license/.lkgt clock-state file: that file is keyed to the binary's embedded public key and is recreated on first start.

5. Verify (deployment acceptance)

cd $BSS_HOME/usr/share/tests/e2e
./run_e2e.sh --crm-url https://crm.example.com

Three tests — a prepaid DIAMETER session, a postpaid usage record through mediation and rating, and a CRM sign-in that loads the gRPC-backed dashboard. See Deployment acceptance.


Roles & configuration

The same server binary runs every role; the role is selected by the TOML passed with -i. run.sh all launches them all.

Role (etc/<role>.toml) Purpose
prepaid Online prepaid charging / DIAMETER acceptor (:10100)
billing1–billing4 Postpaid bill runs, one per bill-cycle
cdr_loader CDR spool ingestion & rating
bill_formatter HTML → PDF invoice rendering
crm CRM gRPC service (:50051, TLS + JWT)
mediation Roaming usage ingestion → canonical CDR (config-driven formats)
roaming Roaming Direction-1 charging + Direction-2 metering / TAP-out
prepaid_mass_rating Bulk re-rating (developer / load-test)

Full configuration reference: Configuration. Per-script details: Scripts. Log locations: Logging.