---
id: 18771
lang: en
title: "How to Deploy a Vibe-Coded Project to a VPS: The Agent Opened a Database Port, and the Server Was Mining Crypto"
published_at: "2026-12-01 02:26:26"
source_name: "Habr AI"
source_url: "https://habr.com/ru/companies/timeweb/articles/1109108/?utm_campaign=1109108&utm_source=habrahabr&utm_medium=rss"
canonical_url: "https://news.hamidun.com/en/news/18771"
categories: ["llm", "autonomous"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# How to Deploy a Vibe-Coded Project to a VPS: The Agent Opened a Database Port, and the Server Was Mining Crypto

> **Краткая суть (BLUF):** You can build a working project with an AI agent in a couple of evenings, but it is only visible at localhost:3000, and only to you. Handing the deployment to the agent without oversight is risky. The author of a Habr guide describes how the agent, while generating docker-compose.yml, exposed the PostgreSQL port to the outside world. Within a couple of days, bots found the open access and started a crypto miner that pinned the CPU at 100%. Read every port and secret in agent-generated configs before you deploy.  - Keep databases, caches, and queues on the internal Docker network - A bot trap logged 2,406 attack sessions from 309 IP addresses over 3 days - A domain and Caddy let you host several projects on one VPS

Building a working project with an AI agent can take just a couple of evenings today. You want to send a link to a friend right away, but it points to http://localhost:3000, which is your own computer, so no one else can open it. To let people see the project, you need to deploy it to a server. If you simply tell the agent "deploy this to the internet for me," it may make incorrect changes, break working code, or fail to finish the launch. Worse, it can quietly open a hole. That is exactly what happened to the author of the Habr guide: while generating docker-compose.yml, the agent exposed the PostgreSQL database port (5432) to the outside. A couple of days later, someone else's crypto miner was running on the server and loading the CPU to 100%. Below, we look at how to avoid this.

## First, prepare the code and restrict the agent

The project must run on the server without files or settings from your laptop. To do this, pin the language version and add a dependency lock file. Move settings into a .env.example template without real values, do not store keys and passwords in the repository, and keep the database, cache, and queues on the internal Docker network.

It helps to validate the configuration at startup. In one of the author's projects, all settings pass through a strict Zod schema. If you forget to pass an API key or a database address, the application immediately logs which variable is missing. Otherwise, it would crash with an obscure error in the middle of a user request, three hours into a run.

The author writes the rules for the agent itself in AGENTS.md or CLAUDE.md. The agent is forbidden to read, modify, or print .env, .pem and .key files, credentials.json, and any paths containing the words secret, token, or password. Before deleting files, changing database volumes, running git commit, git push, or deployment commands, it must stop and ask a human. But text instructions do not replace real access restrictions: if the agent does not need working secrets or server access, the author simply does not grant them.

Before deploying, the author runs the pre-deploy-audit skill from his open repository, dotcore-skills. It looks for forgotten keys, tokens, passwords, and private addresses. It also checks network bindings in Docker Compose, database ports exposed externally, whether containers run as non-root, CORS settings, and input validation. A one-off prompt like "check the project for security" works worse: the model has no specifics, skims a couple of files, and reports that everything is fine.

## Domain, ports, and bot protection

Before creating the server, decide how users will reach the project. A tunnel such as ngrok suits a quick demo for 15 minutes: the address changes on restart, and the project disappears when your computer is off. A bare IP works for closed APIs between your own machines, but browsers will warn about an insecure connection, and Telegram will not let you connect a Mini App by IP. A project with real users needs its own domain. It costs a few hundred rubles a year, provides trusted Let's Encrypt HTTPS certificates, and lets you create subdomains. The author's single domain serves several projects, for example a portfolio and an educational platform.

The idea that "my pet project is of no interest to anyone" does not hold. Scanner bots crawl the internet around the clock and probe every public IP. The author set up a trap on a clean server that imitates open SSH, Redis, and HTTP. Over three days, it recorded 2,406 attack sessions from 309 different IP addresses.

Protection rules:
- do not open ports for internal services; if a utility on the server itself needs a port, bind it to 127.0.0.1 rather than all interfaces;
- allow SSH logins only with keys and disable password login;
- in the provider's firewall, leave only 22 (SSH), 80 (redirect to HTTPS), and 443 (HTTPS) open;
- defend against volumetric DDoS at the provider level or with a CDN, and rate-limit frequent API requests in the application itself or in the entry proxy.

## The server and several projects on one VPS

The author uses a VPS from Timeweb Cloud, where the server, DNS, SSH keys, and Cloud Firewall are all configured in one control panel. The example uses a clean Ubuntu 26.04 image in the "Moscow" location, and you must select a public IP when creating the server. You can have the agent install Git, Docker, and Docker Compose: ask for a step-by-step guide that explains each command, then verify the result yourself. Next, choose a launch scheme. Docker Compose fits when a database or cache runs alongside the application. Native services without Docker, autostarted with systemd, fit when the application runs as a single process.

When projects multiply, you do not need a separate VPS for each one, as long as a single machine has enough resources. The author's server runs a music service, an educational platform, a landing page, a portfolio, and an analytics dashboard, each on its own subdomain. He demonstrates HTTPS delivery and domain-based routing using Caddy. The article also describes automatic deployment on a Git push, configured so that it does not overload the server.

## What to keep in mind

The instructions are tied to Timeweb Cloud, Ubuntu, and Docker, but the principles apply to other providers as well. The single-VPS setup is designed for pet projects, not high-load workloads. The practical takeaway is simple: let the agent generate configs, but read every line about ports, networks, and secrets yourself.

---
- **Первоисточник:** [Habr AI](https://habr.com/ru/companies/timeweb/articles/1109108/?utm_campaign=1109108&utm_source=habrahabr&utm_medium=rss)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/18771
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
