Is it the same process to update Discourse via the browser, or via Terminal using the ./launcher rebuild app?
If so, any advantages of one over the other, other than being able to update plugins individually?
I’m no expert in this, so I’m sorry if I’m saying something that doesn’t make sense.
I’m asking this, because it’s the second time I try to update via the browser and it gets stuck. The first time it started and got stuck in the middle of the updating process, and then last night (2nd time) I hit the update button, went to bed, and this morning it hadn’t even begin. I had to Cancel and restart.
Use the UI when possible to minimise downtime (few seconds)
Occasionally some forms of update (e.g. update postgres version) require a command line update. This is necessary on those occasions but does lead to some downtime on standard install. Usually about 20 minutes. Pick an off-peak period.
Those occasions should be obvious from the UI.
If you want to add or remove a plugin, you will need to use the console rebuild.
As I’m updating now, I noticed that the forum is still working, but sometimes a bit slower. This is good compared to using Terminal, which seems to completely make the forum not work. Thanks for clarifying this.
Even for a non-expert like myself? I mean, will it say something that shows me I should use Terminal instead?
Technologically speaking, do you think this will eventually change one day where we can do everything in the browser? I don’t know the technicalities of this process, that’s why I’m asking.
You can find resources on here to configure a “we’re offline, come back later screen” to mitigate those 20 minutes, but it’s not the standard install and I would suggest you keep things simple and easily supported.
Here’s what I noticed, but don’t know if it’s a coincidence: when it gets stuck on that state where nothing happens, I click Reset Update. Try to restart, nothing happens. Then I go back to the page with all the updates, and click the Update button. This time, it starts the update. Not sure if there’s something broken in the code that after a reset, the button to restart, doesn’t actually do anything? I have no clue, but I’m just sharing my experience.
Now it’s updating again, after I did what I just described.
I’m confused now… it crashed again, but when I refreshed the browser it said that Discourse was at the newest version…
When I went to the main updates page where the plugins are, it indeed showed Discourse as being updated
It seems that this error message has been very common lately, and was always fixed by creating swap. I don’t know why since Discourse’s official requirements have not changed.
Then ./discourse-setup should have created a swap automatically. I’m not well versed in the arcanes of system administration so I’ll let others tell more about this.
That said, even with more than the requirements, users have come across this issue, so there’s something fishy.
As for the update from the interface, I’ve found it a bit unreliable over the years. I’m not sure why, it seems it sometimes fails without obvious reason when a rebuild works.
Is there a way, via Terminal, to see if there is one already? (Maybe this answers my question? I’m not well versed in the arcanes of system administration)
Ok, so I guess I’m not alone here.
I’m a bit confused… using Terminal are those 2 different things? Update and Rebuild? Because I’ve been using just ./launcher rebuild app and that always works.
Oh ok, now it makes sense
Yes, that’s my experience as well.
The downside is that the rebuild completely shuts down the forum, which is not ideal, but oh well… we gotta do what we gotta do.
Without expertise in this, I used Claude and ChatGPT to help me figure things out. So, as suggested, I went the swapfile route, but as it was pointed out, maybe I had already a swapfile based on how I installed Discourse. To make sure I did, I ran
sudo swapon --show
in Terminal and I got this:
So I looked at the “USED” column and thought: “well, if the swapfile is used to help things run smoother when RAM is not enough, but it says the swapfile is using 1.9GB out of 2GB, that will not help”
So I asked ChatGPT if I could just clear/empty the swapfile and I got this command:
sudo swapoff -a && sudo swapon -a
Ran it, let it do its thing and ran the other one again:
sudo swapon --show
Now I see this:
So I guess that it’s good to go through this process of cleaning/emptying the swapfile once in a while?
With a two container install, you can build a new container while the old one continues to work (if you have enough ram). That gives you little downtime.
You have to do a command line rebuild sometimes because underlying libraries need to be updated and those can’t be done from the ux.
You can
cd /var/discourse
grep swap discourse-setup
to see the commands that it does to create the swap. If you run swapoff (so that the file is no longer busy) you can then run the commands that create the file (fsallocate) making it bigger, if desired, and format it as swap (mkswap) and then swapon -a to turn it back on.
If you’ve got many plugins you likely need a total of 5 or 6gb.