Nomad Pack
Nomatron is in early access. Some advanced workflows may not be covered in the public docs.
The Nomatron Nomad Pack renders and runs a Nomad job for Nomatron server, so you do not have to copy a large job specification by hand. The pack is published at github.com/nomatronio/nomatron-nomad-pack
. This page uses pack release v0.2.11 with Nomatron v0.1.7.
This page covers the production profile: one Nomatron server, your own PostgreSQL database, and secrets read at runtime from a Nomad Variable. For the full job layout and the reasoning behind it, see Running Nomatron Server as a Nomad Job
.
Before You Start
You need:
- a Nomad cluster with the Docker driver, plus an ACL token that can submit jobs and write Nomad Variables;
- a PostgreSQL database reachable from the Nomad clients (see Database Initialization );
- your Nomatron licence key;
- the
nomadCLI and thenomad-packCLI (from HashiCorp releases orbrew tap hashicorp/tap && brew install hashicorp/tap/nomad-pack).
Point both CLIs at your cluster. Read the token from your secret store rather than typing it:
export NOMAD_ADDR="https://nomad.example.com:4646"
export NOMAD_TOKEN="$(cat /run/secrets/nomad_token)"1. Add The Pack Registry
nomad-pack registry add nomatronio github.com/nomatronio/nomatron-nomad-pack --ref=v0.2.11
nomad-pack registry listPin --ref to a pack release tag so later pack changes do not alter your deployment unexpectedly.
2. Store Secrets In A Nomad Variable
The pack reads secrets from a Nomad Variable at runtime, so they never appear in the job specification. The job reads the job-scoped path nomad/jobs/nomatron/nomatron-server/nomatron, which Nomad workload identity lets the task read without an extra ACL policy.
Prepare these values:
| Key | Value |
|---|---|
license_key | Your Nomatron licence key. |
cluster_key | A key you generate yourself, for example with openssl rand -base64 32. Nomatron does not store or issue cluster keys, so back it up; every server in the installation must use the same value for the life of the database. |
encryption_key | 32 random bytes, base64-encoded: openssl rand -base64 32. Back it up; stored secrets cannot be decrypted without it. |
serf_encrypt_key | A Serf gossip key from nomatron keygen. The rendered job always passes --serf-encrypt-key-file, and the server refuses an empty key file, so set this even for a single server. |
db_url | Your PostgreSQL connection string, for example postgres://nomatron:<DB_PASSWORD>@db-writer.example.com:5432/nomatron?sslmode=require. |
root_password | The password for the built-in root user. If you leave it empty, the root user gets the default password; see Database Initialization
. |
Write them to a Nomad Variable spec file that only you can read, load it, then delete it. Fill the file from your secret store; the values below are placeholders:
umask 077
cat > nomatron-secrets.nv.hcl <<'HCL'
path = "nomad/jobs/nomatron/nomatron-server/nomatron"
items {
license_key = "<LICENSE_KEY>"
cluster_key = "<CLUSTER_KEY>"
encryption_key = "<ENCRYPTION_KEY>"
serf_encrypt_key = "<SERF_ENCRYPT_KEY>"
db_url = "<DB_URL>"
root_password = "<ROOT_PASSWORD>"
}
HCL
nomad var put @nomatron-secrets.nv.hcl
rm -f nomatron-secrets.nv.hcl3. Write A Variables File
Create production.vars.hcl. It holds no secrets, so you can keep it in version control:
deployment_profile = "production"
database_mode = "byodb"
runtime = "docker"
network_mode = "bridge"
count = 1
nomatron_version = "v0.1.7"
secrets_backend = "nomad_var"
secrets_nomad_var = {
path = "nomad/jobs/nomatron/nomatron-server/nomatron"
}
load_balancer_mode = "none"
register_service = false
http_port_static = 4649
public_hostname = "nomatron.example.com"
public_scheme = "https"
# The connection string comes from db_url in the Nomad Variable.
database = {
host = "db-writer.example.com"
port = 5432
name = "nomatron"
username = "nomatron"
sslmode = "require"
connection_string = ""
password = ""
max_open_conns = 25
max_idle_conns = 10
conn_max_lifetime_seconds = 300
conn_max_idle_time_seconds = 60
}
server = {
port = 4649
api_addr = "https://nomatron.example.com"
trusted_origins = ["https://nomatron.example.com"]
log_level = "info"
log_format = "json"
read_header_timeout_seconds = 10
read_timeout_seconds = 30
write_timeout_seconds = 60
idle_timeout_seconds = 120
tls_enabled = false
tls_cert_file = ""
tls_key_file = ""
tls_ca_file = ""
}
# Telemetry is off by default in Nomatron. Set it explicitly here,
# because the pack's own default for this variable is enabled.
telemetry = {
enabled = false
http_proxy = ""
https_proxy = ""
}Always set nomatron_version. The pack’s default is an older release candidate. The pack builds the image reference from it, so this file runs ghcr.io/nomatronio/nomatron-releases/nomatron:v0.1.7.
4. Initialise The Database
Run nomatron database init once against the database before the first deployment, with the same licence key, cluster key, encryption key and root password you stored in the Nomad Variable. See Database Initialization
. Leave the pack’s bootstrap.auto_init_database at its default of false.
5. Render, Plan, And Run
Render the job first and review it. The output should contain nomadVar lookups, not secret values:
nomad-pack render nomatron --registry=nomatronio --ref=v0.2.11 \
--var-file=production.vars.hclThen plan and run:
nomad-pack plan nomatron --registry=nomatronio --ref=v0.2.11 \
--var-file=production.vars.hcl
nomad-pack run nomatron --registry=nomatronio --ref=v0.2.11 \
--var-file=production.vars.hclCheck the deployment:
nomad job status nomatronWhen the allocation is healthy, open https://nomatron.example.com (or port 4649 on the client running the allocation) and sign in as root.
Upgrading
To move to a new Nomatron release, change nomatron_version to the new pinned tag, then render, plan and run again. To move to a new pack release, change --ref in each command (and re-run nomad-pack registry add with the new ref). Read the pack’s CHANGELOG.md first.
High Availability
The pack also has an ha profile for several Nomatron servers on a shared database. It needs Serf settings and placement rules that depend on your network. Read the pack README, and Server HA Cloud Auto-Join
, before you use it.