Home » Blog » How to self-host Appwrite using Docker

How to self-host Appwrite using Docker

Appwrite is a free and open-source Backend-as-a-Service (BaaS), serving as an alternative to Firebase, that can be self-hosted. This guide will walk you through the steps to deploy Appwrite using Docker.

What you need

You need an up-to-date version of Docker and Docker Compose, installed on your web-server (e.g., running on Ubuntu 20.04) and a domain, pointed to your server’s IP address.

  • Docker installed on your server
  • A domain name pointed to your server’s IP address

Note: We’ll use Hetzner Cloud as our hosting provider, but you can use any other provider as well.

Self-host Appwrite

Step 1: Update your server and install docker-compose

Simply copy and paste the code below into your cmd/terminal and follow the instructions.

Bash
apt update && apt -y upgrade
apt install docker-compose-plugin

Note: We have Docker pre-installed on our server, by using the Docker CE app image inside Hetzner Cloud. Hence, we only need to install the docker-compose-plugin package.

Step 2: Create a new Appwrite directory on your server

Create and enter directory for the Appwrite installation, by running this command:

Bash
mkdir appwrite
cd appwrite

Note: The command mkdir creates the new directory (named Appwrite) while cd enters it.

Step 3: Download the required Appwrite configuration files

You require two files, the docker-compose.yml file and the .env file, in order to properly run Appwrite. To download the required files, just use the following command:

Bash
curl -L https://appwrite.io/install/compose -o docker-compose.yml
curl -L https://appwrite.io/install/env -o .env

Note: The Client URL (short: curl) a command line tool for file transfer with a URL syntax.

Step 4: Open .env file to modify environment variables

Use your preferred text editor (nano shown here), to modify environment variables and their values.

Bash
nano .env

Common environment variables you might want to modify in .env:

  • _APP_ENV: Set to ‘production’ for production environment
  • _APP_DOMAIN: Your domain name (e.g., https://app.example.com (make sure to point your domain to your server’s IP address))
  • _APP_REDIS_PASSWORD: Redis password
  • _APP_DB_ROOT_PASSWORD: Database root password
  • _APP_USAGE_STATS: Enable/disable usage statistics

Step 5: Get Appwrite up and running

Finally, start all the Docker containers to get Appwrite up and running, using the following command:

Bash
docker compose up -d --remove-orphans

Congratulations, you’re done! ✨

FAQ

What is Appwrite?

Appwrite is an open-source Backend-as-a-Service (BaaS) platform designed to simplify and accelerate backend development for web, mobile, and server applications. Positioned as an open-source alternative to Firebase, Appwrite provides a robust suite of features, including a secure database, user authentication, real-time updates, file storage, cloud functions, and more. Its modular architecture and self-hosting capabilities empower developers to create scalable, secure backends while avoiding vendor lock-in.

Is Appwrite free to use?

Yes, Appwrite is completely free and open-source, licensed under the BSD-3-Clause. You can self-host Appwrite without any subscription fees, and its active community continuously contributes to its development.

What are the system requirements for self-hosting Appwrite?

Minimum requirements:
4GB RAM
2 CPU cores
20GB storage (expandable based on database and file storage needs)
Docker (Appwrite runs entirely as Docker containers)
For self-hosting Appwrite, you need a Docker-compatible environment since all its services, such as authentication, database, and storage, are containerized. For production use, scaling resources beyond the minimum—especially for handling high traffic or workloads—is recommended.

Comments

2 responses to “How to self-host Appwrite using Docker”

  1. Praveen G Avatar

    This is really helpful, there were no good articles on self-hosting Appwrite. Thanks man

    1. Glad I could help!

Leave a Reply

Your email address will not be published. Required fields are marked *