Backup Server Installation¶
This guide describes how to install the backupserver binary on Linux and run
it as the stbackup.service background service. Ubuntu 24.04 LTS is
recommended.
Warning
Use a separate machine or separate storage volume for production backups. Storing remote backups on the same host as the main trading server does not protect against host-level failure.
Hardware Requirements¶
| Resource | Minimal | Recommended | Notes |
|---|---|---|---|
| CPU | 2 cores, 2.0 GHz | 4 cores, 3.5 GHz | Depends on upload concurrency. |
| RAM | 4 GB | 16 GB | Larger values help with filesystem cache. |
| Disk | 80 GB SSD/HDD | 300 GB+ SSD | Size depends on retention and database volume. |
| Network | 100 Mbit/s | 1 Gbit/s or higher | Stable private connectivity is preferred. |
Ports And Network¶
The backup server listens on one TCP port. The default port is 5555.
Inbound:
| Port | Protocol | Purpose |
|---|---|---|
5555 |
TCP | Receives backup artifacts from ScaleTrade trading servers. |
Outbound access is not required for normal artifact receiving. Package updates, monitoring agents, and deployment automation may require their own outbound rules.
Tip
Restrict inbound access to trusted trading server IP addresses or place the service behind VPN/private networking.
Install Dependencies¶
sudo apt update
sudo apt install -y libstdc++6 ca-certificates
Installer¶
The production package is installed by install.sh. At startup the installer
asks which component to install:
| Option | Component |
|---|---|
server or 1 |
Main trading server only |
backupserver, backup, stbackup, or 2 |
Backup server only |
both, all, or 3 |
Main trading server and backup server |
Non-interactive installation can set INSTALL_TARGET:
INSTALL_TARGET=backupserver ./install.sh
The installer places the backup server binary in:
/etc/sttrader/backupserver
and stores remote artifacts under:
/etc/sttrader/backups-remote
Install Binary And Config¶
The backup server reads the [backupserver] section from:
/etc/sttrader/config.toml
Minimal configuration:
[backupserver]
enable = true
host = "0.0.0.0"
port = 5555
storage = "backups-remote"
token = "change-this-secret"
Configuration fields:
| Field | Default | Description |
|---|---|---|
enable |
true |
If false, the process exits without opening the listener. |
host |
"0.0.0.0" |
Bind address for the TCP listener. |
port |
5555 |
TCP listen port. |
storage |
"backups-remote" |
Directory where accepted artifacts are stored. Relative paths are resolved from /etc/sttrader when installed as a service. |
token |
"" |
Shared secret expected in upload headers. Use a non-empty value in production. |
The same values can be overridden by CLI arguments:
/etc/sttrader/backupserver \
--config /etc/sttrader/config.toml \
--port 5560 \
--storage /etc/sttrader/backups-remote
Configure systemd¶
The installer creates /etc/systemd/system/stbackup.service:
[Unit]
Description=STBackup
After=network-online.target
[Service]
LimitNOFILE=65535
LimitNPROC=65535
TasksMax=infinity
MemoryAccounting=yes
MemoryHigh=<90% of machine RAM>
MemoryMax=<98% of machine RAM>
OOMPolicy=stop
LimitCORE=infinity
Environment=ENV=production
Type=simple
User=root
WorkingDirectory=/etc/sttrader
ExecStart=/etc/sttrader/backupserver --config /etc/sttrader/config.toml
KillMode=mixed
Restart=always
TimeoutSec=120
TimeoutStopSec=30
RestartSec=5
[Install]
WantedBy=multi-user.target
MemoryHigh and MemoryMax are calculated from the target machine during
installation. They can be overridden by setting MEMORY_HIGH and MEMORY_MAX
before running the installer.
Enable and start manually when needed:
sudo systemctl daemon-reload
sudo systemctl enable stbackup
sudo systemctl start stbackup
Operational Checks¶
Check service status:
sudo systemctl status stbackup
Check logs:
sudo journalctl -u stbackup -f
Check that the port is listening:
ss -ltnp | grep 5555
The backup server expects a valid put_artifact request. A plain nc connect
can verify that the TCP port is reachable, but it does not validate the upload
protocol.
Trading Server Endpoint Configuration¶
On the main trading server, configure a backup endpoint with:
enable != 0;hostinhost:portformat, for example10.0.0.20:5555;passwordequal to the backup servertoken;timeoutlarge enough for expected artifact upload duration.retry_attemptsfor the total number of upload attempts, including the first attempt;retry_delayfor the delay between retry attempts.
When a backup run completes locally, BackupManager uploads every validated
artifact to each enabled endpoint. The manifest is uploaded after participant
artifacts as _manifest.
Uninstallation¶
sudo systemctl stop stbackup
sudo systemctl disable stbackup
sudo rm /etc/systemd/system/stbackup.service
sudo systemctl daemon-reload
Backup data is stored separately in /etc/sttrader/backups-remote by default.
Remove it only after confirming that the stored backup runs are no longer
required.