How to change the number of unicorns?

To edit these settings you can edit the app.yml

cd /var/discourse
nano containers/app.yml

Around the line 48 you should have this:

## How many concurrent web requests are supported? Depends on memory and CPU cores.
  ## will be set automatically by bootstrap based on detected CPUs, or you can override
  UNICORN_WORKERS: 8

I’m not an expert in this area but you might want to check the lines ~30 to reduce the number:

  ## Set db_shared_buffers to a max of 25% of the total memory.
  ## will be set automatically by bootstrap based on detected RAM, or you can override
  db_shared_buffers: "2048MB"

Save the file (CTRL+X then Y usually), then you indeed have to rebuild discourse to use the new settings, using:

./launcher rebuild app

Your forum will be offline around 10 minutes during the process