Remote Setup
Setting up OpenCode Portal on a remote server with Tailscale
Remote Setup
Access Portal from anywhere by running it on a VPS or home server with Tailscale.
Architecture
[Your Phone/Laptop] ---(Tailscale VPN)---> [VPS running Portal + OpenCode]This setup allows you to:
- Code from your phone or tablet
- Access your development environment from anywhere
- Keep your projects running on a powerful server
Prerequisites
On your remote server:
- OpenCode installed
- Bun installed (recommended)
- Tailscale installed and connected
Note: OpenPortal works best when paired with Bun. Node.js may have some rough edges.
Server Setup
1. Install Bun
curl -fsSL https://bun.sh/install | bash2. Install OpenCode
# Using curl (macOS/Linux)
curl -fsSL https://opencode.ai/install | bash
# Or using bun
bun install -g opencode3. Install Portal globally
bun install -g openportal4. Install and configure Tailscale
# Install Tailscale
curl -fsSL https://tailscale.com/install.sh | sh
# Start Tailscale and authenticate
sudo tailscale upFollow the authentication link that appears to connect your server to your Tailnet.
5. Run Portal
Navigate to your project and start Portal:
cd /path/to/your/project
openportalPortal will display the URLs where you can access it.
Client Access
1. Install Tailscale on your device
Download Tailscale for your device:
2. Connect to your Tailnet
Open Tailscale and sign in with the same account you used on your server.
3. Access Portal
Once connected, you can access Portal using any of these methods:
Using Tailscale IP
Find your server's Tailscale IP:
tailscale ip -4Then access Portal at:
http://100.x.x.x:3000Using MagicDNS (Recommended)
Tailscale's MagicDNS lets you access devices by hostname. If your server is named myserver, access Portal at:
http://myserver:3000To check or set your machine name:
# Check current hostname
tailscale status
# Set a custom hostname
sudo tailscale set --hostname=myserverUsing Tailnet Domain
For a fully qualified domain name, use your Tailnet name:
http://myserver.tailnet-name.ts.net:3000Find your Tailnet name in the Tailscale admin console under DNS settings.
Running as a Service
To keep Portal running after you disconnect, use a process manager like PM2:
# Install PM2
bun install -g pm2
# Start Portal with PM2
cd /path/to/your/project
pm2 start openportal --name portal
# Save the process list
pm2 save
# Setup startup script
pm2 startupManaging the service
# Check status
pm2 status
# View logs
pm2 logs portal
# Restart
pm2 restart portal
# Stop
pm2 stop portalManaging Multiple Projects
Portal supports multiple instances. Use the --name flag to identify each:
# Start Portal for different projects
cd /project-a && openportal --name project-a --port 3001
cd /project-b && openportal --name project-b --port 3002
# List all running instances
openportal list
# Stop a specific instance
openportal stop --name project-aAccess each project via MagicDNS:
http://myserver:3001 # project-a
http://myserver:3002 # project-bSecurity Considerations
- Tailscale provides end-to-end encryption
- Portal is only accessible via your Tailscale network
- No ports need to be exposed to the public internet
- Consider using Tailscale ACLs for additional access control