G

Linux (systemd)

Deploy GalaxDB as a systemd service on Linux for automatic startup, restart on failure, and structured log collection via journald.

Install Binary

bash
# Install via curl installer
curl -fsSL galaxdb.com/get | bash

# Or copy from a release build
cp target/release/galaxdb-server /usr/local/bin/
cp target/release/galaxdb-sidecar /usr/local/bin/
chmod +x /usr/local/bin/galaxdb-server /usr/local/bin/galaxdb-sidecar

# Create dedicated user
useradd --system --no-create-home --shell /bin/false galaxdb

# Create data directory
mkdir -p /var/lib/galaxdb
chown galaxdb:galaxdb /var/lib/galaxdb
chmod 750 /var/lib/galaxdb

# Create config directory
mkdir -p /etc/galaxdb
chown root:galaxdb /etc/galaxdb
chmod 750 /etc/galaxdb

systemd Service File

Create /etc/systemd/system/galaxdb.service:

/etc/systemd/system/galaxdb.service
[Unit]
Description=GalaxDB AI-native database server
Documentation=https://docs.galaxdb.com
After=network.target
Wants=network.target

[Service]
Type=simple
User=galaxdb
Group=galaxdb
WorkingDirectory=/var/lib/galaxdb

# Binary and arguments
ExecStart=/usr/local/bin/galaxdb-server \
  --data-dir /var/lib/galaxdb \
  --port 5433 \
  --observe-port 9090 \
  --sidecar /usr/local/bin/galaxdb-sidecar \
  --model sentence-transformers/all-MiniLM-L6-v2

# Environment
Environment=GALAXDB_LOG_LEVEL=info
EnvironmentFile=-/etc/galaxdb/env

# Restart policy
Restart=on-failure
RestartSec=5s
StartLimitIntervalSec=60s
StartLimitBurst=3

# Security hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ReadWritePaths=/var/lib/galaxdb
ProtectHome=true

# Resource limits
LimitNOFILE=65536
LimitNPROC=4096

[Install]
WantedBy=multi-user.target

Create /etc/galaxdb/env for secrets (not tracked in version control):

/etc/galaxdb/env
# Encryption key provider (optional)
GALAXDB_KEY_PROVIDER=local:/etc/galaxdb/key.bin

# HuggingFace cache (optional, speeds up model loading)
HF_HOME=/var/cache/huggingface
bash
# Secure the env file
chmod 640 /etc/galaxdb/env
chown root:galaxdb /etc/galaxdb/env

Enable & Start

bash
# Reload systemd
systemctl daemon-reload

# Enable auto-start on boot
systemctl enable galaxdb

# Start the service
systemctl start galaxdb

# Check status
systemctl status galaxdb

# Verify health
curl http://localhost:9090/health

Tip

Use systemctl status galaxdb to see the last few log lines and service state. Use journalctl -u galaxdb -f to follow logs in real time.

Viewing Logs

bash
# Follow logs in real time
journalctl -u galaxdb -f

# Show last 100 lines
journalctl -u galaxdb -n 100

# Show logs since last boot
journalctl -u galaxdb -b

# Show logs for a time range
journalctl -u galaxdb --since "2024-01-15 00:00:00" --until "2024-01-15 23:59:59"

# Filter by log level (structured JSON logs)
journalctl -u galaxdb -o json | jq 'select(.PRIORITY <= "4")'

GalaxDB emits structured JSON logs via tracing-subscriber. Each log line is a JSON object with fields: timestamp, level, target,message, and span fields.