Deploying CapRover on VPS: self-hosted PaaS for easy application deployment
TL;DR
In this detailed guide, we will step-by-step set up CapRover — a powerful self-hosted PaaS (Platform as a Service) — on your VPS. CapRover automates the deployment, scaling, and management of web applications, databases, and microservices, providing functionality similar to Heroku or Netlify, but under your full control. You will learn how to prepare the server, install Docker and CapRover, configure domains, deploy applications, and set up backups, gaining complete freedom and cost savings.
- You will deploy a full-fledged PaaS on your VPS, managed via a convenient web interface or CLI.
- Learn to automate application deployment from Git repositories with CI/CD support.
- Get free SSL certificates for all your applications thanks to integration with Let's Encrypt.
- Master the basic principles of server maintenance, backups, and troubleshooting.
- Save on cloud PaaS services while maintaining full control over infrastructure and data.
What we are setting up and why
In the modern world of application development, speed and ease of deployment play a key role. CapRover is a free and open-source PaaS (Platform as a Service) platform that transforms your VPS or dedicated server into a powerful environment for application hosting. Imagine Heroku or Netlify, but completely under your control and without monthly fees for each deployment.
CapRover allows developers to easily deploy any web applications (Node.js, Python, Ruby, PHP, Go, Java, and others), static sites, databases, and containerized services. It provides all the necessary tools: automatic SSL (via Let's Encrypt), CI/CD (continuous integration and delivery), scaling, monitoring, and domain name management. CapRover is built on Docker and Nginx, ensuring high performance and flexibility.
Ultimately, upon completing this guide, you will have a fully configured platform where you can deploy your projects in minutes. No more manually configuring Nginx, Docker Compose, or Let's Encrypt for each new application – CapRover will do it for you.
Alternatives and advantages of self-hosted
There are many alternatives on the market: from fully managed cloud PaaS services (Heroku, Vercel, Render, DigitalOcean App Platform) to lower-level solutions such as manual management of Docker containers or Kubernetes clusters. Why choose self-hosted CapRover on a VPS?
- Full control and data ownership: Your data and applications reside on your server, not with a third-party provider. This is critical for projects with high security requirements or regulatory compliance.
- Cost savings: Cloud PaaS services can quickly become expensive as a project grows. With CapRover, you only pay for the VPS, and the number of deployed applications is virtually unlimited. This is especially beneficial for developers launching many small projects or prototypes.
- Flexibility: Ability to install any Docker images, configure arbitrary environment variables, use custom
captain-definitionfiles for precise control over build and deployment. - Learning and experience: Setting up your own PaaS provides valuable experience working with Docker, Linux, network configurations, and system administration, enhancing your technical expertise.
- Vendor independence: You are not tied to the ecosystem of a single cloud provider, which gives you freedom of choice and migration.
Of course, a self-hosted solution requires more initial effort and minimal administration knowledge. However, CapRover significantly lowers this entry barrier by automating most complex tasks.
What VPS configuration is needed for this task
Choosing the right VPS is critically important for the stable and productive operation of CapRover and your applications. Requirements depend on the number and complexity of the services being deployed. Below are recommendations for 2026.
Minimum requirements
For a basic CapRover installation and running a few undemanding applications (e.g., a static site, a small API, a test database):
- CPU: 2 vCPU. This is sufficient for Docker, CapRover, and handling light traffic.
- RAM: 4 GB. Docker and CapRover themselves consume a significant portion of memory. 4 GB will be enough for a few lightweight Node.js or Python applications.
- Disk: 80 GB SSD (NVMe preferred). SSD is mandatory for Docker performance. 80 GB will allow storing several Docker images, logs, and application data. NVMe drives significantly speed up I/O operations.
- Network: 1 Gbit/s port with unlimited traffic or a large monthly limit (from 1 TB). A stable and fast network connection is important for deployment and application availability.
Recommended VPS plan for active development and multiple applications
If you plan to actively use CapRover for several medium-sized applications, including databases, or for projects with moderate traffic, consider the following configuration:
- CPU: 4 vCPU. Will provide sufficient performance during peak loads and for several parallel processes.
- RAM: 8 GB. Will comfortably accommodate several applications, databases, and have a reserve for system needs.
- Disk: 160-250 GB NVMe SSD. Enough space for a large number of Docker images, voluminous logs, and scalable application data. NVMe will significantly improve overall system responsiveness.
- Network: 1 Gbit/s port with unlimited traffic.
For renting a VPS with the specified characteristics, you can consider a VPS with such characteristics from a reliable provider.
When a dedicated server is needed, not a VPS
A dedicated server becomes necessary when:
- High performance: Your applications require maximum CPU, RAM, or I/O performance that a VPS cannot guarantee due to virtualization and "noisy neighbors."
- Large number of applications/users: You plan to host dozens of applications, serve thousands of concurrent users, or work with very large volumes of data.
- Specific hardware requirements: You need specialized hardware components (e.g., GPU for machine learning, RAID controllers for increased disk subsystem reliability).
- Strict security/compliance requirements: For some industries or data types, complete physical control over the hardware is necessary.
In most cases, for getting started with CapRover and even for many production projects, a powerful VPS will be more than sufficient and cost-effective. If you reach the limits of a VPS, you can always migrate to a suitable dedicated server.
VPS location: what it affects
The choice of VPS geographical location affects several key factors:
- Latency: The closer the server is to your target audience, the lower the latency and faster pages load for users.
- Legislation and privacy: Data storage and privacy laws can vary significantly in different countries. Choose a location that meets your requirements and those of your project.
- Bandwidth and peering: Some locations have better network connectivity with specific regions of the world. Check with your provider for peering information.
- Cost: VPS prices can vary depending on location due to differences in electricity costs, infrastructure, and taxes.
It is usually recommended to choose a location as close as possible to the majority of your users.
Server Preparation
After gaining access to your new VPS (assuming it's Ubuntu Server 24.04 LTS), you need to perform a series of basic configurations to enhance security and usability.
1. Connecting to the Server
First, connect to the server via SSH using the credentials provided by your VPS provider (usually the root user and password).
ssh root@YOUR_VPS_IP_ADDRESS
If this is your first connection, you might be asked to confirm the RSA key fingerprint.
2. System Update
Always start by updating the package list and installing all available updates. This ensures you have the latest versions of system utilities and security patches.
sudo apt update && sudo apt upgrade -y
This command will update the package cache and install all available updates without prompting for confirmation.
3. Creating a New User with Sudo Privileges
Operating as the root user is insecure. Create a new user for daily operations and grant them sudo privileges.
# Replace 'deployuser' with your desired username
adduser deployuser
Follow the prompts to set a password and fill in user information (you can leave it blank). Then, add the new user to the sudo group:
usermod -aG sudo deployuser
Now you can switch to the new user and continue working:
su - deployuser
Or, even better, open a new SSH connection as the new user to ensure everything is working:
exit
ssh deployuser@YOUR_VPS_IP_ADDRESS
4. Configuring SSH Key Authentication (Recommended)
SSH key authentication is much more secure than password authentication. If you don't have an SSH key yet, generate one on your local machine:
# On your local machine
ssh-keygen -t ed25519 -C "[email protected]"
Then, copy the public key to the server:
# On your local machine
ssh-copy-id deployuser@YOUR_VPS_IP_ADDRESS
If ssh-copy-id is not available, you can do it manually:
# On your local machine
cat ~/.ssh/id_ed25519.pub
# Copy the output, then on the server:
ssh deployuser@YOUR_VPS_IP_ADDRESS
mkdir -p ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys
# Paste the copied key and save the file (Ctrl+X, Y, Enter)
chmod 600 ~/.ssh/authorized_keys
exit
After successfully configuring the keys, disable password authentication for root and for deployuser (if you want to completely exclude password access). Edit the file /etc/ssh/sshd_config:
sudo nano /etc/ssh/sshd_config
Find and change the following lines (or add them if they don't exist):
# Disable root login with password
PermitRootLogin prohibit-password
# Disable password login for all users
PasswordAuthentication no
Restart the SSH service:
sudo systemctl restart sshd
IMPORTANT: Make sure you can log in with an SSH key before disabling password authentication. Otherwise, you risk losing access to the server.
5. Firewall Configuration (UFW)
UFW (Uncomplicated Firewall) is easy to configure and significantly enhances security. Allow only the necessary ports.
sudo apt install ufw -y # Install UFW
sudo ufw allow OpenSSH # Allow SSH (port 22)
sudo ufw allow http # Allow HTTP (port 80)
sudo ufw allow https # Allow HTTPS (port 443)
sudo ufw enable # Enable firewall
sudo ufw status # Check status
CapRover will use ports 80 and 443 for serving applications, so they must be opened. Port 3000 will be temporarily used for initial CapRover UI setup, but CapRover will reconfigure Nginx to 80/443 itself after domain setup.
6. Installing Fail2ban
Fail2ban protects the server from brute-force attacks by blocking IP addresses that have too many failed login attempts.
sudo apt install fail2ban -y # Install Fail2ban
sudo systemctl enable fail2ban # Enable autostart
sudo systemctl start fail2ban # Start the service
Fail2ban's basic configuration works "out of the box" for SSH. For more fine-grained settings, you can copy and edit the file /etc/fail2ban/jail.conf to /etc/fail2ban/jail.local.
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo nano /etc/fail2ban/jail.local
You can change bantime (ban time) or maxretry (number of failed attempts) in the [DEFAULT] section.
After these steps, your server will be ready for CapRover installation.
Software Installation — Step-by-Step
CapRover is entirely based on Docker, so the first step will be to install Docker Engine. We will also need Node.js and npm to install CapRover CLI.
1. Installing Docker Engine
To install the current version of Docker Engine (presumably Docker Engine 25.x or 26.x in 2026), we will use the official Docker installation script. This ensures you get the latest stable version.
# Update package list
sudo apt update
# Install necessary packages for using HTTPS with apt
sudo apt install ca-certificates curl gnupg -y
# Add Docker's official GPG key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# Add Docker repository to sources.list
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Update package list with the new Docker repository
sudo apt update
# Install Docker Engine, containerd, and Docker Compose
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
After installation, add your user to the docker group to run Docker commands without sudo:
# Replace 'deployuser' with your username
sudo usermod -aG docker deployuser
# For changes to take effect, either log out and log back in, or restart the session
# For example, you can simply exit SSH and reconnect
exit
ssh deployuser@YOUR_VPS_IP_ADDRESS
Verify that Docker is installed correctly:
docker run hello-world
You should see the message "Hello from Docker!".
2. Installing Node.js and npm
CapRover CLI (captain) is written in Node.js, so we will need Node.js and the npm package manager. We will use the current LTS version of Node.js (presumably Node.js 20.x or 22.x in 2026).
# Install Node.js LTS (e.g., 20.x, or a newer LTS relevant for 2026)
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
Verify Node.js and npm installation:
node -v # Should show v20.x.x or v22.x.x
npm -v # Should show npm version
3. Installing CapRover CLI (captain)
Now that Node.js and npm are installed, you can install the global CapRover CLI tool.
sudo npm install -g caprover
Verify CLI installation:
captain --version
You should see the CapRover CLI version number.
4. Deploying CapRover Server
The main component of CapRover is a Docker container that manages the entire PaaS infrastructure. Let's start it.
# Start CapRover container
# -p 80:80, -p 443:443: Open HTTP/HTTPS ports for applications
# -p 3000:80: Temporarily open port 3000 for CapRover UI access (inside container on 80)
# -v /var/run/docker.sock:/var/run/docker.sock: Allow CapRover to manage Docker on the host
# -v /var/caprover:/var/caprover: Save CapRover data on the host for persistence
# caprover/caprover: Use the official CapRover Docker image
sudo docker run -p 80:80 -p 443:443 -p 3000:80 -v /var/run/docker.sock:/var/run/docker.sock -v /var/caprover:/var/caprover caprover/caprover
This command will start CapRover in the background. If you want the container to restart automatically upon server reboot, add the --restart always flag:
# First, stop the previous container if it was started without --restart always
# sudo docker ps -a
# sudo docker stop
# sudo docker rm
# Then start with --restart always
sudo docker run -p 80:80 -p 443:443 -p 3000:80 -v /var/run/docker.sock:/var/run/docker.sock -v /var/caprover:/var/caprover --restart always --name caprover-main caprover/caprover
Ensure the CapRover container is running:
docker ps
You should see the caprover/caprover container in the list of running containers.
5. DNS Configuration
For CapRover to work, you will need a domain name (e.g., mydomain.com) and a subdomain for CapRover itself (e.g., captain.mydomain.com), as well as a wildcard subdomain for your applications (.mydomain.com). Go to your domain registrar's or DNS provider's control panel and create the following records:
- A Record:
- Host:
@(ormydomain.com) - Value:
YOUR_VPS_IP_ADDRESS
- Host:
- A Record:
- Host:
captain - Value:
YOUR_VPS_IP_ADDRESS
- Host:
- A Record:
- Host:
- Value:
YOUR_VPS_IP_ADDRESS
- Host:
DNS record propagation can take from a few minutes to several hours. You can check the propagation status using online tools like dnschecker.org.
At this stage, the main components are installed. Now let's move on to configuring CapRover via its web interface.
Configuration
After installing CapRover Server and configuring DNS, you can proceed with its initial configuration via the web interface, and then deploy applications.
1. Initial CapRover UI Setup
Open a web browser and navigate to http://YOUR_VPS_IP_ADDRESS:3000. You will see the CapRover welcome page.
- Set Administrator Password: Upon first access, you will be prompted to set a password for the CapRover administrator account. Choose a strong password.
- Configure CapRover Domain: After logging into the control panel, go to the "Cluster" section (or "Cluster Settings"). In the "Root Domain" field, enter your primary domain (e.g.,
mydomain.com). CapRover will automatically configurecaptain.mydomain.comfor its control panel. - Enable SSL: CapRover will automatically request and install free SSL certificates from Let's Encrypt for your root domain and all deployed applications. Ensure that DNS records have fully propagated, otherwise certificate acquisition may fail.
After successful domain and SSL configuration, access to the CapRover panel will be via https://captain.mydomain.com, and port 3000 will no longer be used directly (it will be redirected to 80/443).
2. Deploying Your First Application (Hello World Node.js)
Let's deploy a simple Node.js application to demonstrate the process.
Example Application (app.js):
const http = require('http');
const hostname = '0.0.0.0'; // Listen on all interfaces
const port = process.env.PORT || 3000; // Use port from environment variable or 3000
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello from CapRover on ' + process.env.CAPROVER_APP_NAME + '!\n');
});
server.listen(port, hostname, () => {
console.log(Server running at http://${hostname}:${port}/);
});
Example package.json:
{
"name": "my-first-caprover-app",
"version": "1.0.0",
"description": "A simple Node.js app for CapRover",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"author": "Your Name",
"license": "MIT"
}
Example .captain-definition (for CapRover):
Create a file named .captain-definition in the root of your project. This file tells CapRover how to build and deploy your application.
{
"schemaVersion": 1,
"templateId": "node-js-express",
"variables": []
}
For simple Node.js applications, CapRover can automatically detect the project type. If you have a more complex project or a different language, you can specify your own Dockerfile or use other templateIds.
Deployment via CLI:
On your local machine, in the application's root directory:
# Authorize with CapRover (requires CapRover URL and password)
captain login
# Create a new application in CapRover
# Replace 'myapp' with your desired application name
captain app create myapp
# Deploy the application from the current directory
# CapRover will automatically determine settings based on .captain-definition and package.json
captain deploy --appName myapp
After successful deployment, CapRover will provide you with a URL for your application (e.g., https://myapp.mydomain.com). An SSL certificate will be automatically issued.
Deployment via UI:
- Log in to the CapRover panel at
https://captain.mydomain.com. - Go to the "Apps" section and click "Create New App". Enter the application name (e.g.,
myapp). - Go to the settings of the created application. In the "Deployment" section, select "Tar File" or "Upload Git Repository". For a local folder, you can compress it into a
.taror.zipand upload it. Or connect to a Git repository. - After uploading, CapRover will start building and deploying. You can monitor the process in the application logs.
3. Managing Environment Variables
Use environment variables to configure applications and store secrets. This is safer than storing sensitive data in code or configuration files.
In the CapRover panel, in your application's settings, go to the "Environment Variables" section. Here you can add key-value pairs. For example, for database connection:
DB_HOST=my-database-serviceDB_USER=adminDB_PASSWORD=your_secret_password
After saving changes, CapRover will restart your application, and the new variables will be available. In Node.js, they are accessible via process.env.DB_HOST.
4. Configuring Persistent Storage
If your application needs to save data (e.g., uploaded files, user data) that should not disappear when the container restarts or updates, use CapRover's persistent volumes.
In the application settings, go to the "Persistent Apps" section. Here you can specify a path inside the container that will be mounted to persistent storage on the server.
# Example: mounting /app/data from the container to persistent storage
Container Path: /app/data
CapRover will create and manage this volume. Data written to /app/data inside the container will persist even after application updates.
5. Database Integration (One-Click Apps)
CapRover provides "One-Click Apps" for quickly deploying popular services such as PostgreSQL, MongoDB, Redis, MySQL. This significantly simplifies database setup for your application.
- In the CapRover panel, go to the "One-Click Apps" section.
- Select the desired database (e.g., "PostgreSQL").
- Enter the service name (e.g.,
my-pg-app) and click "Deploy".
CapRover will deploy the database as a separate application and provide environment variables for connection (e.g., PG_HOST, PG_USER, PG_PASSWORD). You can copy these variables and add them to your main application's settings.
6. Health Check
After deploying the application and configuring the domain, ensure that everything is working correctly:
- Open your application's URL (e.g.,
https://myapp.mydomain.com) in a browser. - Use
curlon the server to check availability:curl https://myapp.mydomain.comYou should receive a response from your application.
- Check application logs via the CapRover panel or CLI:
captain logs myappThis will help ensure the application starts without errors and handles requests.
- Check Docker container status:
docker psEnsure that your application container and CapRover containers are running.
Now you have a fully functional CapRover capable of hosting your applications.
Backups and Maintenance
Reliable backup and regular maintenance are key aspects for any production server. CapRover simplifies deployment, but the responsibility for data backups lies with you.
What to Back Up
- CapRover Configuration: All CapRover settings, SSL certificates, application information, and their environment variables are stored in the directory
/var/caprover. This is a critically important directory for restoring your entire PaaS. - Application Data: Any data that your applications save to CapRover's persistent volumes (configured in the "Persistent Apps" section). This data is usually located in subdirectories of
/var/caprover/appsor other locations where volumes are mounted. - Databases: If you use One-Click Apps for databases (PostgreSQL, MongoDB, etc.), their data also needs to be backed up. This is usually done using specific utilities for each DB (
pg_dumpfor PostgreSQL,mongodumpfor MongoDB). - Server Configs: If you have made any critical changes to system files (e.g.,
/etc/ssh/sshd_config, Nginx configuration if you are using it directly), these should also be backed up.
Backup Strategy and Tools
To automate backups, it is recommended to use cron for scheduling tasks and specialized tools for efficient storage and version management.
Popular backup tools:
- Restic: An excellent tool for deduplicated, encrypted backups to cloud storage (S3, Backblaze B2, SFTP).
- BorgBackup: Similar to Restic, supports deduplication and encryption, works well with local and remote SSH storage.
- rsync: Simple and effective for file synchronization, but does not provide deduplication or versioning "out of the box".
Let's consider an example script for restic, backing up the CapRover directory and PostgreSQL data to S3-compatible storage. We assume that restic is already installed (sudo apt install restic -y).
#!/bin/bash
# --- Backup Settings ---
# Restic repository URL (e.g., S3-compatible storage)
# Replace with your data
REPO="s3:s3.eu-central-1.amazonaws.com/your-caprover-backup-bucket"
# Path to Restic password file (create it with 600 permissions)
PASSWORD_FILE="/etc/restic/backup_password"
# Environment variables for S3 (if used)
export AWS_ACCESS_KEY_ID="YOUR_AWS_ACCESS_KEY_ID"
export AWS_SECRET_ACCESS_KEY="YOUR_AWS_SECRET_ACCESS_KEY"
# PostgreSQL application name (if One-Click App is used)
POSTGRES_APP_NAME="my-pg-app"
# Path for temporary DB dump
DUMP_FILE="/tmp/caprover_pg_dump.sql"
# --- Repository Initialization (run once manually) ---
# restic init --repo $REPO --password-file $PASSWORD_FILE
# --- CapRover config backup ---
echo "--- Starting CapRover config backup ($(date)) ---"
restic backup /var/caprover \
--repo $REPO \
--password-file $PASSWORD_FILE \
--tag caprover_config \
--exclude-file /etc/restic/exclude-caprover.txt \
--verbose
echo "--- CapRover config backup finished ---"
# --- PostgreSQL database backup (if application exists) ---
# Checking if the database container is running
if docker ps --format '{{.Names}}' | grep -q "${POSTGRES_APP_NAME}_db"; then
echo "--- Starting PostgreSQL database backup ($(date)) ---"
# Creating database dump
docker exec "${POSTGRES_APP_NAME}_db" pg_dumpall -U postgres > "$DUMP_FILE"
# Backing up the dump
restic backup "$DUMP_FILE" \
--repo $REPO \
--password-file $PASSWORD_FILE \
--tag ${POSTGRES_APP_NAME}_db \
--verbose
# Deleting temporary dump file
rm "$DUMP_FILE"
echo "--- PostgreSQL database backup finished ---"
else
echo "PostgreSQL app ${POSTGRES_APP_NAME} not found or not running. Skipping DB backup."
fi
# --- Cleaning up old snapshots (retention policy) ---
echo "--- Starting cleanup of old snapshots ($(date)) ---"
restic forget \
--repo $REPO \
--password-file $PASSWORD_FILE \
--prune \
--keep-hourly 24 \
--keep-daily 7 \
--keep-weekly 4 \
--keep-monthly 6 \
--keep-yearly 1
echo "--- Cleanup finished ---"
echo "--- Backup process completed ($(date)) ---"
Create the file /etc/restic/backup_password with your Restic password and set permissions sudo chmod 600 /etc/restic/backup_password.
Create the file /etc/restic/exclude-caprover.txt to exclude unnecessary files from the /var/caprover backup, for example, Docker caches:
/var/caprover/docker-cache
Save this script as /usr/local/bin/caprover_backup.sh and make it executable:
sudo nano /usr/local/bin/caprover_backup.sh # Paste the script
sudo chmod +x /usr/local/bin/caprover_backup.sh
Add a task to cron for daily execution:
sudo crontab -e
Add a line for daily backup, for example, at 03:00 AM:
0 3 * * * /usr/local/bin/caprover_backup.sh >> /var/log/caprover_backup.log 2>&1
Where to Store Backups
- Cloud Storage: S3-compatible services (AWS S3, DigitalOcean Spaces, Backblaze B2, MinIO) are the most reliable and scalable option. Store backups geographically separate from your VPS.
- Separate VPS: You can use a second, less powerful VPS exclusively for storing backups.
- Local Disk: If there are no other options, you can save backups to a separate disk partition on the VPS, but this will not protect against a complete server failure.
Updates: rolling vs maintenance window
Regular updates are important for security and new features. Different approaches apply to CapRover and Docker:
- CapRover Updates: CapRover can be updated to the latest version via CLI with the command
captain updateor through the web interface in the "Cluster" -> "Update CapRover" section. This usually does not require downtime and is a "rolling update". - Docker Updates: Docker Engine and Docker Compose updates are performed via the package manager (
sudo apt update && sudo apt upgrade -y). These updates may require restarting the Docker service, which will lead to brief downtime for all your applications. Plan this during a "maintenance window" when traffic is minimal. - OS Updates: Operating system (Ubuntu) updates are also performed via
apt. Major kernel or system component updates almost always require a server reboot, which also causes downtime. Plan these during a maintenance window.
Always test updates in a staging environment, if possible, before applying them to a production server.
Troubleshooting + FAQ
Even with the most careful setup, problems can arise. This section will help you diagnose and resolve the most common issues, as well as answer frequently asked questions.
CapRover UI is inaccessible at http://YOUR_VPS_IP_ADDRESS:3000
What to check:
- CapRover container status: Make sure the CapRover container is running.
- Firewall (UFW): Make sure port 3000 is open.
- Network connectivity: Check that your VPS is accessible from the internet (e.g., try pinging it).
sudo docker ps -a | grep caprover/caprover
If the container is not running or is in an "Exited" state, check the logs:
sudo docker logs caprover-main # Or container ID
sudo ufw status verbose
If port 3000 is not allowed, add a rule:
sudo ufw allow 3000/tcp
Application deployment fails with an error
What to check:
- Deployment logs: CapRover provides detailed logs of the build and deployment process. Available via the UI in the application section ("Logs" -> "Deployment Logs") or via CLI:
- Application logs: After deployment, if the application does not start, check its runtime logs.
.captain-definitionfile: Make sure the.captain-definitionfile is correct and meets your application's requirements (e.g., specifies the correcttemplateIdordockerfileLines).- Environment variables: Check that all necessary environment variables are set and available to the application.
- Server resources: Make sure the server has enough RAM and CPU. Insufficient memory often leads to failures when building Docker images.
captain deploy --appName myapp --log
captain logs myapp
Let's Encrypt SSL certificate is not issued or expires
What to check:
- DNS records: The most common reason. Make sure that A records for your main domain,
captain.yourdomain.com, and*.yourdomain.compoint to your VPS IP and have fully propagated. Use dnschecker.org. - Firewall: Ports 80 and 443 must be open for incoming connections, as Let's Encrypt uses them for domain ownership verification (ACME-challenge).
- Let's Encrypt limits: If you have frequently attempted to obtain certificates, you may have hit Let's Encrypt rate limits. Wait for some time.
- CapRover logs: Check CapRover system logs for errors related to ACME or Nginx.
sudo ufw status verbose
sudo docker logs caprover-main
Application runs slowly or crashes
What to check:
- VPS resources: Check CPU load, RAM usage, and disk I/O on your VPS.
- Application logs: Look for errors, memory leaks, or long-running operations in your application logs.
- Scaling: If the application is under heavy load, try increasing the number of application instances in CapRover settings.
- Code optimization: The problem might be in the application code itself, not the infrastructure.
htop # For interactive monitoring
df -h # For disk usage
How to connect your own database (not a One-Click App)?
If your database is deployed outside CapRover (e.g., on a separate server or in a managed cloud service), you can connect to it using environment variables.
In your CapRover application settings, under the "Environment Variables" section, add variables containing the connection details for your external DB (host, port, username, password, database name). For example:
DB_HOST=my-external-db.example.com
DB_PORT=5432
DB_USER=myuser
DB_PASSWORD=mypassword
DB_NAME=mydb
Then, use these variables in your application code to establish the connection.
What is the minimum suitable VPS configuration?
For a basic CapRover installation and a few undemanding applications (e.g., static websites, simple APIs), a VPS with 2 vCPU, 4 GB RAM, and an 80 GB SSD disk will be minimally suitable. This will be enough for familiarizing yourself with the platform and running small projects. However, for more serious tasks or several active applications, it is recommended to increase resources.
What to choose — VPS or dedicated for this task?
For most users, including developers, solo founders, and small teams, a VPS will be the optimal choice. It offers an excellent balance between cost, flexibility, and performance. A dedicated server should only be considered in cases of extremely high load, specific hardware requirements, strict regulatory norms, or when you have reached the scaling limits on the most powerful VPS.
How to scale an application in CapRover?
Scaling applications in CapRover is very simple. In the CapRover control panel, in your application settings, find the "Instances" section. Here you can specify the desired number of instances (containers) for your application. CapRover will automatically deploy and manage these instances, distributing the load among them. This allows you to easily increase your application's performance as traffic grows.
Conclusions and Next Steps
You have successfully deployed CapRover on your VPS, creating a powerful and flexible self-hosted PaaS. Now you have full control over your infrastructure, the ability to quickly deploy applications, databases, and services, and benefit from automatic SSL and CI/CD. This significantly simplifies the management of your project lifecycle, reduces operational costs, and provides valuable experience in the field of DevOps.
Here are a few steps you can take next:
- Explore additional CapRover features: Familiarize yourself with features such as webhooks for automatic deployment on Git push, custom domain setup for each application, resource monitoring, and other One-Click Apps.
- Deploy more complex projects: Try deploying a full-fledged full-stack application, including frontend, backend, and a database, using various programming languages and frameworks.
- Optimization and Security: Consider additional security measures for your applications and server. Optimize the configuration of CapRover and your applications to improve performance and save resources.
- Cluster Scaling: If a single VPS becomes insufficient, explore CapRover's capabilities for adding new nodes (servers) to your cluster for horizontal scaling.
CapRover is an excellent tool that allows you to be independent and efficient in managing your web projects. Continue to experiment, learn, and develop your skills!