New Operators Tutorial
This tutorial assumes you understand the frequently asked questions as well as the moving parts of the technical problems Co-op Cloud solves. If yes, proceed
Deploy your first app¶
In order to deploy an app you need two things:
- a server with SSH access and a public IP address
- a domain name pointing to that server
This tutorial tries to help you make choices about which server and which DNS setup you need to run a Co-op Cloud deployment but it does not go into great depth about how to set up a new server.
Server setup¶
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. You may also be interested in this FAQ entry if you are curious about security in the context of containers.
Most Co-op Cloud deployments have been run on Debian machines so far. Some experiments have been done on single board computers & servers with low resource capacities.
You need to keep port :80
and :443
free on your server for web proxying to your apps. Typically, you don't need to keep any other ports free as the core web proxy (Traefik) keeps all app ports internal to its network. Sometimes however, you need to expose an app port when you need to use a transport which would perform better or more reliably without proxying.
abra
has support for creating servers (abra server new
) but that is a more advanced automation feature which is covered in the handbook. For this tutorial, we'll focus on the basics. Assuming you've managed to create a testing VPS with some $hosting_provider
, you'll need to install Docker, add your user to the Docker group & setup swarm mode:
You may need to log in/out
When running usermod ...
, you may need to (depending on your system) log
in and out again of your shell session to get the required permissions for
Docker.
# ssh into your server
ssh <server-domain>
# docker install convenience script
wget -O- https://get.docker.com | bash
# add user to docker group
sudo usermod -aG docker $USER
# exit and re-login to load the group
exit
ssh <server-domain>
# back on the server, setup swarm
docker swarm init
docker network create -d overlay proxy
# now you can exit and start using abra
exit
Do you support multiple web proxies?
We do not know if it is feasible and convenient to set things up on an existing server with another web proxy which uses ports :80
& :443
. We'd happily receive reports and documentation on how to do this if you manage to set it up!
DNS setup¶
You'll need two A records, one to point to the server 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.
How do I know my DNS is working?
You can use a tool like dig
on the command-line to check if your server has the necessary DNS records set up. Something like dig +short <domain>
should show the IP address of your server if things are working.
Install abra
¶
Now we can install abra
locally on your machine and hook it up to
your server. We support a script-based installation method (script source):
curl https://install.abra.coopcloud.tech | bash
The installer will verify the downloaded binary checksum. If you prefer, you can
manually verify the binary, and then
manally place it in one the directories in your $PATH
variable. To validate
that everything is working try listing the --help
command or -h
to view
output:
abra -h
You may need to add the ~/.local/bin/
directory to your $PATH
variable, in
order to run the executable. Also, run this line into your terminal so
you have immediate access to abra
on the current terminal.
export PATH=$PATH:$HOME/.local/bin
If you run into issues during installation, please report a ticket Once you're all set up, we highly recommend configuring command-line auto-completion for abra
. See abra autocomplete -h
for more on how to do this.
Can I install abra
on my server?
Yes, this is possible. However, the instructions for this setup are different. For more info see this handbook entry.
Add your server¶
Now you can connect abra
with your server. You must have a working SSH configuration for your server before you can proceed. That means you can run ssh <server-domain>
on your command-line and everything Works . See the abra
SSH troubleshooting for a working SSH configuration example.
Beware of SSH dragons
Under the hood abra
uses plain 'ol ssh
and aims to make use of your
existing SSH configurations in ~/.ssh/config
and interfaces with your
running ssh-agent
for password protected secret key files.
Running server add
with -d
or --debug
should help you debug what is
going on under the hood. ssh -v ...
should also help. If you're running
into SSH connection issues with abra
take a moment to read this
troubleshooting entry.
ssh <server-domain> # make sure it works
abra server add <server-domain>
It is important to note that <server-domain>
here is a publicy accessible domain name which points to your server IP address. abra
does make sure this is the case and this is done to avoid issues with HTTPS certificate rate limiting.
Can I use arbitrary server names?
Yes, this is possible. You need to pass -D
to server add
and ensure
that your Host ...
entry in your SSH configuration includes the name.
So, for example:
Host example.com example ...
And then:
abra server add -D example
You will now have a new ~/.abra/
folder on your local file system which stores all the configuration of your Co-op Cloud instance.
By now abra
should have registered this server as managed. To confirm this run:
abra server ls
How do I share my configs in ~/.abra
?
It's possible and quite easy, for more see this handbook entry.
Web proxy setup¶
In order to have your Co-op cloud deployment serve the public internet, we need to install the core web proxy, Traefik.
Traefik 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.
1. To get started, you'll need to create a new app:
abra app new traefik
Choose your newly registered server and specify a domain name. By default abra
will suggest <app-name>.server.org
or prompt you with a list of servers.
2. Configure this new traefix
app
You will want to take a look at your generated configuration and tweak the LETS_ENCRYPT_EMAIL
value. You can do that by running abra app config
:
abra app config <traefik-domain>
Every app you deploy will have one of these .env
files, which contains
variables which will be injected into app configurations when deployed. These
files exist at relevantly named path:
~/.abra/servers/<domain>/<traefik-domain>.env
Variables starting with #
are optional, others are required. Some things to
consider here is that by default our Traefik recipe exposes the metric
dashboard unauthenticated on the public internet at the URL <traefik-domain>
it is deployed to, which is not ideal. You can disable this with:
DASHBOARD_ENABLED=false
3. Now it is time to deploy your app:
abra app deploy <traefik-domain>
Voila. Abracadabra your first app is deployed
Deploy Nextcloud¶
And now we can deploy apps. Let's create a new Nextcloud app.
abra app new nextcloud -S
The -S
or --secrets
flag is used to generate secrets for the app: database connection password, root password and admin password.
Beware of password dragons
Take care, these secrets are only shown once on the terminal so make sure to take note of them! abra
makes use of the Docker secrets mechanism to ship these secrets securely to the server and store them as encrypted data. Only the apps themselves have access to the values from here on, they're placed in /run/secrets
on the container file system.
Then we can deploy Nextcloud:
abra app deploy <nextcloud-domain>
abra app deploy
will wait nearly a minute for an app to deploy until it times out and shows some helpful commands for how to debug what is going on. If things don't come up in time, try running the following:
abra app ps -w <nextcloud-domain> # status check
abra app logs <nextcloud-domain> # logs trailing
abra app errors -w <nextcloud-domain> # error catcher
Your new traefik
instance will detect that a new app is coming up and generate SSL certificates for it. You can see what traefik
is up to using the same commands above but replacing <netcloud-domain>
with the <traefik-domain>
you chose earlier (abra app ls
will remind you what domains you chose ).
Upgrade Nextcloud¶
To upgrade an app manually to the newest available version run:
abra app upgrade <nextcloud-domain>
Automatic Upgrades¶
kadabra
the auto-updater is still under development, use it with care and don't use it in production environments. To setup the auto-updater copy the kadabra
binary to the server and configure a cronjob for regular app upgrades. The following script will configure ssmtp for email notifications and setup a cronjob. This cronjob checks daily for new app versions, notifies if any kind of update is available and upgrades all apps to the latest patch/minor version.
apt install ssmtp
cat > /etc/ssmtp/ssmtp.conf << EOF
mailhub=$MAIL_SERVER:587
hostname=$MAIL_DOMAIN
AuthUser=$USER
AuthPass=$PASSWORD
FromLineOverride=yes
UseSTARTTLS=yes
EOF
cat > /etc/cron.d/abra_updater << EOF
MAILTO=admin@example.com
MAILFROM=noreply@example.com
0 6 * * * root ~/kadabra notify --major
30 4 * * * root ~/kadabra upgrade --all
EOF
Add ENABLE_AUTO_UPDATE=true
to the env config (abra app config <app name>
) to enable the auto-updater for a specific app.
Finishing up¶
Hopefully you got something running! Well done! The operators handbook would probably be the next place to go check out if you're looking for more help. Especially on topics of ongoing maintenance.
If not, please get in touch or raise a ticket and we'll try to help out. We want our operator onboarding to be as smooth as possible, so we do appreciate any feedback we receive.