How to recompile plugins and NOT to recompile Discourse?

How is it possible to recompile the plugin and NOT to recompile Discourse (not to update to the latest version)? I have a problem that Discourse has very frequent updates. Very often updates make plugins not working. I would like to recompile without Discourse update. Is it possible?

1 Like

Dear @Ed_Bobkov

You can accomplish the “essence” of what you want in an “unsupported way” by building Discourse with (1) your own base Discourse Docker image and (2) forked Discourse github code base, if you believe you absolutely must, by running a fork of the Discoures source code.

So, in that case you will need to:

See this line in the Discourse Dockerfile:

 git clone https://github.com/discourse/discourse.git &&\

and this line in the launcher script:

image="discourse/base:2.0.20200512-1735"

If you run a private Docker registry, you can push the Discourse base image (of your choice) to your private registry and so, for example:

image="localhost:5000/base:2.0.20200512-1735"

and likewise, if you fork Discourse, you can use that fork in the Dockerfile (above), for example:

 git clone https://github.com/your_git_account/discourse.git &&\

This will help you manage both the base Docker image and the build code.

Of course, this is not recommended because you will not benefit from all the bug fixes and security (and feature) updates from Discourse; and this method is both not supported nor recommended.

Hope this helps @Ed_Bobkov

Note: In this method, you are still rebuilding Discourse; but you are controlling (1) the version of the base Docker image and (2) the Discourse github repo code; and are “on your own” because this method is not supported, nor recommended, at all (to my knowledge).

See Also:

4 Likes

Thank you for very detailed answer! It’s not a simple way out. Strange that there is no a command to recompile without checking Discourse update.

1 Like

Hi @Ed_Bobkov

Well, there very well may be some “other method” that I do not know about :slight_smile: I defer to others for that.

I worked on this for many days a while back, and this was the “best I could come up with” after a lot of different “trial and errors”.

If there is an easier way, I would love to hear about it; but it does make sense if you work with Docker a lot.

First of all, the image must be built. Discourse starts with a base image and modifies it. When you add new plugins in production (Docker), you generally need to rebuild the container. Hence, that’s why I replied as I did above.

There are a lot of people here smarter than me on the topic of Discourse system admin, so maybe someone else has a better idea along the lines of what you are looking for.

Cheers!

4 Likes

If your goal is just to update a plugin without updating the Discourse version, then simply use the Docker Manager’s upgrade console accessed from the online dashboard and hit the relevant upgrade button for the specific plugin, e.g.:

https://your-site/admin/upgrade

Caveat #1: I believe this will only work with public assets, e.g. open source plugins. For private assets
accessed by deploy keys embedded in the build script you may need to rebuild the entire project.
Caveat #2: A lot of plugin updates are deployed to add compatibility for the latest build of Discourse. In most cases it makes sense to upgrade both to the latest version, because some upgrades can break compatibility with older versions of Discourse, but depends on what you are doing.

11 Likes