Install Plugins in Discourse

:warning: This guide assumes that you have a self-hosted standard installation. We only support the standard method of install here, so these instructions assume you have a standard install.

:warning: This guide only applies to self-hosted Discourse instances. If you are using a managed hosting service, the available plugins are controlled by your hosting provider. For example, on our hosting these specific plugins are available by hosting tier.

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

  • Copy 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:

    hooks:
      after_code:
        - exec:
            cd: $home/plugins
            cmd:
              - sudo -E -u discourse git clone https://github.com/discourse/docker_manager.git
              - sudo -E -u discourse git clone https://github.com/discourse/discourse-spoiler-alert.git
    

    Add the plugin’s git clone url just below the line containing git clone https://github.com/discourse/docker_manager.git)

    Follow the existing format of the docker_manager.git line; if it does not contain sudo -E -u discourse then insert - git clone https://github.com/discourse/discourse-spoiler-alert.git.

  • 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!


My plugin is hosted in a private repository

You must use an OAuth token to install your plugin:

With the OAuth token, you can install your plugin in the same way as a public repo, and you don’t need to create a SSH key.

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
              - sudo -E -u discourse git clone https://<token>@github.com/owner/repo.git

We strongly advise you to use OAuth tokens for plugins in private repositories. However, if you cannot, see below.

SSH Key Private Install Steps
run:
  - exec: echo "Beginning of custom commands"
  
  - exec: cd /var/www/discourse && sudo -u discourse bundle install --deployment --without test --without development
  - exec: echo "Host github.com\n\tStrictHostKeyChecking no\n" >> /user/.ssh/config
  - file:
      path: /user/.ssh/id_rsa
      chmod: 600
      contents: |
        -----BEGIN RSA PRIVATE KEY-----
        MIIEogIBAAKCAQEArCQG213utzqE5YVjTVF5exGRCkE9OuM7LCp/FOuPdoHrFUXk
           .... etc ....
        -----END RSA PRIVATE KEY-----
  - file:
      path: /user/.ssh/id_rsa.pub
      chmod: 600
      contents: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tj .... etc .... user@discourse
  - exec: cd $home/plugins && git clone git@github.com:SecretOrg/secret-plugin.git
  - 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/id_rsa.pub

  - 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.

How to remove/uninstall a plugin

To remove a plugin, simply remove the - git clone https://github.com/... line from your app.yml file and rebuild your site via

cd /var/discourse
./launcher rebuild app
133 Likes
Discourse Slackdoor Plugin
Site maintenance mode during rebuilds?
How to create a new plugins?
Discourse Version 1.2
Embed Etherpad Lite pads into Discourse
Data Explorer Plugin
Chatroom Integration Plugin (discourse-chat-integration)
Solved Button Plugin
About the Plugin category
LDAP Setup for Discourse
Formatting toolbar
Can Plugins Be Added To Basic Docker Install
Wild Apricot login plugin
Generating lots of Invite Tokens
Checklist Plugin - Interactive Checkboxes made Simple
Discourse Zendesk Plugin
Does this software allow admin to put Adsense ads in?
Quick Messages Plugin
Watching Categories based on on group in discourse
Bump Reset plugin - Annotated to help new devs
Discourse Push Notifications for Desktop
News Plugin :newspaper:
Discourse Akismet Anti-Spam
Admin Statistics Report
"Onebox Assistant", crawl for those previews reliably!
How do i install plugins after doing a fork?
Graphviz Plugin
Update private plugin without rebuilding the application
Daemonite Material Theme
Discourse Mark Plugin
Retort - a reaction-style plugin for Discourse
ReplyGif: Adding reaction GIF easily
Babble - A Chat Plugin
User feedback plugin
OpenID Connect Authentication Plugin
Why do I need a block storage?
Projects management plugin
Plugin for Preventing Malicious Linking
Custom Wizard Plugin :mage:
Login with Amazon Plugin
Discourse Fingerprint - Browser Fingerprinting Plugin
Plugin installation went wrong
Sidebar with categories
Topic Ratings Plugin
Merge Users Plugin
Discourse-docs: Documentation Management Plugin
Steam Login / Authentication Plugin
Events Plugin :calendar:
Application Files after Digital Ocean Setup
Unable to find /plugins dir
Pwned Passwords Validator
Launcher rebuild app does nothing
Private repo on Github
Mingle - An Introductions Plugin
Category Page Plugin
Discourse Dice Roller (RogerBW)
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
Discourse Reactions - Beyond Likes
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
Vk.com 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 (legacy)
Option in category setting not found
Discourse Spoiler Alert
Custom Mentionables
Discourse Cookie Consent Banner
:spiral_calendar: Discourse Event
Community Network Visualisation
Follow Plugin 👨
Discourse-a2a-bbcode
Error using discourse-oauth2-basic plugin with NeonCRM
Discourse Assign
Question Answer Plugin
Discourse Math Editor - user friendly equations!
Discourse Subscriptions
How might we better structure #howto?
Landing Pages Plugin :small_airplane:
How might we better structure #howto?
Cannot install new plugins: structure needs cleaning
Slow Discourse Rebuild on a VM with slow disks
Set up a Discourse instance, install plugins and a new theme
Discourse Notifier
Discourse CommonMark text highlighting?
Mumble -- VOIP Plugin for Discourse
Advice on Installing Plugins
Smallcaps formatting
Cannot install plugin - nothing happens
Configure the Discourse RSS Polling Plugin
What else do I need to take care of when self hosting?
LinkedIn Authentication Plugin
Topic Ratings Plugin
Discourse Shared Edits
Official Advertising / Ad Plugin for Discourse
Beginners Guide to Install Discourse for Development using Docker
Installing discourse-math.git
Discourse Image Filter
Discourse Linkify Google Sheets
LDAP Auth Missing from Plugins
Beginner's Guide to Creating Discourse Plugins Part 1: Creating a basic plugin
Discourse Solved (Accepted answer plugin)
Discourse Canned Replies
Add Algolia search to your Discourse
Discourse BBCode
Discourse-automation
Discourse Voting missing table on postgresql
Discourse Math Plugin
Discourse Voting
OAuth2 Basic Support
Discourse Signatures
Discourse Calendar
Discourse footnote
Cakeday! Celebrating birthdays and anniversaries
Discourse Sitemap
Discourse Spoiler Alert
Discourse-bcc: send individual PMs to users
Discourse Yearly Review Plugin
FontAwesome Pro icons
Discourse-teambuild: Run your own team building activity!
Discourse-tooltips - preview topic contents on hover
Restricted Replies - only allow certain groups to reply in a category
Add a button at the bottom of a topic, visible to a specific group: discourse-topic-group-button
Saved Searches Plugin
Add a button at the bottom of a topic, visible to everyone: discourse-custom-topic-button
Characters Required
Discourse BBCode color
Suppress updating of URL during topic navigation
User Notes Plugin
Discourse Post Sorting Customizer
Set up a Discourse instance, install plugins and a new theme
Unikname Connect plugin
Beginner's Guide to Creating Discourse Plugins Part 1: Creating a basic plugin
Discourse Video Upload Plugin with YouTube and Vimeo
Quoting not working
Sign in with Apple Plugin
User profile by ID instead of username
"Onebox Assistant", crawl for those previews reliably!
Votes don't Merge when we combine posts
Importing / migrating from phpBB3
LDAP Setup for Discourse
I need someone who can install a voting plugin
Availability of OpenID Connect in hosted plans
Codebytes Plugin
Multiple Users posting under same User or Group name?
What makes a successful volunteer Discourse sysadmin?
Better-Anonymous (multiple anonymous accounts and other features)
How to make a discourse forum look like forum.glamour.de
How to install the lazy-yt plugin
Landing Pages Blog :small_airplane:
Issue With Sitemap
Discourse Category Experts
Learning Management System Integration (LTI 1.3 Authentication)
Discourse Private Replies
Set up a Discourse instance, install plugins and a new theme
Rocket.Chat SSO + embed plugin for Discourse
Group Invitation Plugin
Discourse Mailgun Routes
Word Cloud plugin
Signed Google Cloud CDN URLs
Microsoft Authentication Plugin
Landing Pages Plugin :small_airplane:
Set up a Discourse instance, install plugins and a new theme
Set up a Discourse instance, install plugins and a new theme
Set up a Discourse instance, install plugins and a new theme
Set up a Discourse instance, install plugins and a new theme
Discourse OneDrive Picker
Set up a Discourse instance, install plugins and a new theme
Set up a Discourse instance, install plugins and a new theme
Install plugins on your local development environment
Not able to install any Discourse plugins
[Solved] Admin-upgrade page not showing up
Synchronizer-base for any backup provider
"Your Docker installation is not using a supported storage driver."
Solution icon does not show in posts
Fixing problems with rebuild app
Auto Bookmarks plugin
Vk.com login (vkontakte)
Force specific users through moderation
Importing / migrating 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
Discord Sync: sync a Discourse forum with a Discord server
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
Trying to install plugin (But not working)
How to break 99k char limit?
How to edit plugins code?
I want to install a plugin for development, what should I do?
News Plugin :newspaper:
Discourse Encrypt (for Private Messages)
Azure Blob Storage Plugin
./launcher rebuild app error './launcher: No such file or directory'
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

I have added this to the OP to make it easier to find

8 Likes

Anyone using discourse locally for development and not using discourse-docker, you can download the plugin you want to install and place it in the plugins directory inside discourse and restart rails server. This is exactly how I’ve been installing plugins on my local dev server.

13 Likes

Thank you so much!!!

2 Likes

I do it exactly this way, in /var/www/discourse/plugin I git cloned a plugin, changed directory+files owner to discourse (also tried www-data) and restarted discourse and all other services.
In https://domainname/admin/plugins I see absolutely nothing. What else is necessary? Mails, Logins etc. all work with about 20 Users now. This is an Ubuntu 20.04.2 server without Docker.

2 Likes

What plugin are you trying to install?

1 Like

that install is buggy.

re-create your droplet and follow

and if you cant follow the official install,

DM me the root details and i will install it for you.

2 Likes

Thanks for the great instructions! Really clear :slight_smile:

I must have missed something, I added the discourse-calendar plugin as described above using nano containers/app.yml , rebuilt the docker container using ./launcher rebuild app but the plugin isnt listed in the plugins.

I’ve restarted the container manually, verified Discourse goes down, rebuilt it twice but no dice.

Is this common? Did I forget something rookie?

In the logs I note this line:
Done 'plugins/discourse-calendar-d817e8e4ce477eab195e8b0757efad8894e534419ec077ea59ed403c08ee36ec.js' : 1.16 secs
which to me looks like it’s installed something?

1 Like