How to Install Discourse on Your Synology NAS

How to Install Discourse on Your Synology NAS

Discourse is an open source Internet forum system. Features include threading, categorization and tagging of discussions, configurable access control, live updates, expanding link previews, infinite scrolling, and real-time notifications. It is customizable via its plugin architecture and its theming system. Use it as a mailing list, discussion forum, long-form chat room, and more! In this step by step guide I will show you how to install Discourse on your Synology NAS using Docker and Portainer.

💡Note: This guide works perfectly with the latest Discourse v3.3.2 release.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.

  • STEP 3

Make sure you have a synology.me Wildcard Certificate. Follow my guide to get a Wildcard Certificate. If you already have a synology.me Wildcard certificate, skip this STEP.

  • STEP 4

Go to Control Panel / Login Portal / Advanced Tab / click Reverse Proxy. Follow the instructions in the image below.

Discourse Synology NAS Set up 1

  • STEP 5

Now click the “Create” button. Follow the instructions in the image below.

Discourse Synology NAS Set up 2

  • STEP 6

After you click the Create button, the window below will open. Follow the instructions in the image below.

On the General area, set the Reverse Proxy Name description: type in Discourse. After that, add the following instructions:

Source:
Protocol: HTTPS
Hostname: discourse.yourname.synology.me
Port: 443

Check Enable HSTS

Destination:
Protocol: HTTP
Hostname: localhost
Port: 2249

Discourse Synology NAS Set up 3

  • STEP 7

On the Reverse Proxy Rules click the Custom Header tab. Click Create and then, from the drop-down menu, click WebSocket. After you click on WebSocket, two Header Names and two Values will be automatically added. Click Save. Follow the instructions in the image below.

Synology Proxy WebSocket

  • STEP 8

Go to Control Panel / Network / Connectivity tab/ Check Enable HTTP/2 then click Apply. Follow the instructions in the image below.

Discourse Synology NAS Set up 4

  • STEP 9

Go to Control Panel / Security / Advanced tab/ Check Enable HTTP Compression then click Apply. Follow the instructions in the image below.

Discourse Synology NAS Set up 5

  • STEP 10

Go to File Station and open the docker folder. Inside the docker folder, create one new folder and name it discourse. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Discourse Synology NAS Set up 6

  • STEP 11

Now create four new folders inside the discourse folder that you created at STEP 10 and name them data, db, redis, sidekiq. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Discourse Synology NAS Set up 7

  • STEP 12

Right click on the discourse folder that you have previously created at STEP 11 then click Properties. Follow the instructions in the image below.

Discourse Synology NAS Set up 8

  • STEP 13

Go to the Permission tab then click Advanced options. From the drop-down menu choose “Make inherited permissions explicit“. Follow the instructions in the image below.

Discourse Synology NAS Set up 9

  • STEP 14

Select Everyone then click the Edit tab. Follow the instructions in the image below.

Discourse Synology NAS Set up 10

  • STEP 15

Check all Read and Write Permissions. Click Done. Follow the instructions in the image below.

Discourse Synology NAS Set up 11

  • STEP 16

After you click Done on STEP 15, check “Apply to this folder, sub-folders and files“. Click Save. Follow the instructions in the image below.

Discourse Synology NAS Set up 12

  • STEP 17

Follow my step by step guide on how to activate SMTP for your Gmail account. This step is mandatory. Note: If you don’t want to use the easiest way for SMTP with Google and you already have SMTP details from your own Mail Server, you can just skip this STEP and use your personalized email SMTP details instead.

  • STEP 18

Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.

1 Synology Portainer Add Stack

  • STEP 19

In the Name field type in discourse. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

services:
  postgresql:
    image: bitnami/postgresql:16
    container_name: Discourse-DB
    hostname: postgresql
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD", "pg_isready", "-q", "-d", "bitnami_discourse", "-U", "bn_discourse"]
      timeout: 45s
      interval: 10s
      retries: 10
    volumes:
      - /volume1/docker/discourse/db:/bitnami/postgresql:rw
    environment:
      POSTGRESQL_DATABASE: bitnami_discourse
      POSTGRESQL_USERNAME: bn_discourse
      POSTGRESQL_PASSWORD: bitnami123
    restart: on-failure:5

  redis:
    image: redis
    container_name: Discourse-REDIS
    command: redis-server --requirepass redispass
    healthcheck:
     test: ["CMD-SHELL", "redis-cli ping || exit 1"]
    volumes:
      - /volume1/docker/discourse/redis:/data:rw
    environment:
      TZ: Europe/Bucharest
    restart: on-failure:5

  discourse:
    image: bitnami/discourse:3.3.2
    container_name: Discourse
    restart: on-failure:5
    healthcheck:
      test: timeout 10s bash -c ':> /dev/tcp/127.0.0.1/3000' || exit 1
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 90s
    ports:
      - 2249:3000
    depends_on:
      - postgresql
      - redis
    environment:
      - DISCOURSE_USERNAME=marius
      - DISCOURSE_PASSWORD=mariushosting
      - DISCOURSE_EMAIL=yourown@email
      - DISCOURSE_ENV=production
      - DISCOURSE_ENABLE_HTTPS=yes
      - DISCOURSE_DATABASE_HOST=postgresql
      - DISCOURSE_DATABASE_PORT_NUMBER=5432
      - DISCOURSE_DATABASE_USER=bn_discourse
      - DISCOURSE_DATABASE_NAME=bitnami_discourse
      - DISCOURSE_DATABASE_PASSWORD=bitnami123
      - DISCOURSE_REDIS_HOST=redis
      - DISCOURSE_REDIS_PORT_NUMBER=6379
      - DISCOURSE_REDIS_PASSWORD=redispass
      - POSTGRESQL_CLIENT_POSTGRES_USER=bn_discourse
      - POSTGRESQL_CLIENT_POSTGRES_PASSWORD=bitnami123
      - POSTGRESQL_CLIENT_CREATE_DATABASE_NAME=bitnami_discourse
      - POSTGRESQL_CLIENT_CREATE_DATABASE_EXTENSIONS=hstore,pg_trgm
      - DISCOURSE_HOST=discourse.yourname.synology.me
      - DISCOURSE_DEVELOPER_EMAILS=yourown@email
      - DISCOURSE_SMTP_HOST=smtp.gmail.com
      - DISCOURSE_SMTP_AUTH=login
      - DISCOURSE_SMTP_PORT_NUMBER=587
      - DISCOURSE_SMTP_USER=Your-own-gmail-address
      - DISCOURSE_SMTP_PASSWORD=Your-own-app-password
      - DISCOURSE_SMTP_PROTOCOL=tls
    volumes:
      - /volume1/docker/discourse/data:/bitnami/discourse:rw
      
  sidekiq:
    image: bitnami/discourse:3.3.2
    container_name: Discourse-SIDEKIQ
    depends_on:
      - discourse
    volumes:
      - /volume1/docker/discourse/sidekiq:/bitnami/discourse:rw
    command: /opt/bitnami/scripts/discourse-sidekiq/run.sh
    environment:
      - DISCOURSE_HOST=discourse.yourname.synology.me
      - DISCOURSE_ENABLE_HTTPS=yes
      - DISCOURSE_ENV=production
      - DISCOURSE_DATABASE_HOST=postgresql
      - DISCOURSE_DATABASE_PORT_NUMBER=5432
      - DISCOURSE_DATABASE_USER=bn_discourse
      - DISCOURSE_DATABASE_NAME=bitnami_discourse
      - DISCOURSE_DATABASE_PASSWORD=bitnami123
      - DISCOURSE_REDIS_HOST=redis
      - DISCOURSE_REDIS_PORT_NUMBER=6379
      - DISCOURSE_REDIS_PASSWORD=redispass
      - DISCOURSE_DEVELOPER_EMAILS=yourown@email
      - DISCOURSE_SMTP_HOST=smtp.gmail.com
      - DISCOURSE_SMTP_AUTH=login
      - DISCOURSE_SMTP_PORT_NUMBER=587
      - DISCOURSE_SMTP_USER=Your-own-gmail-address
      - DISCOURSE_SMTP_PASSWORD=Your-own-app-password
      - DISCOURSE_SMTP_PROTOCOL=tls

Note: Before you paste the code above in the Web editor area below, change the value for TZ. (Select your current Time Zone from this list.)
Note: Before you paste the code above in the Web editor area below, change the value for DISCOURSE_USERNAME. Type in your own username. marius is an example for a username.
Note: Before you paste the code above in the Web editor area below, change the value for DISCOURSE_PASSWORD. Type in your own password. mariushosting is an example for a password. You will need this password later at STEP 24.
Note: Before you paste the code above in the Web editor area below, change the value for DISCOURSE_EMAIL. Type in your own email address. You will need this email later at STEP 24.
Note: Before you paste the code above in the Web editor area below, change the value for DISCOURSE_HOST and type in your own synology.me DDNS without https:// at the beginning that you have previously created at STEP 6.
Note: Before you paste the code above in the Web editor area below, change the value for DISCOURSE_DEVELOPER_EMAILS. Type in your own email address.
Note: Before you paste the code above in the Web editor area below, change the value for DISCOURSE_SMTP_USER and type in your own Gmail address. Refer to STEP 17.
Note: Before you paste the code above in the Web editor area below, change the value for DISCOURSE_SMTP_PASSWORD and type in your own Gmail app password. Refer to STEP 17.
Note: Before you paste the code above in the Web editor area below, change the value for DISCOURSE_HOST and type in your own synology.me DDNS without https:// at the beginning that you have previously created at STEP 6.
Note: Before you paste the code above in the Web editor area below, change the value for DISCOURSE_DEVELOPER_EMAILS. Type in your own email address.
Note: Before you paste the code above in the Web editor area below, change the value for DISCOURSE_SMTP_USER and type in your own Gmail address. Refer to STEP 17.
Note: Before you paste the code above in the Web editor area below, change the value for DISCOURSE_SMTP_PASSWORD and type in your own Gmail app password. Refer to STEP 17.

Discourse Synology NAS Set up 13

  • STEP 20

Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

Discourse Synology NAS Set up 14

  • STEP 21

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

Discourse Synology NAS Set up 15

⌛Now just wait because the Discourse image is about 3GB.

  • STEP 22

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 23

Please wait approximately 10-12 minutes for the installation to be completed or you will get a blank error page if you try to connect too soon. Now open your browser and type in your HTTPS/SSL certificate like this https://discourse.yourname.synology.me that you have previously created at STEP 6. In my case it’s https://discourse.mariushosting.synology.me If everything goes right, you will see the main Discourse login page. Click Sign Up. Follow the instructions in the image below.

Discourse Synology NAS Set up 16

  • STEP 24

A new pop up window will open. Type in your own Email Address (DISCOURSE_EMAIL) and your own Password (DISCOURSE_PASSWORD) that you have previously added at STEP 19, then click Log in. Follow the instructions in the image below.

Discourse Synology NAS Set up 17

  • STEP 25

On the left Discourse sidebar, click Admin. Follow the instructions in the image below.

Discourse Synology NAS Set up 18

  • STEP 26

Click All Site Settings / Security / Security. Check the force https option, then confirm it. Follow the instructions in the image below.

Discourse Synology NAS Set up 19

  • STEP 27

Your Discourse forum at a glance!

Discourse Synology NAS Set up 20

Enjoy Discourse!

🆘TROUBLESHOOTING

If you encounter issues by using this container, make sure to check out the Common Docker issues article.

Note: Can I run Docker on my Synology NAS? See the supported models.
Note: How to Back Up Docker Containers on your Synology NAS.
Note: Find out how to update the Discourse container with the latest image.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.
Note: Find out the Best NAS Models For Docker.
Note: Activate Gmail SMTP For Docker Containers.

This post was updated on Sunday / November 3rd, 2024 at 3:48 AM