Search code examples
node.jsibm-cloudcontinuous-deliverydevops-services

How to avoid "no space left on device" on Bluemix pipeline staging?


I'm using Bluemix ToolChain service, i.e. CI service.

Deploy staging failed because no space left to device.

I changed disk_quota setting default to 1024M and 2048MB using manifest.yml, but the both results are the same as default disk_quota.

Also I tried buildpack setting default to sdk-for-nodejs because if I use default value, it will download many unnecessary buildpack files (e.g. java related buildpack). I thought it will bring saving space, but the result is the same again.

How can I fix this? Do you have any ideas?

Here is the error log. (Too long log, so I replace some logs to ":")

Target: https://api.ng.bluemix.net
Using manifest file /home/pipeline/aafdbd4d-c22d-4fee-ae34-8d1146cacb56/manifest.yml

:
:
Uploading 101M, 117985 files


Done uploading
OK

:
:
Downloading sdk-for-nodejs...
Downloaded sdk-for-nodejs
Creating container
Successfully created container
Downloading app package...
Downloaded app package (107.3M)
Downloading build artifacts cache...
Downloaded build artifacts cache (6M)
Staging...
-----> IBM SDK for Node.js Buildpack v3.10-20170119-1146
       Based on Cloud Foundry Node.js Buildpack v1.5.24
-----> Creating runtime environment

       NPM_CONFIG_LOGLEVEL=error
       NODE_MODULES_CACHE=true
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)

       Resolving node version (latest stable) via 'node-version-resolver'
       Installing IBM SDK for Node.js (4.7.2) from cache
-----> Restoring cache
-----> Checking and configuring service extensions before installing dependencies
-----> Building dependencies
       Prebuild detected (node_modules already exists)
       Rebuilding any native modules
       Skipping cache restore (new runtime signature)
       body-parser@1.17.1 /tmp/app/node_modules/body-parser
       :
       :
       core-util-is@1.0.2 /tmp/app/node_modules/webpack/node_modules/memory-fs/node_modules/readable-stream/node_modules/core-util-is
-----> Installing App Management
-----> Caching build
       Saving 2 cacheDirectories (default):
       Clearing previous node cache
       - node_modules
-----> Build succeeded!
       ├── body-parser@1.17.1
       ├── bootstrap@3.3.7
       ├── config@1.25.1
       ├── express@4.15.2
       ├── jquery@3.1.1
       ├── react@15.4.2
       ├── react-dom@15.4.2
       ├── react-redux@4.4.6
       ├── redux@3.6.0
       ├── redux-thunk@2.2.0
       ├── request@2.80.0
       └── request-promise@4.1.1

cp: cannot create regular file ‘/tmp/contents666597699/app/node_modules/babel-core/node_modules/babel-register/node_modules/core-js/library/modules/_date-to-primitive.js’: No space left on device
:
:
cp: cannot create regular file ‘/tmp/contents666597699/app/node_modules/babel-core/node_modules/babel-register/node_modules/core-js/library/modules/es6.regexp.search.js’: No space left on device
cp: : No space left on device
Exit status 1
Staging failed: Exited with status 1
Destroying container
cp: cannot create regular file ‘/tmp/contents666597699/app/node_modules/babel-core/node_modules/babel-register/node_modules/core-js/library/modules/_wks.js’: No space left on device
Successfully destroyed container

FAILED
Error restarting application: StagingError

TIP: use 'cf logs kcuc-web --recent' for more information

Finished: FAILED

And also this is my manifest.yml file.

applications:
- path: .
  memory: 256M
  instances: 1
  domain: mybluemix.net
  name: xxxxx
  host: xxxxx
  disk_quota: 1024M
  buildpack: sdk-for-nodejs
  env:
    DEBUG: 'false'
    API_PROTOCOL: https
    API_HOST: xxxxx.mybluemix.net
    API_PORT: '443'
    CLIENT_PORT: '443'

Solution

  • I got the answer on developerWorks. (Thank you, Todd Kaplinger.)

    Copies unnecessary node_modules directory on deploy phase is root cause. So, I must add .cfignore and add node_modules/. (Syntax is like a .gitignore)

    (Why unnecessary? Because build -> deploy is chained process, so build is already finished. In that case, node_modules directory is unnecessary on deploy phase.)

    After that, download app package size becomes under 1MB and unnecessary copy task is eliminated. As a result, not only deploy is succeeded, but deploy staging speed becomes much faster.