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.

Revisions

  1. anoochit created this gist Feb 12, 2025.
    130 changes: 130 additions & 0 deletions install_appwrite.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,130 @@
    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.

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

    Verify installation:

    ```sh
    docker --version
    docker-compose --version
    ```

    ---

    ### **2. Download and Set Up Appwrite**
    Pull the Appwrite setup script:

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

    Or manually clone the repository:

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

    ---

    ### **3. Configure Environment for Custom Domain**
    Modify the `.env` file:

    ```sh
    cp .env.example .env
    nano .env
    ```

    Update these values to match your custom domain:

    ```env
    _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:

    ```sh
    sudo apt install -y nginx
    ```

    Create a new Nginx configuration:

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

    Add the following configuration:

    ```nginx
    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:

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

    ---

    ### **5. Start Appwrite**
    Run Appwrite with Docker:

    ```sh
    docker-compose up -d
    ```

    ---

    ### **6. Secure with Let's Encrypt (Optional)**
    To enable SSL using **Certbot**, install it and generate an SSL certificate:

    ```sh
    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:

    ```sh
    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! 🚀