Get Rewarded! We will reward you with up to €50 credit on your account for every tutorial that you write and we publish!

Installing CapRover on Hetzner Cloud

profile picture
Author
Kedas
Published
2021-10-22
Time to read
4 minutes reading time

This tutorial was updated by jtrugman

Introduction

CapRover is a sleek new way to easily deploy your own apps or an app from their large selection to a Cloud Server. CapRover has a nice web panel to manage your installation, view metrics, and launch new apps. I wouldn't recommend this if you have multiple people who need to connect to one server, due to there being only one login.

Prerequisites

  • A fresh Hetzner Cloud server running Ubuntu 20.04 or Ubuntu 22.04 that you have shell access to
  • Any domain

CapRover's recommended stack is Ubuntu 20.04 and Docker 19.03

Step 1 - Install Docker

Since CapRover runs on Docker, we'll need to install it.

First - Update your server and install the required packages by running these commands: (Make sure you're logged into the root user, as this tutorial assumes you are)

apt-get update
apt-get upgrade -y
apt-get install curl -y

Now we can proceed to installing Docker:

apt install docker.io

This command will install the latest version of Docker. You could now move on to running CapRover.

Step 2 - Connect your domain

CapRover can run on both a root domain (EX: *.example.com) and a subdomain (EX: *.foo.example.com).

Go to your domain's DNS management panel and create a new A record pointing to your server's IP address:

  • TYPE: A record
  • HOST: * (If you're using a subdomain set this to *.<subdomain_name>)
  • POINTS TO: (IP address of your server)
  • TTL: (Use the default TTL, or set it to 3600)

To verify that you correctly configured your domain, visit https://mxtoolbox.com/DNSLookup.aspx, input foobar.<your_domain.com> (foobar.<subdomain_name>.<your_domain.com> if you used a subdomain) and check if the domain resolves to the IP address you configured in your DNS settings. DNS propagation can take a few minutes, so if it doesn't work, just wait some more. It should take under 30 minutes for DNS to fully propagate.

Note: It is critical that a wild card * is assigned to the HOST in the A record. This allows CapRover to create unique addresses for your application(s) running on the server.

Step 3 - Run CapRover

CapRover simply runs on top of Docker, making it very modular, and can be installed with one command:

docker run -p 80:80 -p 443:443 -p 3000:3000 -e ACCEPTED_TERMS=true -v /var/run/docker.sock:/var/run/docker.sock -v /captain:/captain caprover/caprover

Do not change the port mappings, as CapRover will not be able to run on different ports.

Step 4 - Setup CapRover

Once the previous command has completed, and you waited 60 seconds for CapRover to fully start, you can attempt to login to the dashboard. You can find it at http://captain.<your_domain.com>:3000/ (http://captain.<subdomain_name>.<your_domain.com>:3000/ if you used a subdomain). Note: you should only use this URL for the initial setup.

CapRover Login Screen

The default password is captain42 - you should change it later

When you login you'll be greeted by the dashboard:

CapRover Initial Dashboard

Enter your domain (or subdomain) and press "Update Domain". You'll be redirected to http://captain.<your_domain.com> - this is where you can now access your dashboard. Press "Enable HTTPS". Enter your email address in the popup (this is required for the Let's Encrypt certificate). Once it's done you can press "Force HTTPS" to make sure every request is redirected to https://

Lastly, don't forget to set a new password by going to "Settings" and filling out the "Change Password" form!

Conclusion

You know have a working CapRover instance 🎉! You can use their amazing docs to learn how to deploy existing One-Click Apps, or your own:

Enabling NetData Monitoring: https://caprover.com/docs/resource-monitoring.html

Deploying a OneClick App: https://caprover.com/docs/one-click-apps.html

Deployment Methods: https://caprover.com/docs/deployment-methods.html

License: MIT
Want to contribute?

Get Rewarded: Get up to €50 in credit! Be a part of the community and contribute. Do it for the money. Do it for the bragging rights. And do it to teach others!

Report Issue
Try Hetzner Cloud

Get 20€ free credit!

Valid until: 31 December 2024 Valid for: 3 months and only for new customers
Get started
Want to contribute?

Get Rewarded: Get up to €50 credit on your account for every tutorial you write and we publish!

Find out more