Limiting Discourse memory usage on a dedicaded box

(Robert Jan De Dreu) #1

I’m hosting a discourse forum on one of my dedicaded server. The problem is that as it is now to can use the full 32GB memory that is on the dedicaded box (this already happened once).

What is the best way to edit the launcher or config file to limit how memory much the docker instance will use?

(Gerhard Schlager) #2

Docker allows limiting the memory with the -m option.
However, I don’t think that the launcher can do this out of the box at the moment. You’ll probably need to change it within the launcher script.

(Robert Jan De Dreu) #3

What would be the best way to edit the launcher script. Are there any recommendations on what to change?

(Gerhard Schlager) #4

I haven’t tested this yet, but changing line 289 in the current launcher script to the following should work.

$docker_path run $restart_policy "${env[@]}" -h "`hostname`-$config" -m="4g" -e DOCKER_HOST_IP=$docker_ip --name $config -t --cidfile $cidfile $ports \

I’ve added -m="4g" in order to limit the container to 4GB of memory.