Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Services

The Publisher runs as systemd services, grouped under relaysms-publisher.target:

ServiceRuns
relaysms-publisher-restREST API
relaysms-publisher-grpcgRPC API
relaysms-publisher-workerCelery worker: publishes queued payloads
relaysms-publisher-beatCelery Beat: schedules cleanups, and the worker heartbeat with Uptime Kuma
relaysms-publisher-smtpEmail listener; exits at once while SMTP_TRANSPORT_ENABLED is off

The REST API listens on HOST:PORT (127.0.0.1:16000) and gRPC on GRPC_HOST:GRPC_PORT (127.0.0.1:6000).

Is it working?

sudo ./manage.sh status
curl http://127.0.0.1:16000/health

You should see every service active, and {"status":"ok"}. To follow publications as they happen:

sudo ./manage.sh logs --unit worker

Each published payload logs Published via '<PLATFORM>'., and each failure a line starting Failed to (what each means). Credentials with stats:publications:read can also query the counts at GET /v1/stats/publications.

manage.sh

Run it from the install directory with sudo:

CommandDoes
statusShows each service’s state
logsFollows the service logs
start, stop, restartControls every service together
enable, disableStarts the services on boot, or stops doing so
update [--migrate]Pulls the latest code, rebuilds and restarts the services (details)
migrateApplies database migrations
checkReports every missing or invalid setting
nginx [<DOMAIN>]Renders the nginx site again and reattaches or obtains its certificate (details)
docs [<DOMAIN>]Builds this manual and serves it on its own domain (details)
uninstallRemoves the services and the install directory, with .env and data/

uninstall keeps the database and broker servers and the service user.

logs takes:

  • -u, --unit: rest, grpc, worker, beat or smtp; repeatable
  • -n, --lines: how many lines to show
  • -s, --since: a time, such as "1 hour ago"
  • --no-follow: print and exit

For example:

sudo ./manage.sh logs --unit rest --unit grpc --since "1 hour ago" --lines 200

publisher.sh

./publisher.sh runs the admin CLI as the service user, with the virtualenv and .env:

sudo ./publisher.sh --help   # every command
sudo ./publisher.sh env      # install directory, service user and the .env values the CLI uses
sudo ./publisher.sh shell    # a shell as the service user, with .env loaded

Use it instead of python3 -m publisher: run as another user, the CLI can leave adapter files the services can’t read.

Files

PathHolds
/opt/relaysms/relaysms-publisher/The install
.envSettings (root:<SERVICE_USER>, mode 640)
data/SQLite database, Celery files and adapters (owned by the service user, mode 750)
/etc/systemd/system/relaysms-publisher*Service units
/etc/nginx/sites-available/<DOMAIN>.confnginx sites