5.2 KiB
5.2 KiB
Calypso Systemd Service Setup
Tanggal: 2025-01-09
Service: calypso-api.service
Status: ✅ ACTIVE & RUNNING
Service File
Location: /etc/systemd/system/calypso-api.service
Configuration
[Unit]
Description=AtlasOS - Calypso API Service
Documentation=https://github.com/atlasos/calypso
After=network.target postgresql.service
Wants=postgresql.service
[Service]
Type=simple
User=calypso
Group=calypso
WorkingDirectory=/opt/calypso
ExecStart=/opt/calypso/bin/calypso-api -config /opt/calypso/conf/config.yaml
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal
SyslogIdentifier=calypso-api
# Environment
EnvironmentFile=/opt/calypso/conf/secrets.env
Environment="CALYPSO_DB_HOST=localhost"
Environment="CALYPSO_DB_PORT=5432"
Environment="CALYPSO_DB_USER=calypso"
Environment="CALYPSO_DB_NAME=calypso"
# Security
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/opt/calypso/data /opt/calypso/conf /var/log/calypso /var/lib/calypso /run/calypso
ReadOnlyPaths=/opt/calypso/bin /opt/calypso/web /opt/calypso/releases
# Resource limits
LimitNOFILE=65536
LimitNPROC=4096
[Install]
WantedBy=multi-user.target
Service Status
✅ Status: Active (running)
✅ Enabled: Yes (auto-start on boot)
✅ PID: Running
✅ Memory: ~12.4M
✅ Port: 8080
Service Management
Start Service
sudo systemctl start calypso-api
Stop Service
sudo systemctl stop calypso-api
Restart Service
sudo systemctl restart calypso-api
Reload Configuration (without restart)
sudo systemctl reload calypso-api
Check Status
sudo systemctl status calypso-api
Enable/Disable Auto-start
# Enable auto-start on boot
sudo systemctl enable calypso-api
# Disable auto-start
sudo systemctl disable calypso-api
# Check if enabled
sudo systemctl is-enabled calypso-api
Viewing Logs
Real-time Logs (Follow Mode)
sudo journalctl -u calypso-api -f
Last 50 Lines
sudo journalctl -u calypso-api -n 50
Logs Since Today
sudo journalctl -u calypso-api --since today
Logs with Timestamps
sudo journalctl -u calypso-api --no-pager
Service Configuration Details
Working Directory
- Path:
/opt/calypso - Purpose: Base directory for application
Binary Location
- Path:
/opt/calypso/bin/calypso-api - Config:
/opt/calypso/conf/config.yaml
Environment Variables
- Secrets File:
/opt/calypso/conf/secrets.envCALYPSO_DB_PASSWORD- Database passwordCALYPSO_JWT_SECRET- JWT secret key
- Database Config:
CALYPSO_DB_HOST=localhostCALYPSO_DB_PORT=5432CALYPSO_DB_USER=calypsoCALYPSO_DB_NAME=calypso
Security Settings
- ✅ NoNewPrivileges: Prevents privilege escalation
- ✅ PrivateTmp: Isolated temporary directory
- ✅ ProtectSystem: Read-only system directories
- ✅ ProtectHome: Read-only home directories
- ✅ ReadWritePaths: Only specific paths writable
- ✅ ReadOnlyPaths: Application binaries read-only
Resource Limits
- Max Open Files: 65536
- Max Processes: 4096
Runtime Directories
- Logs:
/var/log/calypso/(calypso:calypso) - Data:
/var/lib/calypso/(calypso:calypso) - Runtime:
/run/calypso/(calypso:calypso)
Service Verification
Check Service Status
sudo systemctl is-active calypso-api
# Output: active
Check HTTP Endpoint
curl http://localhost:8080/api/v1/health
Check Process
ps aux | grep calypso-api
Check Port
sudo netstat -tlnp | grep 8080
# or
sudo ss -tlnp | grep 8080
Startup Logs Analysis
From initial startup logs:
- ✅ Database connection successful
- ✅ Connected to Bacula database
- ✅ HTTP server started on port 8080
- ✅ MHVTL configuration sync completed
- ✅ Disk discovery completed (5 disks)
- ✅ Alert rules registered
- ✅ Monitoring services started
- ⚠️ Warning: RRD tool not found (network monitoring optional)
Troubleshooting
Service Won't Start
- Check logs:
sudo journalctl -u calypso-api -n 50 - Check config file:
cat /opt/calypso/conf/config.yaml - Check secrets file permissions:
ls -la /opt/calypso/conf/secrets.env - Check database connection:
sudo -u postgres psql -U calypso -d calypso
Service Crashes/Restarts
- Check logs for errors:
sudo journalctl -u calypso-api --since "10 minutes ago" - Check system resources:
free -handdf -h - Check database status:
sudo systemctl status postgresql
Permission Issues
- Check ownership:
ls -la /opt/calypso/bin/calypso-api - Check user exists:
id calypso - Check directory permissions:
ls -la /opt/calypso/
Next Steps
- ✅ Service installed and running
- ⏭️ Setup reverse proxy (Caddy/Nginx) for frontend
- ⏭️ Configure firewall rules (if needed)
- ⏭️ Setup SSL/TLS certificates
- ⏭️ Configure monitoring/alerting
Service Status: ✅ OPERATIONAL
API Endpoint: http://localhost:8080
Health Check: http://localhost:8080/api/v1/health