Back

HTTPS for appwrite on Coolify

  • 0
  • Self Hosted
Karl
22 Oct, 2024, 18:20

Does anyone know how to set this up or is there a tutorial?

TL;DR
Update Appwrite environment variables with SSL certificate paths, generate certificates on the server using Let's Encrypt, and configure Appwrite to use HTTPS. Update the `appwrite.json` configuration file. Follow a tutorial to set up HTTPS with Appwrite on Coolify.
Karl
22 Oct, 2024, 18:38

yes but im asking specifically for https setup

Guri
22 Oct, 2024, 18:41

1: Install Appwrite on Coolify

  • Create a New Service: Go to Coolify and create a new service for Appwrite
  • Select Appwrite: Choose Appwrite from the list of available services

2: Configure HTTPS

  • Generate SSL Certificates
  • Update Appwrite Configuration
Guri
22 Oct, 2024, 18:42

Example of appwrite.json

TypeScript
{
  "projectId": "YOUR_PROJECT_ID",
  "project": {
    "name": "YOUR_PROJECT_NAME"
  },
  "functions": [
    {
      "name": "YOUR_FUNCTION_NAME",
      "runtime": "node-14.5",
      "entrypoint": "index.js",
      "events": [
        "database.documents.create",
        "database.documents.update"
      ]
    }
  ],
  "authProviders": {
    "microsoft": {
      "clientId": "YOUR_CLIENT_ID",
      "clientSecret": "YOUR_CLIENT_SECRET",
      "redirectUri": "https://your-coolify-url.ngrok.io/v1/account/sessions/oauth2/callback/microsoft/YOUR_PROJECT_ID"
    }
  },
  "https": {
    "enabled": true,
    "certificates": {
      "cert": "/path/to/your/cert.pem",
      "key": "/path/to/your/key.pem"
    }
  }
}
Guri
22 Oct, 2024, 18:42

3: Deploy the Configuration: Apply the updated configuration to your Appwrite instance on Coolify

Guri
22 Oct, 2024, 18:43

At last, Use the HTTPS URL to access your Appwrite instance and verify that the SSL certificate is working correctly

Karl
22 Oct, 2024, 18:49

Thank you for your reply, in my setup i have 2 hetzner servers, first one is where coolify is hosted, that thing i got on https via wildcard domain on the second server i installed appwrite , the second server right now probably uses a generated ip address and all appwrite services thatswhy run over that ip adress over http

where exactly do you generate the certificates? on your server? and where can i update this config?

Guri
22 Oct, 2024, 18:54

generate SSL certificates on the Appwrite server. You can use Let’s Encrypt for this.

Guri
22 Oct, 2024, 18:56

Steps to Generating Certificates with Let’s Encrypt (Certbot):

  1. Install Certbot
TypeScript
sudo apt-get update
sudo apt-get install certbot
  1. Generate Certificates
TypeScript
sudo certbot certonly --standalone -d your.domain.com
Guri
22 Oct, 2024, 18:57

Replace your.domain.com with your Appwrite server’s domain. This will create certificates in the /etc/letsencrypt/live/your.domain.com/ directory.

Guri
22 Oct, 2024, 18:58

Once the certificates are generated, update your Appwrite configuration to use HTTPS. Modify Appwrite Environment Variables: Update the appwrite.env or your environment variable configuration file with the paths to your SSL certificate files.

TypeScript
_APP_ENV=production
_APP_SYSTEM_SECURITY_KEY=your-secret-key
...
_APP_SYSTEM_SECURITY_HTTPS=true
_APP_SYSTEM_SECURITY_HTTPS_CERT=/etc/letsencrypt/live/your.domain.com/fullchain.pem
_APP_SYSTEM_SECURITY_HTTPS_KEY=/etc/letsencrypt/live/your.domain.com/privkey.pem
...
Guri
22 Oct, 2024, 18:58

After updating the configuration, restart your Appwrite services to apply the changes.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more