Skip to main content

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

This command will:
  1. Verify VibeTunnel is installed and accessible
  2. Create a wrapper script at ~/.local/bin/vibetunnel-systemd
  3. Install the service file at ~/.config/systemd/user/vibetunnel.service
  4. Enable the service for automatic startup
  5. 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:
  1. Edit the service file:
  2. Common customizations:
  3. Reload and restart:

Architecture

Why User-Level Service?

VibeTunnel uses user-level systemd services for several reasons:
  1. Security: Runs with user privileges, not root
  2. Node.js Compatibility: Works with user-installed Node.js version managers (nvm, fnm)
  3. User Data Access: Natural access to your projects and Git repositories
  4. Simplicity: No sudo required for management
  5. 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

  1. Check if VibeTunnel is installed:
  2. Check service logs:
  3. Verify the wrapper script exists:
  4. Test the wrapper script directly:

Port Already in Use

If port 4020 is already in use:
  1. Find what’s using the port:
  2. 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:
  1. Check your shell configuration:
  2. The wrapper script searches these locations:
    • nvm: ~/.nvm
    • fnm: ~/.local/share/fnm
    • Global npm: /usr/local/bin/npm, /usr/bin/npm

Permission Denied

If you get permission errors:
  1. Ensure you’re NOT running as root
  2. Check file permissions:
  3. Fix permissions if needed:

Uninstallation

To completely remove the systemd service:
This will:
  • 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:
  1. Copy the service file with a new name:
  2. Edit the new service file to use a different port:
  3. 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
Adjust these based on your needs and system resources.

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:
  1. Check the logs with journalctl --user -u vibetunnel
  2. Verify the installation with vibetunnel systemd status
  3. Report issues at https://github.com/amantus-ai/vibetunnel/issues