Cannot upgrade Discourse with 10 GB space

(Zsolt Ero) #1

I’m using Discourse on a VPS with 10 GB SSD space, using stable branch, no swap.
The forum has about 22 MB of total backup data (including attachments).
There is nothing else installed on the server, and never was.

Upgrade couldn’t complete, then I did a rebuild which completed but threw errors about no space left on device, yet the forum seems to be back up.

/var/lib/docker is 7.5 GB
/var/discourse is 285 MB

docker images -a says:

REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
local_discourse/app   latest              dd1e2641ac41        5 weeks ago         2.363 GB
discourse/discourse   1.3.10              1881a9bd3afd        7 weeks ago         1.539 GB
<none>                <none>              02022664486c        8 weeks ago         2.297 GB
<none>                <none>              ea110ef52b9c        8 weeks ago         2.296 GB
discourse/discourse   1.3.9               d2fbe0833acf        9 weeks ago         1.539 GB

Shouldn’t there be some automatic cleaning of docker images via docker-gc or similar?

A forum with 22 MB of data should really not have problems with space on a 10 GB VPS.

My only idea is to docker images -qa | xargs -r docker rmi before each upgrade and to use rebuild instead of upgrade every time. But this is a slow and stupid workaround.

(Jeff Atwood) #2

Clean up old Ubuntu security updates and old Docker images:

apt-get autoclean
apt-get autoremove
cd /var/discourse
./launcher cleanup

Also check your backups in Admin, Backups and remove old ones.

(Zsolt Ero) #3

Apt is cleaned by Unattended-Upgrade::Remove-Unused-Dependencies "true"; in my unattended upgrades conf.

Launcher cleanup might be a more optimal cleaning than docker images -qa | xargs -r docker rmi, but I was happy with a full clean.

But the issue I’m trying to raise here is that why do these things need to be done manually, from command line? This should be part of the normal upgrade cycle, if not, Discourse forum will brake at one point for all installations. Might be much later on bigger storage, but still it will.

And then users will ask for help and need to ssh and get scared and don’t understand why did clicking simple “start upgrade” button end up here.

(Jeff Atwood) #4

10gb is the minimum, and if you are pushing things down to the minimum, you can expect extra challenges. Our typical install is on a DO droplet which offers 30gb of disk for $10/month. And I believe Linode now offers 1gb ram and 20gb disk for $5/month.

Lower than that amount of disk space, you should expect to do some gymnastics to get things to fit.

(Zsolt Ero) #5

I don’t think we’d need such gymnastics to run Discourse on 10 GB :slight_smile:
After clean and rebuild the forum is happily running on 5.1 GB.

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       9.7G  5.1G  4.6G  53% /

The only issue was old and dangling images not being cleaned automatically, taking up 6 GB of space (from the first post). Is it by design?

(Jay Pfaffman) #6

It’s a side effect of how docker works. The script can’t automatically remove unused images because some people want them, and deleting them kuldip be unacceptable. It’s not like anyone benefits from having to answer this question repeatedly.

(Tom Newsom) #7

Can’t this just be an option in app.yml for those who need it?

(Zsolt Ero) #8

I don’t understand, there is probably <1% of Discourse users who prefer to keep old, garbage images on their server. Thus 99% of users have or will run into disk space problems.

As I understand Discourse wants to replace hacked-together PHP forums from 15 years ago, and as I see it is doing a lovely progress on it! But as long as you regularly need to SSH into your server to fix simple upgrades I believe it’s never going to happen.

I’d recommend to aim at being Wordpress simple and reliable for upgrade.

(Jay Pfaffman) #9

I think that for my $99 install clients, I might add a cron job that’ll run a ./launcher cleanup. This is very much the same as having to configure Ubuntu to Remove-Unused-Dependencies.

(Jeff Atwood) #10

I’ve logged into $99 installs that were 12 months old or more, and unless they update Discourse frequently you won’t have a lot of extra Discourse images floating around.

It would be safe and sane to automate

apt-get autoclean
apt-get autoremove
cd /var/discourse
./launcher cleanup

in general though. Those together can take upwards of 5GB after a year, most of it is the old Ubuntu kernels that are kept around after kernel security updates.

(Jay Pfaffman) #11

It’s recommended that they update Discourse frequently, and I’m pretty sure that the vast majority of my customers have never logged in.

(Jeff Atwood) #12

Regardless, it would take at least 2 years to run into a space problem for a typical install on digital ocean (30gb).


what is the link for 30gb of disk for $10/month?

(Jay Pfaffman) #14

A $10 digital ocean droplet.