Procedure to update standard plugins

I have a small, self-hosted Discourse site created with a standard Docker installation. I’ve installed plenty of plugins into over the years by editing the hooks at the end of containers/app.yml file to git clone a plugin repository. I’ve done a bit of plugin development, as well.

A few months ago, though, many standard plugins were merged into Discourse core. Let’s suppose I fork the whole Discourse repo, edit one of those plugins (say, discourse-math), and get the changes working beautifully in my local development environment. What’s the procedure to get this new plugin into my production Discourse instance?

out of interest - why do you need to fork any of the official plugins?

In any case in app.yml you can run a command to delete the specific plugin directory then clone your own if you absolutely need to, e.g.:

<in after_code: somewhere >
    - exec:
        cd: $home/plugins
        cmd:
          - rm -r poll
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/myaccount/myplugin-replacement.git

you might be able to do this, but check:

<in after_code: somewhere >
    - exec:
        cd: $home/plugins
        cmd:
          - rm -r poll
          - git clone https://github.com/myaccount/myplugin-replacement.git

I haven’t been that careful with spaces - make sure indentation is perfect.

2 Likes

Because, I’m hoping to update the outdated version of MathJax that’s used by the discourse-math plugin.

OK, it looks to me like this line is what I’m missing:

cmd:
  - rm -r poll

To be clear, though, what is poll? I would think I should remove the old discourse-math directory to prevent the conflicts that I seem to be getting. That is, something like

cmd:
  - -r plugins/discourse-math

Doesn’t look like a good command to go running willy-nilly. :slight_smile:

It doesn’t matter if you make a mistake, just rebuild if you do.

My example was with poll plugin.

Don’t repeat the plugin directory.

2 Likes

@merefield Incidentally, I think you might like the animation on my front page: https://discourse.marksmath.org/

I used some of your code in the process.

1 Like

Ha, nice, now add a click to user card! :slight_smile:

2 Likes

This did the trick @merefield - thanks a lot !!!

1 Like

That might be a change that is pr-welcome for the official plugin. If you are interested in talking a stab at that for the benefit of everyone relying on the plugin, start a Feature topic to propose it.

3 Likes