Divine Odazie
6 min readApr 23 2022
Deploy and Host an Appwrite Docker Application
Appwrite 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 quickly on any operating system (OS) that can run a Docker CLI. You can use Appwrite on your local machine or a cloud provider.
This tutorial will walk you through deploying an Appwrite instance on Vultr — a cloud provider. And at the end of the tutorial, you will have an Appwrite 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 account with billing information added— Create one here
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.
****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
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 suitable 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.
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 following configuration is CPU & Storage Technology.
Choosing a CPU & Storage Technology
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
There are a few factors you can consider when selecting a Server Location. One is your user’s location. See this article 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”.
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, is 1 CPU core and 2GB of RAM.
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.
Next is the SSH keys configuration.
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) comes pre-installed. Windows users without OpenSSH can install PuTTY instead.
To create an SSH key, open your terminal and run the following command:
$ ssh-keygen
You will see a prompt to save and name the key.
Next, you will create and confirm a passphrase for the key (highly recommended):
After which SSH will generate two files, by default, called id_rsa
and id_rsa.pub
.
To see and copy the SSH key created, run the following command:
$ cat ~/.ssh/id_rsa.pub
For a more detailed guide, see 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.
Next, you name the server.
Server Hostname & Label
After all the above configurations, you will see your Servers Qty and cost Summary and can deploy by clicking Deploy Now.
A few minutes after clicking on Deploy Now, you will have a Running Docker image server based on Ubuntu 20.04 x64 OS.
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:
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:
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:
$ 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).
Answer with a yes. And the next one will be to input the host (server) password.
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.
To create an Appwrite instance, run the following command:
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. The command starts the Appwrite installation process, opening up an interactive console that takes inputs for the Appwrite [docker-compose.yml](https://github.com/appwrite/appwrite/blob/master/docker-compose.yml)
file’s configuration.
Your secure shell output will be similar to the image below:
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.
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.”
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.
You can map a domain or subdomain to the IP Address. To learn more, see Introduction to Vultr DNS and 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 and, more importantly, deploy an Appwrite instance to the Vultr server.
Resources
To learn more about Vultr and Appwrite, check out the following resources:
- Vultr Documentation
- Appwrite documentation
- Create a local Appwrite instance in 3 steps
- Appwrite codebase on GitHub
About the author
Consistency is key. That’s what Divine believes in and he says he benefits from that fact which is why he tries to be consistent in whatever he does. Divine is currently a Developer Advocate and Technical Writer who spends his days’ building, writing, and contributing to open-source software.days
More articles
Akshat Virmani
6 min readAug 24 2024
How to add GitHub Copilot in VS Code
Learn how to add GitHub Copilot to Visual Studio Code for AI-assisted coding. Boost productivity, reduce errors, and get intelligent code suggestions in seconds.
Read Blog
Akshat Virmani
6 min readAug 09 2024
Common API Integration Challenges and How to Overcome Them
Discover common API integration challenges and practical solutions. Learn how to optimize testing, debugging, and security to streamline your API processes efficiently.
Read Blog
Akshat Virmani
6 min readJun 20 2024
Web Scraping using Node.js and Puppeteer
Step-by-step tutorial on using Node.js and Puppeteer to scrape web data, including setup, code examples, and best practices.
Read Blog