Ah, sorry, here it is
– it’s missing the plugins info, with docker, I missed that part… This is a wiki:
If you want to develop Discourse plugins, you need to setup a Discourse instance for development.
You can follow the developer setup guides:
One thing that’s missing from those guides is that the developer setup expects your UID to be 1000, otherwise you will get
1. Create a user for development
If your usual UID differs from 1000:
# groupadd -g 1000 discourse
# useradd -g 1000 -u 1000 -s /bin/bash -m discourse
We put the
discourse user in the
docker group so it can play with Docker, and in the
sudoers group so it can gain
root if needed.
We also want to use Ruby, so let’s install
# su - discourse
$ git clone https://github.com/postmodern/ruby-install
$ pushd ruby-install && sudo make install && popd
$ git clone https://github.com/postmodern/chruby
$ pushd chruby && sudo make install && popd
At the time of writing, Ruby is at version 2.6.3, let’s install it:
$ ruby-install ruby-2.6.3
$ echo 'source /usr/local/share/chruby/chruby.sh' >> ~/.bashrc
$ echo 'source /usr/local/share/chruby/auto.sh' >> ~/.bashrc
$ exec bash
2. Install Discourse
Now that we have a user with UID 1000 and Ruby installed, let’s move on to Discourse:
$ git clone https://github.com/discourse/discourse
$ cd discourse
$ echo '2.6.3' > .ruby-version
$ cd .
$ ruby --version
$ ./bin/docker/boot_dev --init
The installer will ask you for:
- an admin email
- an admin password (10 or more characters)
- the admin username will be the username of your email
Now let’s start the development server:
You’re ready to browse http://localhost:9292/
You can now stop the development server with:
3. Adding plugins
There’s a big caveat compared with non-Docker plugin development: you cannot use symlinks here!. So instead, you must either: 1) put your plugin repositories inside the
~/discourse/plugins directory, or 2) add a Docker volume for this directory (this won’t be covered here since early tests suggest difficulties).
Discourse will pick up plugins in its plugins directory. The easy way is to simply put your plugin development code there. So we can create a new plugin. There are several ways to do it, including a script (to be documented).
For now let’s do it by hand:
$ mkdir -p ~/discourse/plugins/sample-plugin
$ touch ~/discourse/plugins/sample-plugin/plugin.rb
Now you’re ready to follow the Beginner’s Guide to Discourse Plugin Development series.