Skip to main content
OpenCode Portal is designed for remote access to your OpenCode instance. This guide shows you how to deploy the portal on a VPS and access it securely from your mobile device or any other machine using Tailscale.

Use Case

This setup allows you to:
  • Access OpenCode from your mobile device when you don’t have your laptop
  • Work on code from anywhere with an internet connection
  • Share OpenCode access with team members securely
Architecture:

Prerequisites

  • A VPS or remote server (Ubuntu, Debian, or similar)
  • SSH access to your server
  • A Tailscale account (free tier available)

Setup Steps

1

Install Bun on Your Server

SSH into your server and install Bun:
Add Bun to your PATH (if not done automatically):
Add these lines to your ~/.bashrc or ~/.zshrc to make them permanent.
2

Install OpenCode

Install OpenCode globally on your server:
Verify the installation:
3

Install OpenPortal

Install OpenPortal globally:
4

Install and Configure Tailscale

Install Tailscale on your server:
Start and authenticate Tailscale:
Follow the authentication URL to connect your server to your Tailscale network.Get your server’s Tailscale IP:
Note this IP address - you’ll use it to access OpenPortal.
5

Start OpenPortal on Your Server

Navigate to your project directory and start OpenPortal:
For production use, you’ll want to keep it running in the background. See the Process Management section below.
6

Install Tailscale on Your Mobile Device

Install the Tailscale app on your phone:Sign in with the same Tailscale account.
7

Access OpenPortal from Your Device

On your mobile device, open a browser and navigate to:
Replace [tailscale-ip] with your server’s Tailscale IP from Step 4.You should now see the OpenCode Portal interface!

Network Configuration

Binding to All Interfaces

By default, OpenPortal binds to 0.0.0.0 (all network interfaces), which allows access from Tailscale. If you want to bind to a specific interface:

Custom Ports

If you need to use different ports:
Remember to use the correct port when accessing from your device.

Process Management

For production use, you’ll want OpenPortal to run persistently in the background.

Using systemd

Create a systemd service file:
Add the following content (adjust paths as needed):
Enable and start the service:
Manage the service:

Using screen

For a simpler approach, use screen:
Reattach to the session:

Using tmux

Alternatively, use tmux:
Reattach to the session:

Security Considerations

Tailscale Security

Tailscale provides secure, encrypted connections between your devices:
  • All traffic is encrypted using WireGuard
  • Only devices in your Tailscale network can access your server
  • No need to expose ports to the public internet

Additional Security Measures

Never expose OpenPortal directly to the public internet without proper authentication and HTTPS.
If you need to expose OpenPortal publicly:
  1. Use a reverse proxy (nginx, Caddy) with HTTPS
  2. Add authentication (basic auth, OAuth)
  3. Configure firewall rules to restrict access
  4. Use strong passwords for your OpenCode instances
Example nginx configuration with basic auth:

Monitoring and Maintenance

Check Running Instances

View Logs (systemd)

Restart After Updates

After updating OpenPortal:

Troubleshooting

Cannot Connect from Mobile Device

  1. Verify Tailscale is connected on both devices
  2. Check your server’s Tailscale IP: tailscale ip -4
  3. Ensure OpenPortal is running: openportal list
  4. Verify the port is correct (default: 3000)

Tailscale Connection Issues

OpenPortal Service Not Starting

Next Steps

  • Explore Docker deployment for containerized setups
  • Configure multiple project instances with custom names
  • Set up automated backups for your project files