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 pre-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.

Step 1: Update your server and install docker-compose

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

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

Step 2: Create a new Appwrite directory on your server

Create and enter a 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, use the following command:

Bash
curl -o docker-compose.yml https://raw.githubusercontent.com/appwrite/appwrite/master/docker-compose.yml
curl -o .env https://raw.githubusercontent.com/appwrite/appwrite/master/.env

Note: The Client URL (short: curl) is 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)
  • _APP_REDIS_PASSWORD: Redis password
  • _APP_DB_ROOT_PASSWORD: Database root password
  • _APP_USAGE_STATS: Enable/disable usage statistics

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.

Comments

Leave a Reply

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