Conversation
atharvadeosthale
commented
Apr 14, 2026
Appwrite WebsiteProject ID: Website (appwrite/website)Project ID: Tip Environment variables can be scoped per function or shared across your project |
Greptile SummaryThis PR adds an interactive Docker Compose +
Confidence Score: 2/5
|
| Filename | Overview |
|---|---|
| src/lib/components/compose-generator/composeData.ts | New file containing Docker Compose and .env templates; has three issues: _APP_DB_ADAPTER duplicated in every service's environment list (~15 services), MongoDB service missing restart: unless-stopped, and appwrite-mongodb-config volume declared but never mounted. Also exposes MongoDB port 27017 to the host. |
| src/markdoc/tags/Compose_Generator.svelte | New Svelte component for interactive compose/env generator; the handleDownload function does not append the anchor element to the DOM before clicking, which silently breaks file downloads in Firefox. |
| src/markdoc/tags/_Module.svelte | Exports the new Compose_Generator component to make it available as a markdoc tag — straightforward one-line addition. |
| src/routes/docs/advanced/self-hosting/installation/+page.markdoc | Replaces the static "download config files" section with the new {% compose_generator %} tag and condenses the manual setup instructions into a cleaner 3-step guide. |
Reviews (1): Last reviewed commit: "init generator" | Re-trigger Greptile
| - _APP_DB_ADAPTER | ||
| - _APP_DB_HOST | ||
| - _APP_DB_PORT | ||
| - _APP_DB_SCHEMA | ||
| - _APP_DB_USER | ||
| - _APP_DB_PASS | ||
| - _APP_DB_ADAPTER |
There was a problem hiding this comment.
_APP_DB_ADAPTER duplicated in every service environment list
_APP_DB_ADAPTER appears twice in the environment block of every service in the compose template. The duplicate occurs after _APP_DB_PASS in every service (e.g. lines 216 and 222 for appwrite, lines 352 and 358 for appwrite-realtime, and the same pattern repeats across all 15+ services). The generated docker-compose.yml will contain duplicate environment variable declarations throughout. While Docker Compose processes these without error, the output file is malformed and will confuse users.
The second occurrence (after _APP_DB_PASS) should be removed from every service block.
| - appwrite | ||
| volumes: | ||
| - appwrite-mongodb:/data/db | ||
| - appwrite-mongodb-keyfile:/data/keyfile | ||
| ports: | ||
| - "27017:27017" |
There was a problem hiding this comment.
MongoDB service missing
restart: unless-stopped
The MONGODB_SERVICE template does not include a restart policy, while every other service in the compose (including MARIADB_SERVICE) has restart: unless-stopped. Without this, MongoDB will not automatically restart after a crash or host reboot, leaving the entire Appwrite stack in a broken state.
| - appwrite | |
| volumes: | |
| - appwrite-mongodb:/data/db | |
| - appwrite-mongodb-keyfile:/data/keyfile | |
| ports: | |
| - "27017:27017" | |
| const MONGODB_SERVICE = ` mongodb: | |
| image: mongo:8.2.5 | |
| container_name: appwrite-mongodb | |
| <<: *x-logging | |
| restart: unless-stopped | |
| networks: | |
| - appwrite | |
| volumes: | |
| - appwrite-mongodb:/data/db | |
| - appwrite-mongodb-keyfile:/data/keyfile | |
| ports: | |
| - "27017:27017" |
| // __DB_BLOCK__ for the database service definition, | ||
| // __ASSISTANT_BLOCK__ for the optional assistant service, | ||
| // __DB_VOLUMES__ for database-specific volumes. |
There was a problem hiding this comment.
appwrite-mongodb-config volume declared but never mounted
MONGODB_VOLUMES declares appwrite-mongodb-config but the MONGODB_SERVICE only mounts appwrite-mongodb and appwrite-mongodb-keyfile. The config volume is created by Docker but never used, leading to an orphaned volume in the generated compose file.
| // __DB_BLOCK__ for the database service definition, | |
| // __ASSISTANT_BLOCK__ for the optional assistant service, | |
| // __DB_VOLUMES__ for database-specific volumes. | |
| const MONGODB_VOLUMES = ` appwrite-mongodb: | |
| appwrite-mongodb-keyfile:`; |
| ports: | ||
| - "27017:27017" |
There was a problem hiding this comment.
MongoDB port 27017 exposed to host
The MongoDB service binds port 27017 to the host, making the database directly reachable from outside the Docker network. Unlike other services (e.g. MariaDB) which are only on the internal appwrite network with no host port mapping, this exposes the database to anyone who can reach the host. For a self-hosted production deployment, this is a significant attack surface even with authentication enabled.
Consider removing the ports block and relying on the internal appwrite network for connectivity.
| function handleDownload() { | ||
| const blob = new Blob([activeContent], { type: 'text/plain' }); | ||
| const url = URL.createObjectURL(blob); | ||
| const a = document.createElement('a'); | ||
| a.href = url; | ||
| a.download = activeFilename; | ||
| a.click(); | ||
| URL.revokeObjectURL(url); | ||
| } |
There was a problem hiding this comment.
Download anchor not appended to DOM
The temporary anchor element is never appended to the document before .click() is called. While Chrome handles this fine, Firefox requires the element to be attached to the document for a programmatic click to trigger a file download. Without the append/remove steps the download will silently fail for Firefox users.
| function handleDownload() { | |
| const blob = new Blob([activeContent], { type: 'text/plain' }); | |
| const url = URL.createObjectURL(blob); | |
| const a = document.createElement('a'); | |
| a.href = url; | |
| a.download = activeFilename; | |
| a.click(); | |
| URL.revokeObjectURL(url); | |
| } | |
| function handleDownload() { | |
| const blob = new Blob([activeContent], { type: 'text/plain' }); | |
| const url = URL.createObjectURL(blob); | |
| const a = document.createElement('a'); | |
| a.href = url; | |
| a.download = activeFilename; | |
| document.body.appendChild(a); | |
| a.click(); | |
| document.body.removeChild(a); | |
| URL.revokeObjectURL(url); | |
| } |

