Running out of memory for assets:precompile with bitnami

AI-generated summary

A user is experiencing out-of-memory (OOM) errors during the assets:precompile step when installing Discourse using the Bitnami image, despite having 6GB of RAM. The issue occurs during the Ember build process, which consumes excessive memory. Another user advises that the Bitnami image is unsupported and recommends using the official installation guide, which is optimized for lower resource usage. The original user resolves the issue by setting environment variables CHEAP_SOURCE_MAP S=1 and JOBS=1, which reduces memory usage and allows the build to complete successfully. davispuh david davispuh

Hi,

I’m trying to install Discourse but assets:precompile step is getting OOM killed.
I have 4 cores and 6 GB of RAM but it’s still not enough.

26604 ?        Ss     0:00  \_ sh -c RAILS_ENV=production bundle exec rake assets:precompile
26611 ?        S      0:02      \_ sh -c CI=1 yarn --cwd app/assets/javascripts/discourse run ember build -prod && SKIP_EMBER_CLI_CO
26673 ?        Sl     0:24          \_ node /opt/bitnami/node/bin/yarn --cwd app/assets/javascripts/discourse run ember build -prod
26695 ?        S      0:00              \_ /bin/sh -c /opt/bitnami/discourse/node_modules/.bin/ember build -prod
26696 ?        Sl     3:14                  \_ ember
26749 ?        Ssl    0:47                      \_ /opt/bitnami/node/bin/node /opt/bitnami/discourse/node_modules/thread-loader/dist
26757 ?        Ssl    0:44                      \_ /opt/bitnami/node/bin/node /opt/bitnami/discourse/node_modules/thread-loader/dist
26774 ?        Ssl    0:59                      \_ /opt/bitnami/node/bin/node /opt/bitnami/discourse/node_modules/thread-loader/dist
Out of memory: Killed process 26655 (ember) total-vm:67001688kB, anon-rss:1271204kB, file-rss:128kB, shmem-rss:0kB, UID:101 pgtables:39516kB oom_score_adj:200

Is there a way to limit precompile process to just 1 core or some way to reduce RAM usage?

The bitnami image isn’t maintained or recommended by us, so I’m afraid it’s tricky to help here. We always recommend following our standard install guide, which is regularly tested on small machines (1GB RAM + 2GB swap).

If you must stick with the bitnami image, then I’d recommend checking you’re on the latest version of Discourse. There have been a few improvements to memory requirements & build speed over the last year or so.

Yeah I’m on latest image (3.3.0). I added CHEAP_SOURCE_MAPS=1 JOBS=1 and now it succeeded without getting OOM killed.