DEV Community

Cover image for How to install appwrite on a hetzner cloud server in 8 steps
Gregor Davies
Gregor Davies

Posted on • Updated on

How to install appwrite on a hetzner cloud server in 8 steps

First of all, what is Appwrite? Well, let me tell you about this magical open-source secure and self-hosted backend for practically any programming language these days! It offers ways to implement users and authentication as well as an easy way to implement databases and many more. But most of all it lets you build fast.

Image description

In this tutorial, I will teach you how to install Appwrite on a Hetzner cloud server using docker. Although there are other ways to install appwrite personally I find the docker route to be by far the easiest and quickest way to get up and running without that much hassle. If you don’t know what docker is, just like Appwrite it’s magical and very versatile for many different use cases in the backend environment.

Image description

Your next question would probably be why Hetzner, not AWS? I can read your mind, can’t I? Well simply put AWS for this use case is more expensive than a Hetzner cloud server with a Hetzner server starting at just under 5 euros a month (Which is 5 dollars for you Americans) and an AWS EC2 server with the same specifications starting at 11 euros (11 dollars for you Americans) this is far cheaper and also your not supporting amazon. Which in my opinion is a win-win.

Image description

But using Hetzner does come with some downsides that AWS doesn’t have such as Hetzner servers often taking longer than AWS to deploy. Hetzner also has fewer locations/regions with most of Hetzner’s servers being located in Germany and Finland with Hetzner only recently starting to offer servers in America (But only as cloud servers no dedicated servers yet).

First, start by logging into your Hetzner account and the Hetzner cloud console (https://console.hetzner.cloud/). Create a project with whatever name you want it doesn’t hugely matter as only you will see it. On this page, you can also share your project with other teammates and friends and access the Hetzner API if you wish to make your Appwrite installation hyper-scalable.

Then deploy a server for my server I chose: Nuremberg as the location (Closest to my area), and Debian for the OS this is very important for the commands in this tutorial as they are Debian only, Standard for the type and CX11 for the server specifications, IPV6 for the IP's (As it’s cheaper) and the rest does not matter.

Image description

After creating and buying your server (This may take some time) copy your SSH keys and login into the server with your preferred SSH client. As always make sure you keep your SSH keys private and practice good opsec (strong passwords etc). If someone can access the server they can access your Appwrite installation and steal personal data such as your user's passwords and emails. A big no-no! Also if you don’t have an SSH client I personally recommend Termius (I’m not affiliated) as they have a free tier and an education tier for students and the UI is very clean.

Image description
(Practice good opsec, please! Comic courtesy of xkcd)

Next, we are going to set up docker on our server, but first, we need to update our server with security patches to make sure that our server is up to date against security vulnerabilities. Then after finishing updating your server (It may take some time like 10’s of minutes) we need to set up the required repository in Debian so Docker will work properly

sudo apt-get update

$ sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Enter fullscreen mode Exit fullscreen mode

(This updates the server and downloads the required prerequisites for docker).

Then we are going to add Docker's official GPG keys, GPG keys are how the server validates that the software hasn’t been intercepted by a malicious actor. As each GPG key has a unique public and private key which has to sign each release. However, that’s not hugely important info for us at the moment (Sorry for the tangent) so let’s install and apply it to our docker install with this command:

sudo mkdir -p /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg


Enter fullscreen mode Exit fullscreen mode

After that, we are going to install the Docker engine. The docker engine is the basis of every docker container dividing and splitting up the server's resources based on how much resources are allocated to each container. It can even be used to self-host other self-hosted applications but I will not go into that in this tutorial. To install docker-engine we will use this command:


sudo apt-get update
 $ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Enter fullscreen mode Exit fullscreen mode

Image description
(Don't do this! Another comic courtesy of xkcd.)

Next, we need to test whether or not docker is properly installed, this command below should print some text and then it will exit the container. If it doesn’t output any text then there is an error with your install of docker and you shouldn’t proceed with this tutorial until fixed. You can either ask for help in the comments and I will try to help you or you can refer to the official docker installation instructions for Debian (Found here: https://docs.docker.com/engine/install/debian/)

sudo docker run hello-world
Enter fullscreen mode Exit fullscreen mode

It seems like no matter what you do in programming you will always have to face a hello world program. Maybe when someone finally reaches mars it will switch to hello mars. But who knows?

Image description (See pictured my backend before appwrite.)

Next, we are going to set up the Appwrite Docker container using these simple commands! (I would recommend copying and pasting them as they are very long) If you don't trust me, this command is from the official installation instructions from the Appwrite documentation.

    docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ appwrite/appwrite:1.0.3

Enter fullscreen mode Exit fullscreen mode

Once the installation is done that’s it! You are good to go with a brilliant way to handle and manage your backend and databases with no extra subscriptions needed. If you did get stuck in this tutorial (Hopefully you didn’t) just leave a comment or just leave a comment about anything! Also while at it I would recommend joining the appwrite discord it’s a great resource and you hear about the appwrite news before anyone else! https://discord.gg/z8KjVahZJK

Image description

Top comments (0)