docs.coopcloud.tech/docs/deploy.md

3.7 KiB

title
Deploy your first application

In order to deploy an application you need two things:

  1. a server (e.g. Hetzner VPS)
  2. a DNS provider (e.g. Gandi)

Create your server

Co-op Cloud has itself near zero system requirements. You only need to worry about the system resource usage of your apps and the overhead of running containers with the docker runtime (often negligible. If you want to know more, see this FAQ entry). We will deploy a new Nextcloud instance in this guide, so you will only need 1GB of RAM according to their documentation.

Wire up your DNS

Typically, you'll need two A records, one to point to the VPS itself and another to support sub-domains for the apps. You can then support an app hosted on your root domain (e.g. example.com) and other apps on sub-domains (e.g. foo.example.com, bar.example.com). Your entries in your DNS provider setup might look like the following.

@  1800 IN A 116.203.211.204
*. 1800 IN A 116.203.211.204

Where 116.203.211.204 can be replaced with the IP address of your server.

Install server prerequisites

On your server, you'll want to install Docker. This can be done by following the install documentation.

Bootstrap abra

Once your DNS and docker daemon are up, you can install abra locally on your developer machine and hook it up to your server.

Firstly, install abra locally.

$ curl https://install.abra.autonomic.zone | bash

The source for this script is here.

You may need to add the ~/.local/bin/ directory with your $PATH in order to run the executable.

$ export PATH=$PATH:$HOME/.local/bin
$ abra --help  # check it works

Now you can connect abra with your new server.

$ abra server add example.com

Where example.com is replaced with your identifier for your server DNS.

abra server add accepts also a <user> and <port> argument for your custom SSH connection details. What is happening here is that you are using the underlying SSH connection to make a secure connection to the server installed Docker daemon. This allows abra to run remote deployments from your local development machine.

Once you've added the sever, you can initialise the new single-host swarm.

$ abra server init example.com

You will now have a new ~/.abra/ folder on your local file system which stores all the configuration of your Co-op Cloud instance. You can easily share this as a git repository with others.

Deploy Traefik

In order to have your Co-op cloud installation automagically provision SSL certificates, we will first install Traefik. This tool is the main entrypoint for all web requests (e.g. like NGINX) and supports automatic SSL certificate configuration and other quality-of-life features which make deploying libre apps more enjoyable.

$ abra app new --server example.com --domain traefik.example.com traefik
$ abra app traefik.autonomic.zone deploy

Deploy Nextcloud

And now we can deploy apps. Go ahead and create a new nextcloud app, generate secrets and deploy it.

$ abra app new --server example.com --domain cloud.example.com nextcloud
$ abra app cloud.example.com secret generate --all
$ abra app cloud.autonomic.zone deploy

Your Traefik instance should now detect that a new app is coming up and generate SSL certificates for it.