Skip to content

Instantly share code, notes, and snippets.

@anoochit
Created February 12, 2025 06:07
Show Gist options
  • Save anoochit/2cb1a30dd53ede20ecac7867480fa61f to your computer and use it in GitHub Desktop.
Save anoochit/2cb1a30dd53ede20ecac7867480fa61f to your computer and use it in GitHub Desktop.
Install Appwrite using Docker with custom domain

To install Appwrite using Docker with a custom domain, follow these steps:


1. Install Docker & Docker Compose

Ensure that Docker and Docker Compose are installed on your server.

sudo apt update && sudo apt install -y docker.io docker-compose

Verify installation:

docker --version
docker-compose --version

2. Download and Set Up Appwrite

Pull the Appwrite setup script:

curl -sL https://appwrite.io/install | bash

Or manually clone the repository:

git clone https://github.com/appwrite/appwrite.git
cd appwrite

3. Configure Environment for Custom Domain

Modify the .env file:

cp .env.example .env
nano .env

Update these values to match your custom domain:

_APP_DOMAIN=yourdomain.com
_APP_DOMAIN_TARGET=yourdomain.com
_APP_CONSOLE_DOMAIN=console.yourdomain.com
_APP_API_DOMAIN=api.yourdomain.com
_APP_GRAPHQL_DOMAIN=graphql.yourdomain.com

Save and exit.


4. Set Up Reverse Proxy (Nginx)

If you want to use Nginx as a reverse proxy, install it:

sudo apt install -y nginx

Create a new Nginx configuration:

sudo nano /etc/nginx/sites-available/appwrite

Add the following configuration:

server {
    listen 80;
    server_name yourdomain.com api.yourdomain.com console.yourdomain.com graphql.yourdomain.com;

    location / {
        proxy_pass http://localhost:80;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Enable the configuration:

sudo ln -s /etc/nginx/sites-available/appwrite /etc/nginx/sites-enabled/
sudo systemctl restart nginx

5. Start Appwrite

Run Appwrite with Docker:

docker-compose up -d

6. Secure with Let's Encrypt (Optional)

To enable SSL using Certbot, install it and generate an SSL certificate:

sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d yourdomain.com -d api.yourdomain.com -d console.yourdomain.com -d graphql.yourdomain.com

Ensure auto-renewal:

sudo certbot renew --dry-run

7. Access Appwrite

  • Open https://console.yourdomain.com in a browser.
  • Login and start managing your Appwrite instance.

Conclusion

By following these steps, you now have Appwrite running on Docker with a custom domain. Let me know if you need further customization or troubleshooting! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment