Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ Set every `CHANGE_*` value. The ones you cannot skip:
Everything else in the file is optional and explained in
[Configuration](docs/configuration.md): the admin API key, log settings, Redis, and the
web app's map view, tabs, themes, name and banner. The features added in 2.3.0 each take a
secret here when you turn them on: `BEACON_SMTP_PASSWORD` (account mail), `BEACON_PORTAL_SECRET`
(portal sign-in), `BEACON_SECRET_KEY` (telemetry requests) and `BEACON_PUSH_SECRET` (push alerts).
secret here when you turn them on: `BEACON_SMTP_PASSWORD` (account mail), `BEACON_SECRET_KEY`
(telemetry requests) and `BEACON_PUSH_SECRET` (push alerts).

If you enable MeshMapper imports, also set `MESHMAPPER_API_KEY`. Your local MeshMapper
regional or grouped-region admin can generate a regional key or a key covering multiple
Expand Down Expand Up @@ -148,7 +148,6 @@ gone private; see [Troubleshooting](docs/troubleshooting.md#docker-compose-up-fa
- [Getting packets in](docs/getting-packets-in.md): brokers, the account Beacon needs, topics.
- [Repeater polling](docs/repeater-polling.md): observers asking repeaters for telemetry, and how Beacon coordinates them.
- [User accounts](docs/accounts.md): optional sign-in, SMTP, CORS for a split deployment, limits and the operator user routes.
- [Sign-in through the MeshMapper portal](docs/portal-sign-in.md): accounts through the portal instead of email and password.
- [Requested telemetry](docs/telemetry-requests.md): users asking for a repeater to be polled, approving observers, guest passwords.
- [Alerts](docs/alerts.md): rules on Atlas radios, email and push delivery.
- [Configuration](docs/configuration.md): every environment variable and a map of `config.yaml`.
Expand Down
4 changes: 0 additions & 4 deletions app_config/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ LISTEN_ADDR=:8080
# Needed for accounts in local mode when the SMTP server wants a login.
# BEACON_SMTP_PASSWORD=

# Client secret for sign-in through the MeshMapper portal. Needed when accounts.mode is portal;
# the portal gives it to you with your client id (accounts.portal.client_id).
# BEACON_PORTAL_SECRET=

# Push secret for alerts.push. Register this server at https://push.meshcorebeacon.ca/register to
# get a Push ID (config.yaml alerts.push.id) and this secret. Never put it in the YAML.
# BEACON_PUSH_SECRET=
Expand Down
79 changes: 43 additions & 36 deletions app_config/config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ scopes:
- name: "#west"
region: western-canada

# Units clients show. Default: c and metric. Any other value stops startup.
# Units the web app, the mobile app and alert messages show, the same for every user.
# Default: c and metric. Any other value stops startup.
display:
temperature_unit: c # c or f
distance_unit: metric # metric or imperial
Expand All @@ -276,7 +277,13 @@ atlas:

telemetry:
retention: 744h # 31 days
resolution: 1h # store one snapshot per observer per hour
# How often an observer's status is stored as a snapshot (default 15m). Observers report
# every 5 minutes by default; reports inside one window are dropped, except the first after
# a reboot (one per window). Observer alerts and charts read these snapshots:
# - battery and noise alerts need two snapshots in a row, so they react after about two windows
# - a shorter window stores more rows (5m is about 3x the rows of 15m, 1h about a quarter)
# - below the observers' report interval nothing more is stored
resolution: 15m

# Optional authenticated database/config downloads. Disabled unless explicitly enabled.
# Requires auth.api_key, a supported PostgreSQL URL and a compatible pg_dump client.
Expand Down Expand Up @@ -431,53 +438,53 @@ cache:
# reconfirm: 1h # default: 1h
# cleanup: 1h # default: 1h

# Repeater polling: Beacon coordinates which observer asks each repeater for
# telemetry, and stores the readings. Disabled by default. Bounds follow the
# observer firmware. Zero or omitted values use the defaults.
# Repeater polling: observers ask nearby repeaters for battery, temperature and counters, and
# Beacon picks which observer polls which repeater and stores the readings. Off by default.
# Zero or omitted values use the defaults. Ranges match what the observer firmware accepts.
#polling:
# enabled: false
# mqtt_hosts: [] # up to 4 plain hostnames, no port; required when enabled
# direct_window: 1h # 30m to 24h; default: 1h
# grace: 30m # 10m to 2h; default: 30m
# max_requests: 2 # 1 to 3; default: 2
# reading_retention: 744h # at least 1h; default: 744h (31 days)
# min_client_version: "" # X.Y.Z or empty; older observer firmware gets version_ok false
# excluded_nodes: [] # up to 16 public keys, 64 hex characters each
# paused: false
# authority: evidence # evidence or approved; approved elects only observers you approve
# # Telemetry requests also need accounts on and BEACON_SECRET_KEY (32 random bytes in base64,
# # from: openssl rand -base64 32). Losing or changing the key makes stored guest passwords unreadable.
# requests_per_user: 6 # 0 to 20; 0 turns requests off; default: 6
# offline_disable_days: 7 # 1 to 365; days unheard before a repeater's requests are turned off; default: 7
# request_observers: all # all (default) or approved. all: any observer with advert evidence for a requested
# # repeater can be handed it and its guest password. approved: only observers you
# # approve under /api/v1/admin/polling; advert evidence is required in both modes.
# enabled: false # turn repeater polling on; needs mqtt_hosts
# mqtt_hosts: [] # brokers your observers publish to: plain hostnames, no port, up to 4
# direct_window: 1h # poll a repeater again once its newest reading is this old; 30m to 24h
# grace: 30m # extra wait for each standby before it steps in for the poller; 10m to 2h
# max_requests: 2 # poll attempts per repeater in each window; 1 to 3
# reading_retention: 744h # how long readings are kept; at least 1h (default 31 days)
# min_client_version: "" # oldest observer firmware allowed to poll, as X.Y.Z; empty allows all
# excluded_nodes: [] # repeaters that are never polled; up to 16 public keys, 64 hex characters each
# paused: false # true tells every observer to stop polling, without turning the feature off
# authority: evidence # who can be chosen to poll. evidence: any observer, ranked by how well Beacon
# # has heard the repeater through it. approved: only observers you approve
# evidence_window: 168h # how far back a repeater's zero-hop adverts count as evidence that an observer hears
# # it; 24h to 720h. Adverts older than packets.retention are gone either way
#
# # Telemetry requests: signed-in users ask for a repeater to be polled. They also need accounts on
# # and BEACON_SECRET_KEY in .env (32 random bytes in base64, from: openssl rand -base64 32).
# # Losing or changing the key makes the stored guest passwords unreadable.
# requests_per_user: 6 # repeaters one user may ask to have polled; 0 to 20, 0 turns requests off
# offline_disable_days: 7 # days no observer hears a repeater before its requests are switched off; 1 to 365
# request_observers: all # which observers may be handed a requested repeater and its guest password.
# # all: any observer Beacon has heard the repeater through.
# # approved: only observers you approve under /api/v1/admin/polling.
# # Set approved if you want to vet observers before they receive guest passwords.

# Outgoing mail: the SMTP server Beacon sends account mail (sign-up, password reset) and email alerts
# through. Required when accounts.mode is local. The password comes from BEACON_SMTP_PASSWORD, never from here.
#mail:
# host: "" # e.g. smtp.example.org
# port: 587 # default: 587
# username: "" # empty means no auth
# from: "" # e.g. "Beacon <no-reply@example.org>"
# starttls: true # default: true; the send fails if the server lacks STARTTLS
# host: "" # your SMTP server, e.g. smtp.example.org
# port: 587 # SMTP port; default: 587
# username: "" # SMTP login; empty sends without signing in
# from: "" # the sender people see, e.g. "Beacon <no-reply@example.org>"
# starttls: true # require an encrypted connection; the send fails if the server lacks STARTTLS

# User accounts: sign-in for the web app and the mobile app. Off by default; with it off
# no account route is served. Mode local sends mail through the mail block above.
# A web app on another origin than the API also needs cors.allowed_methods, cors.allowed_headers
# (with X-Beacon-CSRF) and cors.allow_credentials; same origin needs nothing.
#accounts:
# mode: off # off, local or portal
# mode: off # off, or local for sign-up with username, email and password
# public_url: "" # https URL of the web app, no path; used in mailed links
# registration: open # open or closed
# # mode: portal signs people in through the MeshMapper portal: no mail, no registration.
# # The client secret comes from BEACON_PORTAL_SECRET, never from here.
# portal:
# url: "" # https base address of the portal; required when mode is portal
# client_id: "" # required when mode is portal

# Alerts: tell users when a radio on their Atlas needs attention. Needs accounts (local or portal). Off by default.
# registration: open # open: anyone can sign up. closed: no new sign-ups, existing users still sign in

# Alerts: tell users when a radio on their Atlas needs attention. Needs accounts. Off by default.
# Each user picks which of the channels below reach them.
#alerts:
# email:
Expand Down
8 changes: 7 additions & 1 deletion docker-deployment-type1/data/app/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ scopes:

telemetry:
retention: 744h # 31 days
resolution: 1h # store one snapshot per observer per hour
# How often an observer's status is stored as a snapshot (default 15m). Observers report
# every 5 minutes by default; reports inside one window are dropped, except the first after
# a reboot (one per window). Observer alerts and charts read these snapshots:
# - battery and noise alerts need two snapshots in a row, so they react after about two windows
# - a shorter window stores more rows (5m is about 3x the rows of 15m, 1h about a quarter)
# - below the observers' report interval nothing more is stored
resolution: 15m

# Optional authenticated database/config downloads. Disabled unless explicitly enabled.
# Requires auth.api_key, a supported PostgreSQL URL and a compatible pg_dump client.
Expand Down
8 changes: 7 additions & 1 deletion docker-deployment-type2/server/data/app/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ scopes:

telemetry:
retention: 744h # 31 days
resolution: 1h # store one snapshot per observer per hour
# How often an observer's status is stored as a snapshot (default 15m). Observers report
# every 5 minutes by default; reports inside one window are dropped, except the first after
# a reboot (one per window). Observer alerts and charts read these snapshots:
# - battery and noise alerts need two snapshots in a row, so they react after about two windows
# - a shorter window stores more rows (5m is about 3x the rows of 15m, 1h about a quarter)
# - below the observers' report interval nothing more is stored
resolution: 15m

# Optional authenticated database/config downloads. Disabled unless explicitly enabled.
# Requires auth.api_key, a supported PostgreSQL URL and a compatible pg_dump client.
Expand Down
12 changes: 4 additions & 8 deletions docs/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ with code `accounts_disabled`, no cookie is ever set, `features.accounts` in
[`/api/v1/info`](api-contract.md#server-info) is `"off"`, and both clients show no sign-in entry.
Nothing that works signed out changes either way. Everything public stays public.

There are two ways to turn them on. `local` is this page: username, email and password, with mail.
`portal` lets people sign in with their MeshMapper portal account instead, see
[Sign-in through the MeshMapper portal](portal-sign-in.md). Signed-in users also get the synced
Accounts are username, email and password, with mail. Signed-in users also get the synced
[Atlas](atlas.md), and, when the operator turns them on, [requested telemetry](telemetry-requests.md)
and [alerts](alerts.md).

Expand Down Expand Up @@ -45,16 +43,16 @@ In the Docker stacks that is the `.env` of the host that runs the server. Then r

| Key | Default | What it does |
|---|---|---|
| `mode` | `off` | `off`, `local` or `portal`. Anything else stops startup. The rest of the block is not checked while this is `off`. The rest of this page is about `local`; see [portal sign-in](portal-sign-in.md) for `portal`. |
| `public_url` | none | Required when `mode` is `local` or `portal`. The address people use for the web app: `http` or `https`, no path, query, fragment or credentials. Plain `http` is allowed only for `localhost` and `127.0.0.1`. Every link in a mail is built from it, never from a request header. |
| `mode` | `off` | `off` or `local` (`portal` is for the project's own instance, see [Configuration](configuration.md#user-accounts)). Anything else stops startup. The rest of the block is not checked while this is `off`. |
| `public_url` | none | Required when `mode` is `local`. The address people use for the web app: `http` or `https`, no path, query, fragment or credentials. Plain `http` is allowed only for `localhost` and `127.0.0.1`. Every link in a mail is built from it, never from a request header. |
| `registration` | `open` | `open` or `closed`. When closed, `POST /auth/register` answers `403 registration_closed` and `features.registration` is `false`. People who already have an account keep signing in. |
| `mail.host` | none | Required. |
| `mail.port` | `587` | 1 to 65535. |
| `mail.username` | empty | Empty means no authentication. When set, Beacon uses AUTH PLAIN, and the server must offer AUTH. |
| `mail.from` | none | Required, one address, for example `"Beacon <no-reply@example.org>"`. |
| `mail.starttls` | `true` | When true the send fails if the server does not offer STARTTLS; Beacon never falls back to plain text. Set `false` only for a trusted local relay. |

In `local` mode `BEACON_SMTP_PASSWORD` is the only account secret that comes from the environment; `portal` mode reads `BEACON_PORTAL_SECRET` instead. A mistake in the
`BEACON_SMTP_PASSWORD` is the only account secret that comes from the environment. A mistake in the
block stops startup with an error naming the key. An `smtp` block left under `accounts` stops startup
too, with a message saying it moved to `mail`. Port 465 (implicit TLS) is not supported; use a
submission port that offers STARTTLS.
Expand Down Expand Up @@ -267,8 +265,6 @@ An hourly task (`users_cleanup`) deletes, once they are more than a week past th
- sign-ups nobody confirmed: local users never verified, created more than a week ago, with no live
verify link left. This frees the username and address.

In portal mode it also deletes portal sign-in states as soon as they expire, with no week's wait.

A live session or token is never touched by it.

## Disabling accounts again
Expand Down
4 changes: 2 additions & 2 deletions docs/alerts.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ alerts:

| Channel | What it needs |
|---|---|
| `email.enabled` | `accounts.mode: local` with the [`mail` block](configuration.md#user-accounts) set. Any other mode stops startup; portal users have no address. |
| `email.enabled` | `accounts.mode: local` with the [`mail` block](configuration.md#user-accounts) set. Any other mode stops startup. |
| `push.enabled` | A Push ID in `push.id` and the Push secret in `BEACON_PUSH_SECRET`, from registering the server with the push server. See [Push](#push). Without them Beacon does not start. |

With both off (the default) every alert route answers `404 alerts_disabled`. With accounts off,
Expand Down Expand Up @@ -52,7 +52,7 @@ assignment right now; the user is told to request telemetry for it first (see
| `clock` | repeaters, room servers | Seconds of drift: 300, 3600 or 86400. Fires after two adverts in a row beyond it. Beacon keeps the drift of each repeater's last 16 adverts, so a breach that came and went between two passes still fires once. |
| `battery_low` | with a battery reading | Millivolts, 2500 to 5000. |
| `battery_falling` | with a battery reading | Millivolts per day: 100, 200 or 300. |
| `rebooted` | with an uptime reading | None. Notifies on each new reboot seen. Every reading since the rule's last pass is examined, not only the newest few. |
| `rebooted` | with an uptime reading | None. Notifies on each new reboot seen. Every reading since the rule's last pass is examined, not only the newest few. An observer's reboot is stored as soon as it reports, at most once per `telemetry.resolution` window, so a radio in a boot loop notifies about once per window, not once per boot. |
| `temperature` | with a temperature reading | Tenths of a degree C, -500 to 1500. A low limit (`threshold`), a high limit (`thresholdHigh`) or both; low must be below high. With both set on a rule that is on, the high limit must be at least 20 tenths (2.0 degrees C) above the low one, or the change is refused with `422 invalid_threshold`; a rule being turned off is not held to it. |
| `noise_high` | with a noise floor reading | dBm, -130 to -50. |
| `observer_offline` | observers | Minutes without a status report: 30, 60, 180 or 360. |
Expand Down
Loading