From 1ab9cc315b13509251a05007b2fe950d94efa95f Mon Sep 17 00:00:00 2001 From: Ahson Shaikh Date: Tue, 30 Jun 2026 01:24:47 +0500 Subject: [PATCH] Updated --- templates/discourse/index.ts | 85 +++++++++++++++++------------------ templates/discourse/meta.yaml | 55 ++++++++++++++++------- 2 files changed, 80 insertions(+), 60 deletions(-) diff --git a/templates/discourse/index.ts b/templates/discourse/index.ts index 26ca00a22..1c9036b0c 100644 --- a/templates/discourse/index.ts +++ b/templates/discourse/index.ts @@ -3,22 +3,9 @@ import { Input } from "./meta"; export function generate(input: Input): Output { const services: Services = []; + const dbPassword = randomPassword(); - const databasePassword = randomPassword(); - const redisPassword = randomPassword(); - - const common_envs = [ - `DISCOURSE_HOSTNAME=$(PRIMARY_DOMAIN)`, - `DISCOURSE_DATABASE_HOST=$(PROJECT_NAME)_${input.appServiceName}-db`, - `DISCOURSE_DATABASE_PORT_NUMBER=5432`, - `DISCOURSE_DATABASE_NAME=$(PROJECT_NAME)`, - `DISCOURSE_DATABASE_USER=postgres`, - `DISCOURSE_DATABASE_PASSWORD=${databasePassword}`, - `DISCOURSE_REDIS_HOST=$(PROJECT_NAME)_${input.appServiceName}-redis`, - `DISCOURSE_REDIS_PORT_NUMBER=6379`, - `DISCOURSE_REDIS_PASSWORD=${redisPassword}`, - ].join("\n"); - + // Web application — official Discourse image, listens on port 80 services.push({ type: "app", data: { @@ -27,60 +14,72 @@ export function generate(input: Input): Output { type: "image", image: input.appServiceImage, }, - domains: [ - { - host: "$(EASYPANEL_DOMAIN)", - port: 3000, - }, - ], env: [ - common_envs, - `DISCOURSE_USERNAME=${input.discourseUsername}`, - `DISCOURSE_PASSWORD=${input.discoursePassword}`, - `DISCOURSE_EMAIL=${input.discourseEmail}`, + `DISCOURSE_HOSTNAME=$(PRIMARY_DOMAIN)`, + `DISCOURSE_DB_HOST=$(PROJECT_NAME)_${input.appServiceName}-db`, + `DISCOURSE_DB_PASSWORD=${dbPassword}`, + `DISCOURSE_REDIS_HOST=$(PROJECT_NAME)_${input.appServiceName}-redis`, + `DISCOURSE_DEVELOPER_EMAILS=${input.discourseEmail}`, + `DISCOURSE_SMTP_ADDRESS=${input.smtpAddress}`, + `DISCOURSE_SMTP_PORT=${input.smtpPort}`, + `DISCOURSE_SMTP_USER_NAME=${input.smtpUsername}`, + `DISCOURSE_SMTP_PASSWORD=${input.smtpPassword}`, ].join("\n"), mounts: [ { type: "volume", - name: "discourse_data", - mountPath: "/bitnami/discourse", + name: "web-data", + mountPath: "/shared", + }, + ], + domains: [ + { + host: "$(EASYPANEL_DOMAIN)", + port: 80, }, ], }, }); + // Discourse-flavoured Postgres — uses DB_PASSWORD, not the standard POSTGRES_PASSWORD services.push({ type: "app", data: { - serviceName: `${input.appServiceName}-sidekiq`, + serviceName: `${input.appServiceName}-db`, source: { type: "image", - image: input.appServiceImage, + image: input.dbServiceImage, }, - env: [common_envs, `DISCOURSE_SKIP_INSTALL=yes`].join("\n"), + env: [`DB_PASSWORD=${dbPassword}`].join("\n"), mounts: [ { - type: "bind", - hostPath: `/etc/easypanel/projects/$(PROJECT_NAME)/${input.appServiceName}/volumes/discourse_data`, - mountPath: "/bitnami/discourse", + type: "volume", + name: "db-data", + mountPath: "/var/lib/postgresql", }, ], }, }); + // Redis — no auth required by the official Discourse image services.push({ - type: "postgres", - data: { - serviceName: `${input.appServiceName}-db`, - password: databasePassword, - }, - }); - - services.push({ - type: "redis", + type: "app", data: { serviceName: `${input.appServiceName}-redis`, - password: redisPassword, + source: { + type: "image", + image: "redis:7-alpine", + }, + deploy: { + command: "redis-server --save 60 1", + }, + mounts: [ + { + type: "volume", + name: "redis-data", + mountPath: "/data", + }, + ], }, }); diff --git a/templates/discourse/meta.yaml b/templates/discourse/meta.yaml index 25344b2da..cc6cc92eb 100644 --- a/templates/discourse/meta.yaml +++ b/templates/discourse/meta.yaml @@ -1,16 +1,23 @@ name: Discourse description: - Discourse is a modern, open-source discussion platform that provides a clean, - intuitive interface for community discussions. It's perfect for forums, - mailing lists, chat rooms, and more. + Discourse is a modern, open-source discussion platform built for the next + decade of the internet. It provides a clean, intuitive interface for community + discussions, forums, mailing lists, and chat. Discourse is fully self-hosted + and includes real-time notifications, a rich markdown editor, trust levels, + plugin support, and deep email integration. This template uses the official + Discourse Docker images with a bundled Postgres database and a Redis cache. instructions: - Once clicked, please wait for the installation to complete, it will take time. - It is also resource intensive, so make sure you have more than 8GB of RAM. + After deployment, the first setup wizard will walk you through creating your + admin account and configuring your site. Make sure your SMTP credentials are + correct before deploying — Discourse requires email to activate accounts. + Allow 5-10 minutes for the initial bootstrap to complete. changeLog: - date: 2025-04-30 description: Initial release - date: 2025-07-15 description: Version bumped to 3.4.5 + - date: 2026-06-30 + description: Switched to official discourse/discourse image links: - label: Website url: https://www.discourse.org @@ -19,7 +26,7 @@ links: - label: GitHub url: https://github.com/discourse/discourse - label: Docker Hub - url: https://hub.docker.com/r/bitnami/discourse + url: https://hub.docker.com/r/discourse/discourse contributors: - name: Ahson Shaikh url: https://github.com/Ahson-Shaikh @@ -28,9 +35,12 @@ schema: required: - appServiceName - appServiceImage - - discourseUsername - - discoursePassword + - dbServiceImage - discourseEmail + - smtpAddress + - smtpPort + - smtpUsername + - smtpPassword properties: appServiceName: type: string @@ -39,20 +49,31 @@ schema: appServiceImage: type: string title: App Service Image - default: bitnami/discourse:3.4.5 + default: discourse/discourse:2026.1.4 + dbServiceImage: + type: string + title: Database Service Image + default: discourse/postgres:pg17 discourseEmail: type: string - title: Discourse Email + title: Developer Email default: admin@example.com - discourseUsername: + smtpAddress: + type: string + title: SMTP Address + default: smtp.gmail.com + smtpPort: + type: string + title: SMTP Port + default: "587" + smtpUsername: type: string - title: Discourse Username - default: admin - discoursePassword: + title: SMTP Username + default: user@gmail.com + smtpPassword: type: string - title: Discourse Password - default: adminpassword123 - description: Passwort must be at least 10 characters long + title: SMTP Password + default: "" benefits: - title: Modern Discussion Platform description: Clean, intuitive interface for community discussions and forums