Skip to content

techlibs/vlad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vlad — Mobile Claude Code on GCP

Run Claude Code from your phone. vlad automates the setup of a GCP VM with mosh, tmux, and Tailscale — giving you a persistent, mobile-friendly coding environment accessible from Android (Termux) or any SSH client.

Architecture

Phone (Termux)  ──mosh/Tailscale──▶  GCP VM  ──▶  tmux  ──▶  Claude Code
                                     (Ubuntu)

Why this stack:

  • GCP — choose a region near you for low latency (~30-50ms)
  • Tailscale — encrypted mesh network, no exposed ports, zero-config SSH
  • mosh — survives WiFi/mobile data transitions and phone sleep
  • tmux — persistent sessions that survive any disconnection
  • Claude Code — lightweight (Node.js + API calls), ~100MB RAM per instance

What You Get

  • GCP VM with Ubuntu 24.04, Node.js 22, Claude Code, and GitHub CLI
  • Mobile-optimized tmux config (Ctrl+A prefix, mouse support, top status bar)
  • Shell aliases (c, cs, cn, cc, ccn) for quick Claude access
  • Push notifications via ntfy when Claude finishes a task
  • Tailscale for secure, zero-config connectivity
  • SSH hardening, UFW firewall, and fail2ban
  • Optional Git multi-account SSH configuration

Prerequisites

  • GCP account with billing enabled (or $300 free credit)
  • gcloud CLI installed and authenticated (install guide)
  • Tailscale account (free tier)
  • Anthropic account with Claude Pro or Max (for Claude Code)

Quick Start

Step 1: Create the VM (from your local machine)

git clone https://github.com/carloslibadoo/vlad.git && cd vlad
chmod +x setup-vm.sh setup-env.sh
./setup-vm.sh

You'll be prompted for your GCP project, zone, and VM settings. Or set them via environment variables:

GCP_PROJECT=my-project GCP_ZONE=us-central1-a ./setup-vm.sh

Step 2: Configure the environment (on the VM)

gcloud compute ssh <vm-name> --zone=<zone> --project=<project>
~/vlad-setup/setup-env.sh

The script walks you through installing Node.js, Claude Code, Tailscale, security hardening, and more.

Step 3: Authenticate services (on the VM)

The setup script will prompt you for these, or run them manually:

claude login      # Opens OAuth URL — complete in browser
gh auth login     # Opens OAuth URL — complete in browser

Step 4: Phone setup (Android)

  1. Tailscale — Install from Play Store, sign in with the same account used on the VM
  2. Termux — Install from F-Droid (NOT Play Store)
    pkg update && pkg install mosh openssh
  3. Keyboard — Install CodeBoard for Ctrl, Alt, Esc, and arrow keys
  4. ntfy — Install from Play Store, subscribe to your topic name
  5. Connect:
    mosh user@<tailscale-ip>

Step 5: Lock down firewall

After verifying Tailscale works from your phone:

# On the VM — remove temporary SSH and mosh rules
sudo ufw delete allow 22/tcp
sudo ufw delete allow 60000:61000/udp

# From your local machine — remove GCP firewall rule
gcloud compute firewall-rules delete allow-mosh --project=<project> --quiet

Configuration Reference

Environment Variable Description Default
VM_NAME VM instance name claude-code
GCP_PROJECT GCP project ID (prompted)
GCP_ZONE Compute zone us-central1-a
MACHINE_TYPE VM machine type e2-medium
BOOT_DISK_SIZE Boot disk size 30GB
NODE_MAJOR Node.js major version 22
NTFY_TOPIC ntfy.sh notification topic (prompted)
SKIP_TAILSCALE Skip Tailscale install 0
SKIP_SECURITY Skip security hardening 0

Day-to-Day Usage

Connect

# From phone (Termux) — via Tailscale
mosh user@<tailscale-ip>

# From Mac — via gcloud
gcloud compute ssh <vm-name> --zone=<zone> --project=<project>

# From Mac — via Tailscale (if installed)
ssh user@<vm-name>
mosh user@<vm-name>

Start / Stop VM

# Check status
gcloud compute instances describe <vm-name> \
  --zone=<zone> --project=<project> --format="value(status)"

# Start
gcloud compute instances start <vm-name> \
  --zone=<zone> --project=<project>

# Stop (saves cost — disk still billed at ~$1.20/month)
gcloud compute instances stop <vm-name> \
  --zone=<zone> --project=<project>

Transfer files

gcloud compute scp LOCAL_FILE <vm-name>:~/REMOTE_PATH \
  --zone=<zone> --project=<project>

tmux cheatsheet

Action Keys
Prefix Ctrl+A
Split horizontal Ctrl+A |
Split vertical Ctrl+A -
Switch panes Alt+arrows
New window Ctrl+A c
Next window Ctrl+A n
Detach Ctrl+A d
Reload config Ctrl+A r

VM shell aliases

Alias Command
c claude
cs claude --resume
cn claude --new
cc <dir> cd <dir> && claude
ccn <args> claude + push notification on finish

Cost Estimate

Resource Monthly cost
e2-medium (2 vCPU, 4 GB) running 24/7 ~$39
30 GB pd-standard disk ~$1.20
Egress (~5 GB) ~$0.60
Total (running 24/7) ~$41/month
Total (VM stopped) ~$1.20/month (disk only)

With $300 GCP free credit: ~7 months of 24/7 usage.

Tip: Stop the VM when not in use. At a few hours per day, costs drop to ~$5-10/month.

Troubleshooting

"Connection refused" on mosh — Check that UDP ports 60000-61000 are open in both UFW (sudo ufw status) and GCP firewall rules. After locking down, mosh must go through Tailscale.

Tailscale not connecting — Some ISPs use CGNAT. Tailscale handles this via DERP relay servers (adds ~20-40ms). Verify with tailscale netcheck.

tmux session lost — Check if the VM was stopped: gcloud compute instances describe <vm-name> --zone=<zone> --project=<project> --format="value(status)".

Claude Code asks to re-login — Re-run claude login. OAuth tokens may expire. Alternatively, set export ANTHROPIC_API_KEY=... in ~/.bashrc to use API credits instead.

Wrong git identity on push — Check per-repo config: git config user.email. Verify SSH host: ssh -T git@github.com.

Termux can't resolve VM hostname — Specify the user: ssh user@<vm-name>. Tailscale SSH can't map Termux's u0_a* Android usernames.

Phone keyboard missing Ctrl/Esc — In Termux, Volume Down acts as Ctrl. Install CodeBoard or Hacker's Keyboard for dedicated modifier keys.

Advanced: Git Multi-Account SSH

If you push to GitHub from multiple accounts, the setup script can install an SSH config template. Edit ~/.ssh/config on the VM:

# Primary account (default)
Host github.com
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_ed25519
  IdentitiesOnly yes

# Secondary account
Host github-secondary
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_ed25519_secondary
  IdentitiesOnly yes

Clone secondary-account repos using the host alias:

git clone git@github-secondary:org/repo.git

Set per-repo identity:

cd repo
git config user.email "you@example.com"
git config user.name "Your Name"

Detailed Guide

See mobile-claude-code-setup.md for the full manual walkthrough with step-by-step explanations.

License

MIT

About

Automated GCP VM setup for mobile Claude Code — run Claude from your phone via mosh/Tailscale/tmux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages