0.60

ReferenceEnterpriseRun as a serviceEnterprise

Run the Core as a service

Start a Synnax Core when the computer boots, and restart it after a failure.

A Synnax Core started from a terminal stops when the terminal closes. As a service, the Core starts when the computer boots and starts again after a crash.

Run the Core as a service

  1. Install the Core at /usr/local/bin/synnax. See Set up Synnax Enterprise.

  2. Create a system user for the Core. The Core needs a home folder that exists:

    sudo useradd --system --home-dir /var/lib/synnax --shell /usr/sbin/nologin synnax
  3. Get the license key for the computer from the portal. Put the .lic file at /etc/synnax/license.lic, readable by the synnax user:

    sudo mkdir -p /etc/synnax
    sudo cp synnax.lic /etc/synnax/license.lic
    sudo chown root:synnax /etc/synnax/license.lic
    sudo chmod 640 /etc/synnax/license.lic
  4. Create /etc/systemd/system/synnax.service:

    [Unit]
    Description=Synnax Core
    Wants=network-online.target
    After=network-online.target
    
    [Service]
    Type=simple
    User=synnax
    Group=synnax
    StateDirectory=synnax synnax-driver
    WorkingDirectory=/var/lib/synnax
    ExecStart=/usr/local/bin/synnax start \
      --listen=synnax.example.com:9090 \
      --data=/var/lib/synnax/data \
      --certs-dir=/var/lib/synnax/certs \
      --log-file-path=/var/lib/synnax/logs/synnax.log \
      --license-file=/etc/synnax/license.lic \
      --auto-cert
    KillSignal=SIGINT
    Restart=always
    RestartSec=5s
    LimitNOFILE=65536
    LimitRTPRIO=99
    
    [Install]
    WantedBy=multi-user.target

    Change --listen to the name that clients use to reach the Core. For a different certificate, see Set up TLS.

  5. Start the service and turn it on at boot:

    sudo systemctl daemon-reload
    sudo systemctl enable --now synnax
  6. Check that the Core started:

    journalctl -u synnax -f -a

    Wait for Synnax is running and available at.

The unit sets KillSignal=SIGINT because Core 0.58 and earlier shut down cleanly only on SIGINT. StateDirectory creates /var/lib/synnax and /var/lib/synnax-driver for the synnax user. Core 0.58 and earlier keep the state of the embedded Driver in /var/lib/synnax-driver, and do not start without it. LimitNOFILE allows the Core to keep many channel files open. LimitRTPRIO lets Arc automations on the embedded Driver run on a real-time thread. To change a flag, edit the unit, then run sudo systemctl daemon-reload and sudo systemctl restart synnax.

For EtherCAT devices, also add AmbientCapabilities=CAP_NET_RAW to the [Service] section.

On macOS, use Synnax Desktop, which starts the Core with the app.

Monitor the Core

  • Health check -> send POST /api/v1/connectivity/check with an empty JSON body. It needs no login or license, and returns 200 while the Core runs:

    curl -s -X POST https://synnax.example.com:9090/api/v1/connectivity/check \
      -H "Content-Type: application/json" -d '{}'

    The response has the Core version, its clock time, and its license state. It does not check storage.

  • Disk space -> the Core does not check free space. When the data disk is full, the Core can stop, and the service restarts it again and again. Alert well before the disk fills.

  • Logs -> the Core writes logs to its output and to the file set by --log-file-path. The file rotates at 50 MB and keeps 5 old files for 30 days. To change these values, see the CLI reference.

Do not start a Core in production with --debug. It serves profiling routes to every network with no login.