Deploy and Host an Appwrite Docker Application
Tags: docker, cloud, devops
Published: 2022-05-13 12:36:29

This article was originally posted on [Hackmamba](https://hackmamba.io/blog/2022/04/deploy-and-host-an-appwrite-docker-application).

[Appwrite](https://appwrite.io/?utm_medium=hackmamba&utm_source=hackmamba) is a self-hosted open-source end-to-end backend server packaged as a set of Docker containers. Appwrite uses the Docker approach, which allows you to install and run it easily on any operating system (OS) that can run a Docker CLI. You can use [Appwrite](https://appwrite.io/?utm_medium=hackmamba&utm_source=hackmamba) on your local desktop or cloud provider.

This tutorial will walk you through deploying an [Appwrite](https://appwrite.io/?utm_medium=hackmamba&utm_source=hackmamba) instance on [Vultr](https://www.vultr.com/?utm_medium=hackmamba&utm_source=hackmamba) — a cloud provider. And at the end of the tutorial, you will have an [A](https://appwrite.io/?utm_medium=hackmamba&utm_source=hackmamba)[ppwrite](https://appwrite.io/?utm_medium=hackmamba&utm_source=hackmamba) instance you can access on the browser via an IP address or a set domain name.
With Appwrite, you focus on building the client facing portion of your application while Appwrite takes care of the storage, authentication, real-time events management, and other “business logic” operations.

## Prerequisites

To follow the steps in this article, you must have:

- Working knowledge of the terminal — This tutorial uses a terminal on a Linux distribution
- Basic knowledge of Docker
- A [Vultr](https://www.vultr.com/?utm_medium=hackmamba&utm_source=hackmamba) account with billing information added— Create one [here](https://www.vultr.com/?utm_medium=hackmamba&utm_source=hackmamba)


## Setting up a new Vultr Server

After successfully creating a Vultr account, you will see your Vultr dashboard. On your Vultr dashboard, navigate to the **Products** section; click on **Deploy Server** under the **Instances** tab.


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649085871051_annotely_image+4.png)



****After clicking on **Deploy Server**, you will see a new page with configuration options for the server you want to deploy. The first is the **Choose Server**

**Choosing a Server**


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649087136662_Screenshot+from+2022-04-04+16-45-20.png)


This tutorial uses the **Cloud Compute** server, a [Shared vCPU](https://www.e2enetworks.com/dedicated-cpu-vs-shared-vcpus/#:~:text=A%20shared%20vCPU%20(or%20Shared,or%20Virtual%20Central%20Processing%20Unit.)) server. You can choose a different server depending on what you want to build with your Appwrite instance. 


- The **Cloud Compute** server is suitable for low traffic applications. 
- The **Optimized Cloud Compute** is good for production websites, CI/CD, transcoding, large databases, etc.
- The **Bare Metal Servers** are suitable for apps with the most demanding performance or security requirements. 

To learn more about the different Vultr offers, check out the **Products** dropdown on the [Vultr homepage](https://www.vultr.com/).

The configuration options you will see after **Choose Server** depends on the server you choose, as some configurations are specific to a particular server type. 

For the **Cloud Compute** used in this tutorial, ****the next configuration is **CPU & Storage Technology.** 

**Choosing a CPU & Storage Technology**

![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649091337223_Screenshot+from+2022-04-04+17-55-15.png)


This tutorial uses **Regular Performance,** as seen in the image above. 

Next is the **Server Location,** which is generic to all **Choose server** options.

**Choosing a Server Location**

![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649091907822_Screenshot+from+2022-04-04+18-04-27.png)


There are a few factors you can consider when selecting a **Server Location**. One is your user’s location. See this [article](https://chemicloud.com/blog/server-location/) to learn more about choosing a server location.

Next, you will select an image for your server.

**Choosing a Server Image**
Under the **Server Image** configuration option, select the **Marketplace Apps** tab. Then you see a list of images. Because Appwrite uses Docker, select Docker. 

After selecting Docker, you will see two Linux distribution operating system options to install the Docker image. Select anyone. This tutorial uses “Ubuntu 20.04 x64”.


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649092451211_Screenshot+from+2022-04-04+18-13-46.png)


Next, you will choose the server size.

**Choosing a Server size**
In choosing the **Server size,** you must select a size that Appwrite can run on without error. The minimum requirement to run Appwrite, as stated in its [installation docs,](https://appwrite.io/docs/installation) is **1 CPU core** and **2GB of RAM.** 


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649093265420_Screenshot+from+2022-04-04+18-27-12.png)


This tutorial uses a Vultr **Server size** close to Appwrite’s minimum. 

Next, you can decide to enable Automatic Backups of your data or other additional features for your servers.


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649093456138_Screenshot+from+2022-04-04+18-29-35.png)


Next is the **SSH keys** configuration. 


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649094107522_Screenshot+from+2022-04-04+18-41-35.png)


You need an SSH key to access your server remotely from any machine, such as your computer, via a secured shell (SSH). You can also access your server via a web console provided by Vultr, but this tutorial uses SSH.

**Creating an SSH Key**
On any Linux, macOS, and Windows Subsystem for Linux machine, an SSH client ([OpenSSH](https://www.openssh.com/)) comes pre-installed. Windows users without OpenSSH can install [PuTTY](https://www.putty.org/) instead. 

To create an SSH key, open your terminal and run the following command:

```bash
$ ssh-keygen
```
You will see a prompt to save and name the key.

![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649102154916_Screenshot+from+2022-04-04+20-54-42.png)


Next, you will create and confirm a passphrase for the key (highly recommended):

![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649102170285_Screenshot+from+2022-04-04+20-55-27.png)


After which SSH will generate two files, by default, called `id_rsa` and `id_rsa.pub`. 

![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649102439348_annotely_image+5.png)


To see and copy the SSH key created, run the following command:

```bash
$ cat ~/.ssh/id_rsa.pub
```
For a more detailed guide, see [How Do I Generate SSH Keys?](https://www.vultr.com/docs/how-do-i-generate-ssh-keys/).

After you’ve copied the SSH key, click on **Add New** in the **SSH keys** section**.** Then name the SSH key and add the copied key in the text area.


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649106261922_Screenshot+from+2022-04-04+22-04-11.png)


Next, you name the server.

**Server Hostname & Label**

![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649106591518_Screenshot+from+2022-04-04+22-09-06.png)


After all the above configurations, you will see your **Servers Qty** and cost **Summary** and can deploy by clicking **Deploy Now**.


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649106885804_Screenshot+from+2022-04-04+22-13-35.png)


A few minutes after clicking on **Deploy Now,** you will have a **Running** Docker image server based on Ubuntu 20.04 x64 OS.


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649107299584_Screenshot+from+2022-04-04+22-21-19.png)


Now, you can deploy an Appwrite instance on the Vultr server.


## Deploying an Appwrite instance on Vultr

On the **Products** page, click on the server you just created:


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649107642724_Screenshot+from+2022-04-04+22-27-07.png)


On the page in the image above, you can view the server's usage and do further configurations and settings. Also, you can access the server via the web console on the top right corner:


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649108053286_annotely_image+6.png)


Next, you will access the server remotely using the SSH key you created.

To access it remotely via your computer, open the terminal and run the following command:

```bash
$ ssh root@<IP_Address_of_the_server>
```
The above command uses SSH to log in to the server via the server **IP Address** with the **Username** `root`. 

You will then get a few prompts to verify your connection. The first prompt will be to ensure the authenticity of the host (the **IP Address**). 


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649109180719_annotely_image+7.png)

![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649108703124_Screenshot+from+2022-04-04+22-43-20.png)


Answer with a **yes.** And the next one will be to input the host (server) password. 


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649109194357_Screenshot+from+2022-04-04+22-45-41.png)


You can copy the `root` password from the server page, as seen for the ****above **IP Address** and **Username** screenshot.

After entering the password, you can now run the Appwrite Docker installer CLI tool to create the Appwrite instance on your Vultr server. 


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649146479560_Screenshot+from+2022-04-05+09-14-21.png)


To create an Appwrite instance, run the following command:

```bash
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:0.13.4
```
The above command pulls the Appwrite image from [Docker Hub](https://hub.docker.com/r/appwrite/appwrite). The command starts the Appwrite installation process, opening up an interactive console that takes inputs for the  [Appwrite](https://github.com/appwrite/appwrite/blob/master/docker-compose.yml) `[docker-compose.yml](https://github.com/appwrite/appwrite/blob/master/docker-compose.yml)` [file](https://github.com/appwrite/appwrite/blob/master/docker-compose.yml)’s configuration.

Your secure shell output will be similar to the image below:

![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649147108376_Screenshot+from+2022-04-05+09-24-46.png)


Next, you will follow the prompts to complete Appwrite's installation process.

**Completing the Appwrite installation process**
Once the installation process begins, you will get a few prompts to configure your Appwrite installation.

**Prompt 1:**
**Choose your server HTTP port: (default: 80).** If your server’s port 80 is free, press "**enter"** to add the default port. Else, choose a different port, e.g.,79

**Prompt 2:**
**Choose your server HTTPS port: (default: 443).** If your server’s port 443 is free, press "**enter"** to add the default port. Else, choose a different port, e.g., 445

**Prompt 3:**
**Choose a secret API key (default: 'your-secret-key').** Whatever secret key you choose, make sure you backup it up securely.

**Prompt 4:**
**Enter your Appwrite hostname (default: 'localhost/IP Address').** In this case, if you have a domain, e.g., `appwritetestinstance.com`, input it. If not, press "**enter"** to use the server IP Address.

**Prompt 5:**
**Enter a DNS A record hostname to serve as a CNAME for your custom domains.** You can use the same input as your **Appwrite hostname** with default as the server IP Address.

After all your inputs, the Appwrite installer creates a custom `docker-compose.yml` file for your Appwrite installation.


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649148395399_annotely_image+10.png)


The annotated section in the above image shows that the created `docker-compose.yml` file is running and setting up the Docker containers that make up Appwrite.

After some time, you will get the output “**Appwrite installed successfully.”**

![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649148539755_Screenshot+from+2022-04-05+09-48-37.png)


Now, you’ve successfully deployed an Appwrite on Vultr. To see your Appwrite instance, open a browser and visit the server’s **IP Address**, e.g.,`95.179.203.84`. You should then see Appwrite’s sign-up page.


![](https://paper-attachments.dropbox.com/s_D38181D3EA6E723F689310D04A5962755E322D116FA6633BF5DF6A9FE731022F_1649149174737_annotely_image+11.png)


You can map a domain or subdomain to the **IP Address.** To learn more, see [Introduction to Vultr DNS](https://www.vultr.com/docs/introduction-to-vultr-dns/) and [How do you point a subdomain to a different IP address?](https://www.quora.com/How-do-you-point-a-subdomain-to-a-different-IP-address)

## Conclusion

In this tutorial, you learned how to set up a server on [Vultr](https://www.vultr.com/?utm_medium=hackmamba&utm_source=hackmamba) and, more importantly, deploy an [Appwrite](https://www.appwrite.io/?utm_medium=hackmamba&utm_source=hackmamba) instance to the Vultr server. 

## Resources

To learn more about Vultr and Appwrite, check out the following resources:

- [Vultr Documentation](https://www.vultr.com/docs/?utm_medium=hackmamba&utm_source=hackmamba)
- [Appwrite documentation](https://appwrite.io/docs)
- [Create a local Appwrite instance in 3 steps](https://dev.to/hackmamba/create-a-local-appwrite-instance-in-3-steps-19n9)
- [Appwrite codebase on GitHub](https://github.com/appwrite/appwrite)