Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pm2 startup centos, on v2.2.1, errors #2575

Closed
tmarshall opened this issue Dec 15, 2016 · 3 comments
Closed

pm2 startup centos, on v2.2.1, errors #2575

tmarshall opened this issue Dec 15, 2016 · 3 comments

Comments

@tmarshall
Copy link

If reporting a bug, please use the following template.

Expected behaviour

pm2 startup centos should exit 0

Actual behaviour

pm2 startup centos exits 1

Steps to reproduce

This is happening in one our company (BetterView) Dockerfiles.
Some key attributes of the Dockerfile:

FROM centos:centos6

COPY docker/docker-engine.repo /etc/yum.repos.d/

RUN yum clean all
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
RUN yum install -y tar curl sudo which git wget htop bc vim-enhanced epel-release docker-engine

USER root
RUN echo "alias vi='/usr/bin/vim'" >> ~/.bashrc
RUN echo "syntax on" >> ~/.vimrc

ENV HOME /root
ENV NODE_PATH /var/bv/code
ENV NODE_ENV staging

# node-gyp needs the right setup
RUN wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
RUN yum install -y devtoolset-2-gcc devtoolset-2-binutils
RUN yum install -y devtoolset-2-gcc-c++ devtoolset-2-gcc-gfortran
RUN echo "source /opt/rh/devtoolset-2/enable" >> /root/.bashrc

# phantomjs fonts
RUN yum install -y flex bison gperf freetype fontconfig libicu sqlite libpng libjpeg
RUN yum install -y cabextract xorg-x11-font-utils

# fonts needed for pdfs
COPY docker/msttcore-fonts-installer-2.6-1.noarch.rpm /root/msttcore-fonts-installer-2.6-1.noarch.rpm
RUN rpm -Uvh /root/msttcore-fonts-installer-2.6-1.noarch.rpm && fc-cache /usr/share/fonts/

# installing Node
RUN wget -O ~/node-v4.4.7-linux-x64.tar.xz https://nodejs.org/dist/v4.4.7/node-v4.4.7-linux-x64.tar.xz && \
  tar -C /usr/local --strip-components 1 -xJf ~/node-v4.4.7-linux-x64.tar.xz

# --- this line exits 1 ---
RUN npm install -g pm2@2.1.6 grunt@1.0.1 grunt-cli@1.2.0 mocha@3.2.0 enzyme@2.6.0 react@15.4.1 && \
  pm2 startup centos

This is run on CircleCI, which errors at that last step.

If you force npm to install an older version on pm2 (2.1.6) then it works fine.

Software versions used

OS         : Ubuntu 
node.js    : 4.4.7
PM2        : 2.2.1

CI logs

Step 21 : RUN npm install -g pm2 grunt grunt-cli mocha enzyme react &&   pm2 update &&   pm2 startup centos
 ---> Running in 922c47ff0b0b
/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
/usr/local/bin/mocha -> /usr/local/lib/node_modules/mocha/bin/mocha
/usr/local/bin/_mocha -> /usr/local/lib/node_modules/mocha/bin/_mocha
npm WARN optional dep failed, continuing fsevents@1.0.15
/usr/local/bin/pm2 -> /usr/local/lib/node_modules/pm2/bin/pm2
/usr/local/bin/rundev -> /usr/local/lib/node_modules/pm2/bin/rundev
/usr/local/bin/pm2-dev -> /usr/local/lib/node_modules/pm2/bin/pm2-dev
/usr/local/bin/pm2-docker -> /usr/local/lib/node_modules/pm2/bin/pm2-docker
/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt/bin/grunt
grunt-cli@1.2.0 /usr/local/lib/node_modules/grunt-cli
├── grunt-known-options@1.1.0
├── nopt@3.0.6 (abbrev@1.0.9)
├── findup-sync@0.3.0 (glob@5.0.15)
└── resolve@1.1.7

mocha@3.2.0 /usr/local/lib/node_modules/mocha
├── diff@1.4.0
├── escape-string-regexp@1.0.5
├── browser-stdout@1.3.0
├── growl@1.9.2
├── json3@3.3.2
├── supports-color@3.1.2 (has-flag@1.0.0)
├── commander@2.9.0 (graceful-readlink@1.0.1)
├── debug@2.2.0 (ms@0.7.1)
├── glob@7.0.5 (path-is-absolute@1.0.1, inherits@2.0.3, fs.realpath@1.0.0, inflight@1.0.6, once@1.4.0, minimatch@3.0.3)
├── mkdirp@0.5.1 (minimist@0.0.8)
└── lodash.create@3.1.1 (lodash._isiterateecall@3.0.9, lodash._basecreate@3.0.3, lodash._baseassign@3.2.0)

pm2@2.2.1 /usr/local/lib/node_modules/pm2
├── gkt@1.0.0
├── semver@5.3.0
├── eventemitter2@1.0.5
├── async@1.5.2
├── fclone@1.0.10
├── pidusage@1.1.0
├── commander@2.9.0 (graceful-readlink@1.0.1)
├── vizion@0.2.13
├── chalk@1.1.3 (escape-string-regexp@1.0.5, supports-color@2.0.0, ansi-styles@2.2.1, strip-ansi@3.0.1, has-ansi@2.0.0)
├── debug@2.4.4 (ms@0.7.2)
├── pm2-deploy@0.3.3 (tv4@1.2.7)
├── pm2-axon-rpc@0.4.5 (fclone@1.0.8)
├── pm2-multimeter@0.1.2 (charm@0.1.2)
├── cli-table@0.3.1 (colors@1.0.3)
├── mkdirp@0.5.1 (minimist@0.0.8)
├── source-map-support@0.4.6 (source-map@0.5.6)
├── nssocket@0.6.0 (eventemitter2@0.4.14, lazy@1.0.11)
├── pmx@0.6.8 (json-stringify-safe@5.0.1)
├── pm2-axon@3.0.2 (amp-message@0.1.2, escape-regexp@0.0.1, amp@0.3.1, debug@2.2.0)
├── cron@1.1.1 (moment-timezone@0.5.10)
├── yamljs@0.2.8 (glob@7.1.1, argparse@1.0.9)
├── shelljs@0.7.5 (interpret@1.0.1, glob@7.1.1, rechoir@0.6.2)
├── chokidar@1.6.1 (path-is-absolute@1.0.1, inherits@2.0.3, async-each@1.0.1, glob-parent@2.0.0, is-glob@2.0.1, is-binary-path@1.0.1, readdirp@2.1.0, anymatch@1.3.0)
└── moment@2.17.1

grunt@1.0.1 /usr/local/lib/node_modules/grunt
├── grunt-known-options@1.1.0
├── eventemitter2@0.4.14
├── path-is-absolute@1.0.1
├── rimraf@2.2.8
├── exit@0.1.2
├── nopt@3.0.6 (abbrev@1.0.9)
├── iconv-lite@0.4.15
├── coffee-script@1.10.0
├── minimatch@3.0.3 (brace-expansion@1.1.6)
├── glob@7.0.6 (inherits@2.0.3, fs.realpath@1.0.0, inflight@1.0.6, once@1.4.0)
├── findup-sync@0.3.0 (glob@5.0.15)
├── js-yaml@3.5.5 (esprima@2.7.3, argparse@1.0.9)
├── dateformat@1.0.12 (get-stdin@4.0.1, meow@3.7.0)
├── grunt-legacy-util@1.0.0 (getobject@0.1.0, async@1.5.2, hooker@0.2.3, which@1.2.12, underscore.string@3.2.3, lodash@4.3.0)
└── grunt-legacy-log@1.0.0 (hooker@0.2.3, colors@1.1.2, underscore.string@3.2.3, lodash@3.10.1, grunt-legacy-log-utils@1.0.0)

react@15.4.1 /usr/local/lib/node_modules/react
├── object-assign@4.1.0
├── loose-envify@1.3.0 (js-tokens@2.0.0)
└── fbjs@0.8.6 (ua-parser-js@0.7.12, promise@7.1.1, isomorphic-fetch@2.2.1, core-js@1.2.7)

enzyme@2.6.0 /usr/local/lib/node_modules/enzyme
├── is-subset@0.1.1
├── object-is@1.0.1
├── in-publish@2.0.0
├── uuid@2.0.3
├── object.assign@4.0.4 (function-bind@1.1.0, object-keys@1.0.11, define-properties@1.1.2)
├── function.prototype.name@1.0.0 (function-bind@1.1.0, is-callable@1.1.3, define-properties@1.1.2)
├── cheerio@0.22.0 (lodash.foreach@4.5.0, lodash.pick@4.4.0, lodash.assignin@4.2.0, lodash.flatten@4.4.0, lodash.defaults@4.2.0, lodash.bind@4.2.1, lodash.map@4.6.0, lodash.reduce@4.6.0, lodash.reject@4.6.0, lodash.filter@4.6.0, lodash.merge@4.6.0, lodash.some@4.6.0, entities@1.1.1, dom-serializer@0.1.0, css-select@1.2.0, htmlparser2@3.9.2)
├── object.entries@1.0.4 (has@1.0.1, function-bind@1.1.0, define-properties@1.1.2, es-abstract@1.6.1)
├── object.values@1.0.4 (has@1.0.1, function-bind@1.1.0, define-properties@1.1.2, es-abstract@1.6.1)
└── lodash@4.17.2

                        -------------

   Looking for a complete monitoring and management tool for PM2?
    _                             _        _            _
   | | _____ _   _ _ __ ___   ___| |_ _ __(_) ___ ___  (_) ___
   | |/ / _ \ | | | '_ ` _ \ / _ \ __| '__| |/ __/ __| | |/ _ \
   |   <  __/ |_| | | | | | |  __/ |_| |  | | (__\__ \_| | (_) |
   |_|\_\___|\__, |_| |_| |_|\___|\__|_|  |_|\___|___(_)_|\___/
             |___/

                          Features

                   - Real Time Dashboard
                   - CPU/Memory monitoring
                   - HTTP monitoring
                   - Event notification
                   - Custom value monitoring
                   - Real Time log display

                          Checkout

                   https://keymetrics.io/

                        -------------

[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
Be sure to have the latest version by doing `npm install pm2@latest -g` before doing this procedure.
[PM2] Saving current process list...
[PM2] Stopping PM2...
[PM2][WARN] No process found
[PM2] All processes have been stopped and deleted
[PM2] PM2 stopped
[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] Restoring processes located in /root/.pm2/dump.pm2
>>>>>>>>>> PM2 updated
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app
Platform centos
Template
[Unit]
Description=PM2 process manager
Documentation=https://pm2.keymetrics.io/
After=network.target

[Service]
User=undefined
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=8
Environment=PATH=/usr/local/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Environment=PM2_HOME=/root/.pm2
Restart=always
RestartSec=3

ExecStart=/usr/local/lib/node_modules/pm2/bin/pm2 resurrect --no-daemon
ExecReload=/usr/local/lib/node_modules/pm2/bin/pm2 reload all
ExecStopPre=/usr/local/lib/node_modules/pm2/bin/pm2 kill

[Install]
WantedBy=multi-user.target

Target path
/etc/systemd/system/pm2.service
Command list
[ 'chmod +x /etc/systemd/system/pm2.service',
  'systemctl enable pm2',
  'systemctl start pm2',
  'systemctl daemon-reload',
  'systemctl status pm2' ]
[PM2] Writing init configuration in /etc/systemd/system/pm2.service
[PM2][ERROR] Failure when trying to write startup script
ENOENT: no such file or directory, open '/etc/systemd/system/pm2.service'
The command '/bin/sh -c npm install -g pm2 grunt grunt-cli mocha enzyme react &&   pm2 update &&   pm2 startup centos' returned a non-zero code: 1

./bash/ci/build.sh $NODE_ENV $CIRCLE_BRANCH $(echo $CIRCLE_BRANCH | cut -f1 -d"/")-$CIRCLE_SHA1 returned exit code 1

Action failed: ./bash/ci/build.sh $NODE_ENV $CIRCLE_BRANCH $(echo $CIRCLE_BRANCH | cut -f1 -d"/")-$CIRCLE_SHA1
@Unitech
Copy link
Owner

Unitech commented Dec 15, 2016

[PM2] Writing init configuration in /etc/systemd/system/pm2.service
[PM2][ERROR] Failure when trying to write startup script
ENOENT: no such file or directory, open '/etc/systemd/system/pm2.service'
The command '/bin/sh -c npm install -g pm2 grunt grunt-cli mocha enzyme react &&   pm2 update &&   pm2 startup centos' returned a non-zero code: 1

./bash/ci/build.sh $NODE_ENV $CIRCLE_BRANCH $(echo $CIRCLE_BRANCH | cut -f1 -d"/")-$CIRCLE_SHA1 returned exit code 1

Seems like the /etc/systemd/system folder is not created?

@Unitech
Copy link
Owner

Unitech commented Dec 15, 2016

Replace the line:

RUN npm install -g pm2 grunt grunt-cli mocha enzyme react && pm2 update && pm2 startup centos

by

RUN npm install -g pm2 grunt grunt-cli mocha enzyme react && pm2 update && pm2 startup upstart

@tmarshall
Copy link
Author

@Unitech 👍 that fixed it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants