Skip to content
Open

Updated #1463

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 42 additions & 43 deletions templates/discourse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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",
},
],
},
});

Expand Down
55 changes: 38 additions & 17 deletions templates/discourse/meta.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -28,9 +35,12 @@ schema:
required:
- appServiceName
- appServiceImage
- discourseUsername
- discoursePassword
- dbServiceImage
- discourseEmail
- smtpAddress
- smtpPort
- smtpUsername
- smtpPassword
properties:
appServiceName:
type: string
Expand All @@ -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
Expand Down