Jonathan Trew
Jonathan Trew

Reputation: 11

Openshift Online failing to build angular app, Out of Memory

So I will prefix this and say that my issue is very similar to the one here: Open Shift Angular 8 Application Out of Memory Issue

I wanted to add a comment to the older question, but I am a new SO user and don't have enough rep yet...

So, my issue: I have created an Openshift Online free account to do some experiments and thought a good first step would be to just get a simple container running a basic web-app. So I have used the OS web console to create an app that is based off the catalogue option for Modern Web App (as I wanted to try out S2I). This I pointed to my bitbucket repo and made sure the secrets were all set-up correctly. Once I could see the builds pulling from the repo correctly in the logs I thought it was sorted; I am however seeing this in the logs and all builds are failing:

...
> ng build


Compiling @angular/core : es2015 as esm2015

Compiling @angular/common : es2015 as esm2015

Compiling @angular/platform-browser : es2015 as esm2015

Compiling @angular/platform-browser-dynamic : es2015 as esm2015

Compiling @angular/router : es2015 as esm2015
Generating ES5 bundles for differential loading...
/usr/libexec/s2i/assemble: line 62:   291 Killed                  $NPM_BUILD
subprocess exited with status 137
subprocess exited with status 137
error: build error: error building at STEP "RUN /usr/libexec/s2i/assemble": exit status 137

All I have in the repo is what came from downloading the latest version of Angular 9 and running the standard ng create-app command. I have no idea why it would be taking up so much memory...

Having searched the issue, the linked question is the closest I found and any other source of advice seems to suggest the same fix. Now I have increased the memory limit for said Build Config up to 1GB and it still fails - it wasn't even getting past the compiling stages and onto generating the bundles before, so it has definitely changed the situation. I tried increasing the limit further but it seems that Openshift (or OS Online version) has a hard cap on 1GB of memory per pod, and to be honest, while it would be great to know if that would fix the issue, I'd rather figure out why something that builds on my machine in under 500MB of RAM is suddenly chewing up all it can find inside the container...

Hope someone can help, Thanks in advance!

Upvotes: 1

Views: 1222

Answers (1)

Ivan Gorbunov
Ivan Gorbunov

Reputation: 11

I've faced the issue and I've found a workaround. You could:

  • build image locally
s2i build https://github.com/gorbunov-ia/Diaries-web.git -r master -e OUTPUT_DIR=dist/diaries nodeshift/ubi8-s2i-web-app:latest diaries-web
  • add a docker tag
docker tag diaries-web default-route-openshift-image-registry.apps.ca-central-1.starter.openshift-online.com/diaries/diaries-web
  • login to an openshift registry
docker login default-route-openshift-image-registry.apps.ca-central-1.starter.openshift-online.com -u $(oc whoami) -p $(oc whoami -t)
  • push the image to the registry
docker push default-route-openshift-image-registry.apps.ca-central-1.starter.openshift-online.com/diaries/diaries-web
  • create the app from the image

Upvotes: 1

Related Questions