Setting CapRover Up With OpenStack
Why OpenStack?
OpenStack is the most popular alternative to proprietary infrastructure-as-a-service (IaaS) cloud standards. Both huge cloud providers like AWS and Azure as well as some smaller ones like Hetzner have their own distinct APIs, configurations, and naming conventions for deploying resources. OpenStack allows you to deploy the same way on any cloud that implements the OpenStack standard (or even roll your own), thereby escaping vendor lock-in.
Set up an OpenStack provider
A number of cloud providers support OpenStack, including Infomaniak, VEXXHOST, OVHcloud, SharkTech, and more.
Out of the providers I've seen, Infomaniak has the best documentation.
You should follow your provider's instructions for getting the cloud.yaml file for connection the OpenStack CLI to the cloud project.
Here's a brief summary of the steps for Infomaniak. See their documentation for more details, including screenshots. Steps for other providers should be similar.
- Create a new project in your public cloud dashboard. Call the project something like
caprover-prod
. - When prompted, generate and set a password for the OpenStack user.
- Go to "Manage users" for the project. Click the dropdown next to the only user (starting with PCU-...) and download the clouds.yaml file.
- Move
clouds.yaml
to a location where the OpenStack client will be able to find it, i.e..config/openstack/clouds.yaml
in your home directory. If you've already set up the file before, copy and append the configuration to your existing file. - Open up your
clouds.yaml
file and change the cloud name fromPCP-...
to something more human-readable likeinfomaniak-prod
. This will let you keep adding to your file as you add more environments or even other OpenStack providers. - Also insert the password you've generated in step 2 into the file.
Install the OpenStack CLI and validate the connection
- Install the OpenStack command line client.
The official OpenStack instructions
would have you install the client via
pip
, but it's a lot cleaner to use pipx instead to avoid polluting your global Python package space:pip install pipx pipx install python-openstackclient pipx inject python-openstackclient python-heatclient
- Validate the connection with the command:
(Note: in this and following commands, replaceopenstack --os-cloud mycloud project list
mycloud
with the actual name you've set up in clouds.yaml, such asvexxhost-dev
orinfomaniak-prod
). This should display your default project name.
Deploy the OpenStack Heat template file
- You'll need to generate a key to be able to SSH into your CapRover server if needed.
You can create the folder
~/.ssh/openstack
or store your key wherever you like.openstack --os-cloud mycloud keypair create caprover > ~/.ssh/openstack/mycloud.priv chmod 600 ~/.ssh/openstack/mycloud.priv
- Many OpenStack providers supply a default set of VM images.
Check available images with
It's recommended to grab the latest version of Ubuntu LTS. You can also upload your own image by following the instructions here.openstack --os-cloud mycloud image list
- Check available flavors with
openstack --os-cloud mycloud flavor list
- Check available networks with
openstack --os-cloud mycloud network list
- Finally, put all the pieces together to deploy CapRover. Be sure to replace the placeholder values with your own.
For example, the following works on Infomaniak:openstack --os-cloud mycloud stack create -t https://raw.githubusercontent.com/caprover/caprover/master/dev-scripts/openstack/single-instance.yml --parameter image_id=<Ubuntu image ID> --parameter instance_type=<flavor> --parameter network=<network> caprover
openstack --os-cloud infomaniak-dev stack create -t https://raw.githubusercontent.com/caprover/caprover/master/se
tup/openstack/single-instance.yml --parameter image_id="Ubuntu 22.04 LTS Jammy Jellyfish" --parameter instance_type=a1-ram2-disk20-perf1 --parameter network=ext-net1 caprover ```
Validate the deployment
- Log in to your OpenStack dashboard web UI.
- Open Instances. You should see the instance
caprover-caprover_manager-...
. Copy its IP address. - You should be able to see the CapRover dashboard in your browser at
<IP address>:3000
. From this point you should be able to finish setting up CapRover using the instructions in Getting Started - You can also SSH into the instance with the command:
After you're in, you can browse the output of the installation process from the Heat template with the commandssh -i ~/.ssh/openstack/mycloud-prod.priv -o StrictHostKeyChecking=accept-new ubuntu@<CapRover manager IP>
sudo less /var/log/cloud-init-output.log
.