VibeTunnel Systemd Service Guide
This guide covers installing and managing VibeTunnel as a systemd service on Linux systems.Overview
VibeTunnel includes built-in systemd integration that allows you to run it as a persistent service on Linux. The service runs as a user-level systemd service under your account (not system-wide), providing automatic startup, restart on failure, and proper resource management.Quick Start
Installation
Prerequisites
- Linux system with systemd (most modern distributions)
- VibeTunnel installed globally via npm (
npm install -g vibetunnel
) - Regular user account (do not run as root)
Install Command
- Verify VibeTunnel is installed and accessible
- Create a wrapper script at
~/.local/bin/vibetunnel-systemd
- Install the service file at
~/.config/systemd/user/vibetunnel.service
- Enable the service for automatic startup
- Configure user lingering for boot startup
Service Management
Basic Commands
Viewing Logs
Configuration
Default Settings
The service runs with these defaults:- Port: 4020
- Bind Address: 0.0.0.0 (all interfaces)
- Working Directory: Your home directory
- Restart Policy: Always restart on failure
- Restart Delay: 10 seconds
- Memory Limit: 512MB soft, 1GB hard
- File Descriptor Limit: 65536
- Environment:
NODE_ENV=production
,VIBETUNNEL_LOG_LEVEL=info
Service File Location
The service configuration is stored at:Customizing the Service
To modify service settings:-
Edit the service file:
-
Common customizations:
-
Reload and restart:
Architecture
Why User-Level Service?
VibeTunnel uses user-level systemd services for several reasons:- Security: Runs with user privileges, not root
- Node.js Compatibility: Works with user-installed Node.js version managers (nvm, fnm)
- User Data Access: Natural access to your projects and Git repositories
- Simplicity: No sudo required for management
- Isolation: Each user can run their own instance
The Wrapper Script
The installer creates a wrapper script at~/.local/bin/vibetunnel-systemd
that:
- Searches for VibeTunnel in multiple locations
- Handles nvm and fnm installations
- Falls back to system-wide Node.js if needed
- Provides detailed logging for troubleshooting
User Lingering
The installer enables “user lingering” which allows your user services to run even when you’re not logged in:Troubleshooting
Service Won’t Start
-
Check if VibeTunnel is installed:
-
Check service logs:
-
Verify the wrapper script exists:
-
Test the wrapper script directly:
Port Already in Use
If port 4020 is already in use:-
Find what’s using the port:
- Either stop the conflicting service or change VibeTunnel’s port in the service file
Node.js Version Manager Issues
If using nvm or fnm, ensure they’re properly initialized:-
Check your shell configuration:
-
The wrapper script searches these locations:
- nvm:
~/.nvm
- fnm:
~/.local/share/fnm
- Global npm:
/usr/local/bin/npm
,/usr/bin/npm
- nvm:
Permission Denied
If you get permission errors:- Ensure you’re NOT running as root
-
Check file permissions:
-
Fix permissions if needed:
Uninstallation
To completely remove the systemd service:- Stop the running service
- Disable automatic startup
- Remove the service file
- Remove the wrapper script
- Reload systemd configuration
Advanced Usage
Multiple Instances
To run multiple VibeTunnel instances:-
Copy the service file with a new name:
-
Edit the new service file to use a different port:
-
Manage the new instance:
Environment-Specific Configuration
Create environment-specific service overrides:Integration with Other Services
To make VibeTunnel depend on other services:Security Considerations
Firewall Configuration
If binding to 0.0.0.0, ensure your firewall is properly configured:Restricting Access
To limit access to localhost only, modify the service:Resource Limits
The service includes resource limits for stability:- Memory: 512MB soft limit, 1GB hard limit
- File descriptors: 65536
- Automatic restart with 10-second delay
FAQ
Q: Why doesn’t the service run as root? A: VibeTunnel doesn’t require root privileges and running as a regular user is more secure. It also ensures compatibility with user-installed Node.js version managers. Q: Can I run this on a server without a GUI? A: Yes, the systemd service works perfectly on headless servers. User lingering ensures it starts at boot. Q: How do I run VibeTunnel on a different port? A: Edit the service file and change the--port
parameter in the ExecStart
line, then reload and restart.
Q: What if I use a custom Node.js installation?
A: The wrapper script searches common locations. If your installation isn’t found, you can modify the wrapper script at ~/.local/bin/vibetunnel-systemd
.
Q: Can multiple users run VibeTunnel on the same system?
A: Yes, each user can install their own service. Just ensure they use different ports.
Support
For issues specific to the systemd service:- Check the logs with
journalctl --user -u vibetunnel
- Verify the installation with
vibetunnel systemd status
- Report issues at https://github.com/amantus-ai/vibetunnel/issues