Beginner's Guide to Creating Discourse Plugins - Part 1


(Mittineague) #7

Try these

(Michael Kitzman) #8

That was absolutely it! Thank you very much for that!

Running rake admin:create was absolutely what I wanted.


Thanks for the guideline

(Frank Piva) #13

I followed these instructions and was not able to get the alert box to show up on my site.

I can view the plugin from the Admin panel, but after restarting my container there is no alert box that shows up. I have also tried console approach instead of using an alert, but have not had any luck. I have double-checked for typos, but haven’t found any.

Is this tutorial outdated?

(Jeff Atwood) #14

Anything here we need to update @eviltrout?

(Robin Ward) #15

Are you trying to use this guide in production? Because it is meant to be used in a development environment as a way of creating plugins. The reason I ask is you said container which is how we host discourse in production mode.

In production, you have to have a plugin installed using git clone commands.

(Frank Piva) #16

This makes sense then. I am running Discourse in production mode, and have previously installed plugins by adding git clone commands to the .yml file. I’ll try to get a development environment going and see if I have success.

(Frank Piva) #17

Ok, so I FINALLY got a development instance of Discourse running, but I am still unable to see the alert box. Again, I have checked to make sure I didn’t make any typos in the path name or in the code itself. After creating alert.js.es6 I ran ‘bundle exec rails s -b’. The site is still accessible through the browser, but no alert box. I can see the plugin in the admin panel, but it is only in black text; unlike the rest of the plugins which are in blue.

I am a Discourse/Rails newbie so I apologize if I am making an obvious mistake.

(Alan Tan) #18

Can you push your code to Github and link it here? Otherwise, it’ll be hard to see what is going wrong :slightly_smiling:

(Robin Ward) #19

Did you try the impotrant gotcha referred to here?

(Frank Piva) #20

I thought I tried clearing out the /tmp directory, but when I tried it a second time it worked. For the record though, bundle exec rails s does not start the server on my instance. I have to run bundle exec rails server -b in order to get the instance to serve pages.

(Tyler Thrailkill) #21

I also cannot get the alerts to load. Here’s a link to the repo with the plugin, nothing else has changed besides the plugins folder. GitHub - snowe2010/discourse_plugins: Writing some plugins


Did you nuke the tmp directory and restart rails?

I got to page 5 before issue popped up.

(Tyler Thrailkill) #23

Yeah I’ve nuked it almost every single time. What do you mean you got to page 5 before the issue popped up?


I mean that getting through the first 4 pages proved doable for me, and this was all late lastnite and today. So it’s not an issue of outdated info.

That’s where I’m stuck.

Are you doing a hard refresh? On chrome I’m hitting ctrl-f5 after restarting rails.

(Tyler Thrailkill) #25

Dang. Well I can’t even get past this first tutorial.


We’re equally noobish in the grand scheme, don’t feel bad. Let’s get you to where I’m at see if you can push both of us passed.

(Mittineague) #27

Does this solve it for you?

(Tyler Thrailkill) #28

finally got it working, no clue what changed but the last few commands I ran were (as the vagrant user in the vagrant vm) rm -rf tmp and then sudo rm -rf /tmp

I feel I should stress that I ran these commands maybe 20 times before this time and in none of the previous tries did this work.


Perhaps discourse was continuously writing files to tmp directory for some reason?

At any rate I wrote a line in /etc/crontab to nuke the tmp directory every second :smile:

Just got my server properly setup with ubuntu 16.04 so going to try page 5 again, someone wrote a reply apparently the instructions were incorrect.

Looks like we’re both making progress :+1:

This is what I eventually stumbled on to make it work:

Would have taken me a week to figure all that out on my own.