BugPin systemd Service
On Linux servers, BugPin can be run as a systemd service with automatic startup on boot, process supervision, and integrated log management via journalctl. This guide covers creating a dedicated system user, installing BugPin, configuring the service unit file, managing the service, and the built-in systemd security hardening directives.
Prerequisites
- Linux server with systemd (Ubuntu, Debian, CentOS, etc.)
- Bun installed:
curl -fsSL https://bun.sh/install | bash - BugPin cloned to
/opt/bugpin(or your preferred location)
Installation
1. Create BugPin User
# Create dedicated user for BugPin
sudo useradd -r -s /bin/false bugpin
# Create directories
sudo mkdir -p /opt/bugpin/data
sudo chown -R bugpin:bugpin /opt/bugpin
2. Install BugPin
# Clone repository
sudo git clone https://github.com/aranticlabs/bugpin.git /opt/bugpin
cd /opt/bugpin
# Install dependencies
sudo -u bugpin bun install
# Build assets
sudo -u bugpin bun run build
3. Install systemd Service
# Copy service file
sudo cp bugpin.service /etc/systemd/system/
# If you installed BugPin in a different location, edit the service file:
sudo nano /etc/systemd/system/bugpin.service
# Update WorkingDirectory and ReadWritePaths
# Reload systemd
sudo systemctl daemon-reload
# Enable service (start on boot)
sudo systemctl enable bugpin
# Start service
sudo systemctl start bugpin
Usage
Service Management
# Start BugPin
sudo systemctl start bugpin
# Stop BugPin
sudo systemctl stop bugpin
# Restart BugPin
sudo systemctl restart bugpin
# Check status
sudo systemctl status bugpin
# Enable auto-start on boot
sudo systemctl enable bugpin
# Disable auto-start
sudo systemctl disable bugpin
View Logs
# View all logs
sudo journalctl -u bugpin
# Follow logs (live tail)
sudo journalctl -u bugpin -f
# Last 100 lines
sudo journalctl -u bugpin -n 100
# Logs since 1 hour ago
sudo journalctl -u bugpin --since "1 hour ago"
# Logs from today
sudo journalctl -u bugpin --since today
# Logs with timestamps
sudo journalctl -u bugpin -o short-iso
Configuration
BugPin stores data in ./data relative to the WorkingDirectory in the service file.
To change paths, edit the service file:
sudo nano /etc/systemd/system/bugpin.service
Update WorkingDirectory and ReadWritePaths as needed, then reload:
sudo systemctl daemon-reload
sudo systemctl restart bugpin
Updates
# Stop service
sudo systemctl stop bugpin
# Update code
cd /opt/bugpin
sudo -u bugpin git pull
# Install dependencies
sudo -u bugpin bun install
# Rebuild assets
sudo -u bugpin bun run build
# Start service
sudo systemctl start bugpin
# Check status
sudo systemctl status bugpin
Troubleshooting
Service won't start
# Check status and logs
sudo systemctl status bugpin
sudo journalctl -u bugpin -n 50
# Common issues:
# 1. Bun not in PATH
which bun # Should show /usr/bin/bun or similar
# If not found, create symlink:
sudo ln -s /root/.bun/bin/bun /usr/bin/bun
# 2. Wrong permissions
sudo chown -R bugpin:bugpin /opt/bugpin
# 3. Port already in use
sudo lsof -i :7300
# 4. Missing dependencies
cd /opt/bugpin
sudo -u bugpin bun install
Check Bun location
# Find Bun installation
which bun
# Update ExecStart in service file if needed
sudo nano /etc/systemd/system/bugpin.service
ExecStart=/path/to/bun run start
Reset Service
# Stop and disable
sudo systemctl stop bugpin
sudo systemctl disable bugpin
# Remove service file
sudo rm /etc/systemd/system/bugpin.service
# Reload systemd
sudo systemctl daemon-reload
# Reinstall (follow Installation steps)
Security Hardening
The systemd service file includes security features:
NoNewPrivileges=true- Prevents privilege escalationPrivateTmp=true- Isolated /tmp directoryProtectSystem=strict- Read-only system directoriesProtectHome=true- No access to /home directoriesReadWritePaths=/opt/bugpin/data- Only write access to data directory
These settings ensure BugPin runs with minimal permissions.
Production Deployment
For production deployments with HTTPS and domain names, see:
- Reverse Proxy Setup - Nginx, Traefik, Caddy, Apache configurations
Uninstall
# Stop and disable service
sudo systemctl stop bugpin
sudo systemctl disable bugpin
# Remove service file
sudo rm /etc/systemd/system/bugpin.service
# Reload systemd
sudo systemctl daemon-reload
# Remove BugPin files (optional)
sudo rm -rf /opt/bugpin
# Remove user (optional)
sudo userdel bugpin