mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-15 17:11:30 +00:00
5d93786995
- Update scripts/: start-dev, stop-dev, dev-setup, setup, setup-ovn, etc. - Update tests/e2e/: all E2E test scripts - Update scripts/iac/: rename hive-test.sh → spinifex-test.sh, update TF files - Update config/: rename hive.service and install script - Binary refs use spx, env vars use SPINIFEX_, paths use spinifex
Hive Systemd Service
This directory contains the systemd service configuration for running Hive services on Ubuntu and Debian systems.
Files
hive.service- The systemd service file that manages all Hive servicesinstall-hive-service.sh- Installation script to set up the serviceREADME.md- This documentation file
Installation
Prerequisites
- Ensure Hive is installed in
/opt/hive/ - Ensure the
hivebinary is available at/opt/hive/bin/hive - Run the installation script as root
Setup Configuration
/opt/hive/bin/hive admin init
This will init the Hive environment and create the default configuration files in the home directory, e.g ~/hive/.
/home/username/hive:
amis config images logs nats predastore state viperblock volumes
/home/username/hive/amis:
/home/username/hive/config:
awsgw hive.toml nats predastore server.key server.pem
/home/username/hive/config/awsgw:
awsgw.toml
/home/username/hive/config/nats:
nats.conf
/home/username/hive/config/predastore:
predastore.toml
/home/username/hive/images:
/home/username/hive/logs:
awsgw.log awsgw.pid hive.log hive.pid nats.log nats.pid predastore.log predastore.pid viperblock.log viperblock.pid
/home/username/hive/nats:
/home/username/hive/predastore:
data
/home/username/hive/predastore/data:
predastore
/home/ben/hive/state:
/home/ben/hive/viperblock:
/home/ben/hive/volumes:
Quick Installation
sudo ./config/install-hive-service.sh
Manual Installation
If you prefer to install manually:
-
Copy the service file:
sudo cp config/hive.service /etc/systemd/system/ -
Reload systemd:
sudo systemctl daemon-reload -
Enable the service:
sudo systemctl enable hive.service
Service Management
Start the service
sudo systemctl start hive
Stop the service
sudo systemctl stop hive
Check service status
sudo systemctl status hive
Restart the service
sudo systemctl restart hive
View service logs
sudo journalctl -u hive -f
Disable auto-start
sudo systemctl disable hive
Service Details
The hive.service file:
- Starts services in the correct order: NATS → Predastore → Viperblock
- Includes proper delays between service starts to ensure dependencies are ready
- Stops services in reverse order during shutdown
- Runs as root (required for system services)
- Includes security hardening settings
- Provides proper logging to systemd journal
- Automatically restarts on failure
Service Order
The service starts the following components in order:
- NATS - Message broker service
- Predastore - Data storage service (waits 3 seconds after NATS)
- Viperblock - Block storage service (waits 2 seconds after Predastore)
Troubleshooting
Check if the service is running
sudo systemctl is-active hive
View recent logs
sudo journalctl -u hive --since "1 hour ago"
Check service configuration
sudo systemctl cat hive
Verify binary exists
ls -la /opt/hive/bin/hive
Test service commands manually
/opt/hive/bin/hive service nats start
/opt/hive/bin/hive service predastore start
/opt/hive/bin/hive service viperblock start
Customization
If you need to modify the service configuration:
- Edit the service file:
sudo nano /etc/systemd/system/hive.service - Reload systemd:
sudo systemctl daemon-reload - Restart the service:
sudo systemctl restart hive
Security Notes
- The service runs as root, which is necessary for system-level services
- Security hardening is enabled with
ProtectSystem=strictandNoNewPrivileges=true - Only specific paths are writable:
/opt/hive,/var/log,/var/run