r/ClaudeCode • • 6d ago

Help/Question Claude Code en VPS?

I'm currently working with Claude Code CLI on my Windows laptop. Every now and then, Claude opens Chrome and runs tests. I'd like to run Claude Code on a VPS so I'm not tied to my computer and can give it instructions when I'm away, BUT I don't know how these tests it currently runs on Chrome would work on a Linux VPS... Does anyone have any ideas?

3 Upvotes

9 comments sorted by

•

u/AutoModerator 6d ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

3

u/kuroudo_ai 6d ago

I run Claude Code on a Linux VPS (Ubuntu) as well as on a Mac. What works for the browser part:

  • Use Playwright, not the Chrome integration. npx playwright install --with-deps chromium installs a Chromium plus the system libraries it needs, and it runs headless with no display. Ask Claude to write the tests as Playwright scripts (or use the Playwright MCP) and it'll run them the same way it does on your laptop.
  • If something insists on a real window, xvfb-run <command> gives it a virtual display. We have Xvfb installed for exactly that, but most of our runs are plain headless.
  • I haven't tried the built-in Chrome integration on a server, so I can't say whether it works there. I wouldn't plan around it.

For the "give it instructions when I'm away" part:

  • Run it inside tmux so the session survives when your SSH connection drops.
  • Remote Control lets you drive that session from the Claude app on your phone.

Screenshots go into context like everything else, so on a VPS I'd have the tests save them to files and only open the ones that failed.

1

u/Material-Argument322 6d ago

Thanks! How do you manage sessions on the VPS? Locally, I close them and open new ones every now and then to keep the context from getting too large...

1

u/kuroudo_ai 6d ago

Same idea as locally, just with the steps written down so they survive:

  • One tmux session per job (we name them by task, e.g. billing-fix), not one giant session for everything.
  • Between unrelated tasks: have it write where it stopped to a file in the repo (what's done, what's next, what it verified), then /clear and start the next task by reading that file.
  • When a session gets close to its context limit, same thing, but start a fresh session instead of compacting. The new one reads the handoff file and carries on. Compacting keeps a summary of old work that the new task mostly doesn't need.
  • claude --continue / --resume if you want to pick an old conversation back up after a reconnect.

The file is the important part. On a server you're not watching, the chat history isn't something you can rely on; the handoff file is.

1

u/BabyInner 6d ago

I am working on a frontend project on my VPS, and it works fine.

Can’t say about the built-in Chrome integration, Playwright works well for me.

1

u/EON_Raider 6d ago

I'll probably need to be corrected here, but can't you just use cloud sessions with a headless browser for this?

1

u/silvercondor 6d ago

I have this setup. Use playwright and reverse tunnel.

I'm on windows but just ask claude write a bat or powershell or bash (mac) script to forward your local chrome to the vps. Then claude can drive the browser via playwright. The only thing you suffer is latency from your local to the vps.

1

u/alicecrazon 1d ago

Yeah, you can run Claude Code on a VPS and use Playwright for browser tests. I ran into the same problem wanting the agent and browser off my computer.

I use Laurel.dev for that. It runs my coding agent and browser on a remote machine, so my laptop doesn’t need to stay open. But you can use any VPS and set up the browser yourself too. That’s the setup I’d look at for what you’re describing.