Install Plugins in Discourse

So you want to install a plugin on your Discourse instance? Great, let’s get started!

In this tutorial, we’ll install Discourse Spoiler Alert plugin.

  • Get the plugin’s GitHub or Bitbucket git clone url.

  • Access your container’s app.yml file (present in /var/discourse/containers/)

    cd /var/discourse
    nano containers/app.yml
  • Add the plugin’s repository URL to your container’s app.yml file:

        - exec:
            cd: $home/plugins
              - sudo -E -u discourse git clone

    (Add the plugin’s git clone url just below sudo -E -u discourse git clone

  • Rebuild the container:

    cd /var/discourse
    ./launcher rebuild app

    That’s it, you’ve successfully installed the Discourse Spoiler Alert plugin on your Discourse instance!

Installing plugins hosted in a private repo

Use an OAuth token to install your plugin

This way you can install your plugin in the same space as any other and you don’t need to create an ssh key.

    - exec:
        cd: $home/plugins
              - sudo -E -u discourse git clone https://<token>

:bookmark_tabs: An alternative method to install private plugins can be to use SSH keys. However, for most instances, OAuth tokens is the preferred method.

SSH Key Private Install Steps
  - exec: echo "Beginning of custom commands"
  - exec: cd /var/www/discourse && sudo -u discourse bundle install --deployment --without test --without development
  - exec: echo "Host\n\tStrictHostKeyChecking no\n" >> /user/.ssh/config
  - file:
      path: /user/.ssh/id_rsa
      chmod: 600
      contents: |
        -----BEGIN RSA PRIVATE KEY-----
           .... etc ....
        -----END RSA PRIVATE KEY-----
  - file:
      path: /user/.ssh/
      chmod: 600
      contents: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tj .... etc .... user@discourse
  - exec: cd $home/plugins && git clone
  - exec: cd $home && sudo -E -u discourse bundle exec rake db:migrate
  - exec: cd $home && rm -fr tmp/cache
  - exec: cd $home &&  sudo -E -u discourse bundle exec rake assets:precompile
  - exec: rm /user/.ssh/id_rsa
  - exec: rm /user/.ssh/

  - exec: echo "End of custom commands"
  • Rebuild the container:
cd /var/discourse
./launcher rebuild app

Your private plugin should be installed on your Discourse instance.

Discourse Slackdoor Plugin
Site maintenance mode during rebuilds?
Discourse Version 1.2
How to create a new plugins?
Embed Etherpad Lite pads into Discourse
Data Explorer Plugin
Chatroom Integration Plugin (discourse-chat-integration)
About the Plugin category
How do I stop human spammers?
Solved Button Plugin
Can Plugins Be Added To Basic Docker Install
Formatting toolbar
Checklist Plugin - Interactive Checkboxes made Simple
Discourse Zendesk Plugin
Quick Messages Plugin
Wild Apricot login plugin
Does this software allow admin to put Adsense ads in?
LDAP Setup for Discourse
Daemonite Material Theme
Generating lots of Invite Tokens
Discourse Mark Plugin
Babble - A Chat Plugin
Watching Categories based on on group in discourse
Bump Reset plugin - Annotated to help new devs
Update private plugin without rebuilding the application
Retort - a reaction-style plugin for Discourse
ReplyGif: Adding reaction GIF easily
Discourse Push Notifications for Desktop
User feedback plugin
How do i install plugins after doing a fork?
Admin Statistics Report
News Plugin :newspaper:
Graphviz Plugin
Discourse Akismet Anti-Spam
SSO for College Account
Installing Plugins with Git
Should all plugins be cloned as the `discourse` user?
Beginner’s Guide to Creating Discourse Plugins Part 6: Acceptance Tests
Favorites - select your favorite categories
Why do I need a block storage?
Projects management plugin
Adding location at sign up
Plugin for Preventing Malicious Linking
Custom Wizard Plugin :mage:
Login with Amazon Plugin
Knowledge Base Plugin
Discourse Fingerprint - Browser Fingerprinting Plugin
Plugin installation went wrong
Sidebar with categories
Topic Ratings Plugin
Merge Users Plugin
Steam Login / Authentication Plugin
Events Plugin :calendar:
Application Files after Digital Ocean Setup
How to enable [code] feature in the forum?
Unable to find /plugins dir
Pwned Passwords Validator
Launcher rebuild app does nothing
Private repo on Github
Mingle - An Introductions Plugin
Category Page Plugin
OpenID Connect Authentication Plugin
Checklist Plugin - Interactive Checkboxes made Simple
Stop Forum Spam Plugin (auto silence known spammers)
Any options for over-riding the username restrictions?
Collude - a collaborative text editor for Discourse
Features of the open source
Can't able to install plugins, whats the problem?
Google Perspective API Plugin
Can I access Discourse forum Database to use for PowerBI reporting?
Discourse Code Review
Who's Online Plugin (discourse-whos-online)
Discourse GitHub
Discourse Policy login (vkontakte)
Advanced Discourse Intercom
Custom Trust Level
Fatal: Not a git repository (or any parent up to mount point /discourse)
Fatal: Not a git repository (or any parent up to mount point /discourse)
I need someone who can install a voting plugin
Custom Wizard Plugin :mage:
Introducing Font Awesome 5 and SVG icons
Topic List Previews
Topic List Previews
Option in category setting not found
How to make a discourse forum look like
Discourse Spoiler Alert
Discourse Cookie Consent Banner
:spiral_calendar: Discourse Event
Follow Plugin 👨
Error using discourse-oauth2-basic plugin with NeonCRM
Discourse Assign
Question Answer Plugin
Discourse Math Editor - user friendly equations!
Discourse Subscriptions
Knowledge Explorer Plugin
[Solved] Admin-upgrade page not showing up
Synchronizer-base for any backup provider
"Your Docker installation is not using a supported storage driver."
Fixing problems with rebuild app
Install plugins for hosted solution
Auto Bookmarks plugin login (vkontakte)
Force specific users through moderation
Importing from phpBB3
Importing from phpBB3
Zoom Webinars Plugin
Discourse Affiliate Plugin
Voice recording plugin
How to hook up JWT Single Sign On to Discourse
Should all plugins be cloned as the `discourse` user?
Tickets Plugin :tickets:
Discourse Patreon Integration
OAuth2 integration with Drupal
Discourse Narrative Bot Beta Feedback
Discourse Translator
No option appears to choose better answer
How to block all crawlers but Google's
Discourse Avatar name_first_letter
Auto-suspend inactive users
How to ad banners?
Algolia plugin indexation
Telegram Notifications Plugin (discourse-telegram-notifications)
Configuring OneLogin's SAML for Discourse
Migrate from Digital Ocean to OVH?
Trying to install plugin (But not working)
How to break 99k char limit?
Availability of OpenID Connect in hosted plans
How to edit plugins code?
I want to install a plugin for development, what should I do?
Discourse Encrypt (for Private Messages)
Azure Blob Storage Plugin
Beginner's Guide to Creating Discourse Plugins - Part 1
./launcher rebuild app error './launcher: No such file or directory'

how can i access cd /var/discourse if i am on digital ocean

1 Like

The common way is to use ssh to login into the server remotely. cd is the “change directory” command, and /var/discourse is the directory to change to (once logged in). :slight_smile:

1 Like

Done is it right the git clone url under the gitclone docker url ?

1 Like

Yes… but you need to give it the same level of indentation.

    - exec:
        cd: $home/plugins
          - sudo -E -u discourse git clone
          - git clone
          - git clone

@techAPJ maybe we should point out the indentation in the line:

And add the text with the spoiler plugin git clone line included? :slight_smile:


And if I may add something, don’t use the Tab key on your keyboard, in the app.yml always use space


I go a step further and say to always copy an existing line and replace just the url.

1 Like

So I’m hearing: quick note linking to details about YAML and text editor quirks?

1 Like

What is the best way to install a specific version of a plugin?

Let’s say the version of Discourse is not the most recent, but not terribly out of date. And the app.yml definition for the plugins using the git clone [plugin repo] to always get the latest plugin. But the plugin has changed or has breaking changes with the older Discourse version.

I feel that I’m probably not the only one to come across a situation like this and I am not looking for technical support, but more so wondering:


  1. Is there a way to version the plugins?
  2. In this situation described above, would updating Discourse to be compatible with the plugin be the recommended approach?

There are potentially two ways to solve this:

  1. After running the git clone command, follow up in app.yml with a command to navigate to the plugins directory followed by a a git checkout command to checkout the particular commit (caveat: I’ve not tried this).
  2. Prepare a branch of the plugin with the commit of your choice:
    • fork the plugin
    • checkout the desired commit
    • create a new branch from there
    • go back to app.yml and git clone that plugin specifying the branch (which can be done with a single command).

Number 2. requires a github account, but it’s free.

I clone from a branch of a plugin all the time in my work to test new features.

Both of these approaches have their overhead, so I would suggest trying to update your instance as the best option.

In general, it would be really great as a plugin developer to support Stable, Beta and Tests-passed on an ongoing basis using different branches, but that would mean some significant overhead, especially when starting to get into back porting of features, bug fixes etc., so I have avoided this so far. Perhaps when I can write plugins with the keyboard slung behind my back I might start doing that :guitar: :slight_smile: