Appified self-hosted deployments + Matrix server deployment

Photo by Markus Spiske / Unsplash

One of the biggest roadblocks that anyone will run into with installing a new self-hosted service on to their network is that there is such a large initial learning curve to setup the system. Introducing Cloudron! Cloudron has a built-in app store functionality with a library of apps that have already been configured for click to deploy functionality and Cloudron will even protect your site with a valid SSL certificate through a DNS ACME challenge with most large DNS providers such as CloudFlare, Route53 or several other large DNS providers out there.

If you’re hosting your systems in a cloud hosting provider such as Linode or Vultr, you will find the deployment of this system extremely easy as it is a native application available for deployment and all the ‘hard’ work of setting up Cloudron is already taken care of for you in this cloud hosted solution. If you’re like me though and you’re hosting your own systems, then I will take you through the steps required to get Cloudron up and running & I will provide some advice for app deployments that I don’t find in the official Cloudron documentation when I was setting up my own server.

Requirements:

  • Basic understanding of the Linux command line
  • Ubuntu 20.04.2 LTS (minimum of 1 GB of RAM & 20 GB of Disk space)
  • Internet access from your server
  • Not supported with running on an ARM based OS
  • Sign up for a cloudron.io account that we can use for the app store. Use this link for $30 in Cloudron credits: https://cloudron.io/?refcode=07c8f32582844613
  • Port forward 443 into your server
  • DNS hosting with a supported DNS Provider (see list of DNS providers here: Domains - Cloudron Docs). In this example, we are using Cloudflare.

Start off by downloading & installing your Ubuntu server (I would recommend a minimal install to preserve your precious resources) that you want to host Cloudron. SSH into the server when it’s built, and we’ll start off by installing a tool which allow our ubuntu machine to download the Cloudron setup file with the below command:

apt install wget

We’re already in a position where we are ready to install Cloudron from here onto our server. Below is the official documentation provided by Cloudron to initiate the installation with one minor change on the last command to ask it to run with “sudo” at the beginning. Once the command has finished executing, you will need to reboot your server.

wget https://cloudron.io/cloudron-setup

chmod +x cloudron-setup

sudo ./cloudron-setup

The above will take a little while to download docker images – don’t worry if this seems to get stuck here for several minutes. Once completed however, we now have Cloudron installed on our server, and we can start the configuration of the application. Browse to the IP address of your server in your web browser https://<x.x.x.x> to begin the configuration of your server (you will need to proceed through the warning about an invalid SSL certificate for the meantime). When you get through, you will be prompted to run through the domain setup which includes assigning an API key. I have listed these steps with a Cloudflare Global API key below (you can lock this down further by using a specifically generated API key if you’d like to implement principles of least privilege):

  1. Select “Advanced Settings” at the bottom of the setup page to see the full list of options available. You will need to make a decision as to whether or not you want to use wildcard certificates for securing the apps that you deploy on Cloudron – personally, I would suggest you use wildcards where possible as they’re more flexible.
  2. Browse to My Profile | Cloudflare - Web Performance & Security and copy your global API key then return to your Cloudron setup.
  3. Paste your global API key into the API Key/Token field and finish filling in the rest of the fields and hit “Next”. Once you’re done, it’ll look like the following screenshot.
Your settings should look similar to mine above but with your own domain name instead

Your Cloudron server will now issue a certificate for a subdomain named “my” and you’ll need to reload your page to https://my.yourdomain.com. Ensure that you have 443 forwarded through to your Cloudron server already and Cloudron will automatically create the required DNS record inside of your DNS hosting provider.

Create your administrator account to sign into the Cloudron server and proceed to the dashboard. You’ve now got Cloudron installed with all its base configuration for a basic setup of systems on your root domain configured. Before you can actually deploy anything from the app store with Cloudron however, you need to sign into the Cloudron app store. Sign in with this link to receive $30 in Cloudron service credits https://cloudron.io/?refcode=07c8f32582844613. If you're not interested in paying for this service, don’t worry! Cloudron allows installation and hosting of 2 apps for free forever.

Boom! You’re ready to deploy your first app onto your Cloudron server. Just click the app you want and hit Install!

I do have some footnotes regarding your Cloudron server that I learnt that hard way and might help you if you’re having any issues with some deployments. See below:

If you’re deploying Matrix or some other services (possible Mastadon) onto your root domain, you’ll be fine. If you’re trying to deploy these apps onto a subdomain however (matrix. Or mastadon. for example) then you’re going to have a nightmare with it seemingly working but lots of issues actually logging into these services. My recommendations are that you add a subdomain into your Cloudron server when deploying these services and configure them using the subdomain.

If you have already deployed Matrix onto your Cloudron server with the root domain but you’re getting errors when testing federation at Matrix Federation Tester and don’t want to redeploy it, you can fix it but you need to be really quick! I don’t recommend this as it might cause headaches down the line but you can follow these steps:

  1. Open up the configuration of the Matrix app on the Cloudron My Apps dashboard immediately after starting the app (you need to be really fast with these steps before Cloudron grabs the config and starts the web service for Matrix)
  2. Select “>_” to launch the terminal
  3. Run vi /app/data/configs/homeserver.yaml to edit your homeserver configuration
  4. Edit public_baseurl: to use your subdomain
  5. Edit auto_join_rooms: to use your subdomain
  6. Press “esc” and type :wq! then hit enter to save this config
  7. You should now be able to confirm your matrix server is working from here: Matrix Federation Tester

Good luck and enjoy the appified app deployments!

Nathan Gemmill

Nathan Gemmill