Running Caprover on Hetzner
Author: sebb
Published: 11/12/2022
Introduction
This blog and everything running on sebb.fr is running on Hetzner Cloud using caprover. If you would like to do the same, here is how to install it.
Setting up Hetzner
First you will need to create a server using Hetzner Cloud. You can use this referral link if you want to help this website. Caprover
Create a server
- Create a project or use the default one.
- Add a server
- Select the server configuration
Option | Value |
---|---|
Location | you can choose whatever |
Image | Ubuntu 20.04 |
Type | Standard cx21 |
Networking | IPv4 and Ipv6 |
SSH keys | recommended |
Firewall | TCP : 22 (SSH), 80 (HTTP), 443 (HTTPS), 993 (Caprover internal registry) firewall |
- Create and Buy now
Update your server
Once your server is ready, connect to it using your preferred method.
apt-get update
apt-get upgrade -y
apt-get install curl -y
Install docker
bash <(curl -s https://get.docker.com/)
Setting up the domain
Using your domain provider DNS console, create a record towards your server IP.
Option | Value |
---|---|
Subdomain | *.<domain>.<tld> |
TYPE | A |
TTL | Default / 3600 |
Target | <ip-address-of-your-server> |
If you want to have your site to respond on: https://wwww.domain.tld then you need to set up an other subdomain.
Option | Value |
---|---|
Subdomain | *.<subdomain>.<domain>.<tld> (*.myapps.<domain>.<tld>) |
TYPE | A |
TTL | Default / 3600 |
Target | <ip-address-of-your-server> |
You can verify that your DNS is correctly set up using: this.
And try with whatever.<subdomain>.<domain>.<tld>
and whatever.<domain>.<tld>
Install / Run caprover
docker run -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock -v /captain:/captain caprover/caprover
Set up caprover
After waiting a couple of minute, your can connect to your admin page.
http://captain.<subdomain>.<domain>.<tld>:3000/
You can login to your admin console with the default password captain42
.
Change the default password
Go to the Settings
and change the default password by your secure password.
Conclusion
Go to the Dashboard
and set up your domain.
<subdomain>.<domain>.<tld>
Then Enable HTTPS
and Force HTTPS
This is it! you can now enjoy caprover and deploy whatever application you would like.