What is AppWrite?
Appwrite is an open-source self-hosted set of microservices that helps you build a backend for your Web or Mobile applications without starting from scratch as it abstracts and takes care of most of the complexities and intricacies involved in building a backend.
Appwrite is packaged as a docker container which you can easily set up using docker or docker-compose command from your terminal on either your local machine or cloud provider. On this post we are going to focus on deploying Appwrite on a local machine using docker.
Before running the installation command make sure you have Docker installed on your machine. We are not going to cover docker installation in this post however, you can read about docker’s installation here.
With the prerequisite covered, installing Appwrite is as easy as running the command below on your terminal.
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.7.2
There are a couple of inputs that will be required from you before the completing the installation, these inputs are to makes sure Appwrite runs smoothly and does not conflict with existing applications setup. In my case I had to change the default HTTP and HTTPS ports because port 80 and 443 were already taken by other applications.
If everything ran OK you should see the output below.
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.7.2 ... Starting Appwrite installation… Choose your server HTTP port: (default: 80) 8888 Choose your server HTTPS port: (default: 443) 543 Choose a secret API key, make sure to make a backup of your key in a secure location (default: 'your-secret-key') Enter your Appwrite hostname (default: 'localhost') Enter a DNS A record hostname to serve as a CNAME for your custom domains.\nYou can use the same value as used for the Appwrite hostname. (default: 'localhost') Running "docker-compose -f /usr/src/code/appwrite/docker-compose.yml up -d --remove-orphans --renew-anon-volumes" Appwrite installed successfully
Once the Docker installation completes, go to http://localhost to access the Appwrite console from your browser. The URL might vary depending on default port setting i.e. if you set your default port as 8888 like in my case go to http://localhost:8888
In case you are redirected to a HTTPS URL by Appwrite, you might get a security warning page. The reason why the warning page gets displayed is because Appwrite is using self-signed certificates and your browser doesn’t trust these certificates. You can bypass the page by ignoring the warning. On Firefox click on “Advanced…” then “Accept the risk and Continue” button. We doing this because its running locally however, in a production environment make sure your certificates are valid and trusted.
Installing Using docker-compose.yml file
To setup Appwrite manually, download the Appwrite base docker-compose.yml and .env files. After the download completes, update the different environment variables as you wish in the .env file and start the Appwrite stack using the following Docker command
docker-compose up -d --remove-orphans
If you are running a container management tool like Portainer you can easily checkout the varies services installed with Appwrite.
To install Portainer you can checkout this post.
Appwrite Doctor is a CLI tool available starting from Appwrite version 0.7 that allows you to debug and analyze your server health quickly. To analyze your Appwrite installation run the following command within the Appwrite folder where docker-compose.yml file is stored.
docker-compose exec appwrite doctor