# Rebuild the forum using code?

**URL:** https://meta.discourse.org/t/rebuild-the-forum-using-code/352173
**Category:** Development
**Tags:** code
**Created:** [February 13, 2025, 11:04pm UTC](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173 "2025-02-13T23:04:36Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [February 13, 2025, 11:04pm UTC](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173/1 "2025-02-13T23:04:36Z")

</div>

I had a few random ideas that popped into my head, and one of them was _a plugin to install plugins_. That requires a forum rebuild. Is there a way to rebuild using Ruby? I really don’t want to try:

```ruby
p `cd ../../`
p `. /launcher rebuild app`

```

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [February 13, 2025, 11:14pm UTC](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173/2 "2025-02-13T23:14:16Z")

</div>

In a [standard install](https://meta.discourse.org/t/142537?silent=true), Discourse (and therefore, plugins) are running inside a docker container. That container does not have complete access to the host filesystem, so it can’t access the host’s `/var/discourse` directory to modify `app.yml` or run `launcher`.

And even if it could… there’s a bit of a circular dependency here. Running `./launcher rebuild` would kill the docker container… which would kill the `launcher rebuild` which you started from the plugin 💥

There are potential solutions here. e.g. adding additional docker volume mounts, so that the config/launcher can be accessed from within the container. But it’s not trivial.

IIRC someone once made a ‘plugin manager’ plugin… which required some tweaks to the app.yml to add things like the volume mount. But I can’t find any topics about it now, so I assume it’s no longer maintained. Perhaps someone else can share a link if they can find it? (or maybe it was all a dream 😅)

On the CDCK side, we definitely err towards using themes when we want customers to be able to install/update/uninstall at will. Allowing people to arbitrarily install plugins isn’t an option, because that would affect other customers running on the same server.

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [February 13, 2025, 11:16pm UTC](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173/3 "2025-02-13T23:16:54Z")

</div>

> [@david](#):
>
> Perhaps someone else can share a link if they can find it? (or maybe it was all a dream 😅)

Yep, here it is:

> [@ProCourse Installer](https://meta.discourse.org/t/procourse-installer/115476):
>
> This plugin is designed to make it extremely easy to install new plugins without logging into the server. It adds a screen under /admin/plugins/procourse-installer that looks like this: From there, you can enter the URL (with or without .git) of the plugin git repo and click Install Plugin. Wait a few minutes (about 5 minutes) for the installation to complete and you’re good to go. To see all the plugins you’ve installed through the installer or to remove a plugin, just go to Install…

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [February 13, 2025, 11:17pm UTC](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173/4 "2025-02-13T23:17:46Z")

</div>

> [@david](#):
>
> That container does not have complete access to the host filesystem, so it can’t access the host’s `/var/discourse` directory to modify `app.yml` or run `launcher`.

Hmm… I see.

> [@david](#):
>
> Running `./launcher rebuild` would kill the docker container… which would kill the `launcher rebuild` which you started from the plugin 💥

Oh, whoops, I didn’t think of that!

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 14, 2025, 12:34am UTC](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173/5 "2025-02-14T00:34:36Z")

</div>

[Dashboard.literatecomputing.com](http://Dashboard.literatecomputing.com) will install and remove plugins by editing the app.yml (or web\_only.yml) and doing the rebuild (actually, bootstrap, destroy, rebuild). On a two container install, the downtime is minimal.

It also does stuff like upgrade docker, and postgres, docker prune, and so on. Since it’s all managing a [standard install](https://meta.discourse.org/t/142537?silent=true), you’re not tied in to it, and it can’t break anything unless it’s actually doing something (like installing a bad plugin).

It’s a (private) discourse plugin that drives an ansible playbook. You can join the free trial group and use it for free (with limited support).

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [February 14, 2025, 5:04am UTC](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173/6 "2025-02-14T05:04:49Z")

</div>

This plugin seems to just clone the repository into the `/plugins` directory. Interesting.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [February 14, 2025, 5:34am UTC](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173/7 "2025-02-14T05:34:33Z")

</div>

ProCourse Installer was amazing! It’s too bad it created issues for some plugins.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 14, 2025, 6:44pm UTC](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173/8 "2025-02-14T18:44:37Z")

</div>

> [@NateDhaliwal](#):
>
> Is there a way to rebuild using Ruby?

You can do something like this inside the container to add a plugin to an existing container:

```plaintext
cd /var/www/discourse/plugins
git clone my-plugin-url
rake db:migrate assets:precompile
sv restart unicorn

```

But the problems of keeping the plugins in the container and in the `app.yml` for when you rebuild next are there.

I’ve been burned a number of times doing a `./launcher destroy app;./launcher start app` to apply new ENV variables from `app.yml` only to find that the “new” container is behind the version that the database is. It’s even worse if someone has upgrade only some plugins in the container that worked with the version of Discourse that was in the old container, but not with the one that you get when you rebuild. . .

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [February 15, 2025, 12:39am UTC](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173/9 "2025-02-15T00:39:57Z")

</div>

So that’s why the ProCouese plugin only _cloned_ the repositories, and can only be removed via that plugin page to `rm -rf` the vloned plugin folder.

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [February 15, 2025, 2:37am UTC](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173/10 "2025-02-15T02:37:34Z")

</div>

> [@NateDhaliwal](#):
>
> Yep, here it is:
> 
> > [@](#):
> >
> > This plugin is designed to make it extremely easy to install new plugins without logging into the server. It adds a screen under /admin/plugins/procourse-installer that looks like this

It actually worked quite decently as a proof of concept. It could use some tweaks though as it was said it could make troubleshooting more difficult. So maybe need some command line info how to access the procouree installer. Maybe better log file.

The plus though is you can disable all plugins simply by removing l/commenting out pro course installer. Though it is broken now.

Joe has some very forward ideas. Iirc he made the initial Post Voting plugin?
