Properly load hubot-scripts with NPM Hubot install #339

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@Iristyle

This builds on a prior __dirname patch from @keithduncan

github#334
That pull should be made first

When Hubot is installed from NPM, the relative path of
../hubot-scripts.json is no longer valid

An npm install looks like

myhubot
  node_modules
    hubot
      bin
        hubot
    hubot-scripts
      src
        scripts
  hubot-scripts.json

Thefore the original paths specified here are not correct.  We don't
run on Heroku, so the original path resolutions are left intact, with
fallbacks to the NPM style install if things don't exist.

Opted for sync Fs API here since this is an initial load and won't
hurt perf.

Properly load hubot-scripts with NPM Hubot install
This builds on a prior __dirname patch from keithduncan

When Hubot is installed from NPM, the relative path of
../hubot-scripts.json is no longer valid

An npm install looks like

myhubot
  node_modules
    hubot
      bin
        hubot
    hubot-scripts
      src
        scripts
  hubot-scripts.json

Thefore the original paths specified here are not correct.  We don't
run on Heroku, so the original path resolutions are left intact, with
fallbacks to the NPM style install if things don't exist.

Opted for sync Fs API here since this is an initial load and won't
hurt perf.
@Iristyle

This comment has been minimized.

Show comment Hide comment
@Iristyle

Iristyle Aug 23, 2012

Closed pull req github#338 as this supersedes it

Closed pull req github#338 as this supersedes it

@Iristyle

This comment has been minimized.

Show comment Hide comment
@Iristyle

Iristyle Sep 24, 2012

@technicalpickles @tombell

Any chance to look at this? What's currently in Hubot will not work for us when installing from NPM as mentioned above. All the configured scripts are loaded OK, but core commands like help are not. If the path loading is modified based on the pull reqs, then we're good to go.

@technicalpickles @tombell

Any chance to look at this? What's currently in Hubot will not work for us when installing from NPM as mentioned above. All the configured scripts are loaded OK, but core commands like help are not. If the path loading is modified based on the pull reqs, then we're good to go.

@technicalpickles

This comment has been minimized.

Show comment Hide comment
@technicalpickles

technicalpickles Sep 24, 2012

Contributor

Not yet, been a little crazy here recently.

I'm not sure I follow what the exact problem is. In particular, our hubot install is npm-installed and not having problems loading things. I can see about reproducing, but if you could include some backtraces and whatnot showing what's up, that would hel.

Also, what version of hubot are you using?

Contributor

technicalpickles commented Sep 24, 2012

Not yet, been a little crazy here recently.

I'm not sure I follow what the exact problem is. In particular, our hubot install is npm-installed and not having problems loading things. I can see about reproducing, but if you could include some backtraces and whatnot showing what's up, that would hel.

Also, what version of hubot are you using?

@Iristyle

This comment has been minimized.

Show comment Hide comment
@Iristyle

Iristyle Sep 24, 2012

Interesting... I have a local script that kicks off the install of Node / Redis / other deps on an EC2 Ubuntu instance..

Cloudinit calls install-ubuntu.sh:

#!/bin/sh

#binary install of node
apt-get install -y python-software-properties
add-apt-repository -y ppa:chris-lea/node.js
apt-get update -y

apt-get install -y build-essential libssl-dev git-core redis-server libexpat1 libexpat1-dev libicu-dev
apt-get install -y nodejs nodejs-dev npm libxml2-dev

#to be able to use hubot at the command line
npm install -g coffee-script node-gyp

#can be used to start server by hand OR by upstart script
chmod +x ./start-hubot.sh

#upstart configuration - starts start-hubot.sh as user config'd in hubot.conf
cp -f ./hubot.conf /etc/init/hubot.conf

#kick off upstart daemon
start hubot

The upstart script hubot.conf look like:

# hubot ubuntu upstart script

description "Hubot HipChat bot"

start on filesystem or runlevel [2345]
stop on runlevel [!2345]

# Keep the process alive, limit to 5 restarts in 60s
respawn
respawn limit 5 60

env RUN_AS_USER=lighthouse

#this will ensure that all hubot output gets sent to syslog
script
  set -e
  mkfifo /tmp/hubot-log-fifo
  ( logger -t hubot </tmp/hubot-log-fifo & )
  exec > /tmp/hubot-log-fifo
  rm /tmp/hubot-log-fifo
  exec start-stop-daemon --start -c $RUN_AS_USER -u $RUN_AS_USER -m \
  -p /var/run/hubot.pid --exec /opt/hubot/start-hubot.sh 2>/dev/null
end script

And the Hubot run script start-hubot.sh looks like:

#!/bin/sh

# Path to Hubot installation
export HUBOT_DIR='/opt/hubot/'
export ADAPTER='hipchat'
# Name (and local user) to run Hubot as
export HUBOT_USER='lighthouse'
# httpd listen port
export PORT='5555'

# Environment variable export's
<snip/>
export PATH="${HUBOT_DIR}node_modules/.bin:${HUBOT_DIR}node_modules/hubot/node_modules/.bin:$PATH"

cd ${HUBOT_DIR}
#clone the source from our customized repo - including our package.json and custom scripts

sudo chmod 600 scripts/testkey.pem
npm update
exec node_modules/hubot/bin/hubot --name ${HUBOT_USER} --adapter ${ADAPTER} --alias '/'

Our package.json looks like this

{
  "name":        "eps-hosted-hubot",
  "version":     "2.3.2",
  "author":      "GitHub Inc.",
  "keywords":    "github hubot hipchat bot",
  "description": "A simple helpful Robot for your Company",
  "licenses":     [{
    "type":       "MIT",
    "url":        "http://github.com/github/hubot/raw/master/LICENSE"
  }],

  "repository" : {
    "type" : "git",
    "url" : "http://github.com/github/hubot.git"
  },

  "dependencies": {
    "hubot": ">= 2.3.2",
    "hubot-hipchat": ">= 1.0.4",
    "hubot-scripts": ">= 2.1.1",
    "optparse": "1.0.3",
    "coffee-script": "1.3.3",
    "node-stringprep": "0.1.4",
    "scoped-http-client": "0.9.7",
    "log": "1.3.0",
    "connect": "2.3.4",
    "connect_router": "1.8.6",
    "githubot": "0.2.0",
    "date-utils":"1.2.5",
    "htmlparser":"1.7.6",
    "handlebars":"1.0.5beta",
    "scribe-node":"0.0.24",
    "underscore":"1.3.3",
    "underscore.string":"2.2.0rc",
    "wwwdude":"0.1.0",
    "xml2js":"0.1.13",
    "jsdom":"0.2.15",
    "nodepie":"0.4.0",
    "soupselect":"0.2.0",
    "aws2js":"0.6.12",
    "moment":"1.6.2"
  }
}

The directory layout is pretty flat

\opt\hubot
  hubot-scripts.json
  hubot.conf (copied out to /init/etc/hubot.conf)
  install-ubuntu.sh (run once by Cloudinit)
  package.json
  start-hubot.sh (run by Upstart)
\opt\hubot\scripts
  custom local scripts

We were running on 2.3.2, but I just noticed our bot died, and kicked off a new (presumably 2.3.4) install... of course, my tweaks were blown away, and Hubot isn't responding to commands like help once again. But it seems to work for any others just fine.

Interesting... I have a local script that kicks off the install of Node / Redis / other deps on an EC2 Ubuntu instance..

Cloudinit calls install-ubuntu.sh:

#!/bin/sh

#binary install of node
apt-get install -y python-software-properties
add-apt-repository -y ppa:chris-lea/node.js
apt-get update -y

apt-get install -y build-essential libssl-dev git-core redis-server libexpat1 libexpat1-dev libicu-dev
apt-get install -y nodejs nodejs-dev npm libxml2-dev

#to be able to use hubot at the command line
npm install -g coffee-script node-gyp

#can be used to start server by hand OR by upstart script
chmod +x ./start-hubot.sh

#upstart configuration - starts start-hubot.sh as user config'd in hubot.conf
cp -f ./hubot.conf /etc/init/hubot.conf

#kick off upstart daemon
start hubot

The upstart script hubot.conf look like:

# hubot ubuntu upstart script

description "Hubot HipChat bot"

start on filesystem or runlevel [2345]
stop on runlevel [!2345]

# Keep the process alive, limit to 5 restarts in 60s
respawn
respawn limit 5 60

env RUN_AS_USER=lighthouse

#this will ensure that all hubot output gets sent to syslog
script
  set -e
  mkfifo /tmp/hubot-log-fifo
  ( logger -t hubot </tmp/hubot-log-fifo & )
  exec > /tmp/hubot-log-fifo
  rm /tmp/hubot-log-fifo
  exec start-stop-daemon --start -c $RUN_AS_USER -u $RUN_AS_USER -m \
  -p /var/run/hubot.pid --exec /opt/hubot/start-hubot.sh 2>/dev/null
end script

And the Hubot run script start-hubot.sh looks like:

#!/bin/sh

# Path to Hubot installation
export HUBOT_DIR='/opt/hubot/'
export ADAPTER='hipchat'
# Name (and local user) to run Hubot as
export HUBOT_USER='lighthouse'
# httpd listen port
export PORT='5555'

# Environment variable export's
<snip/>
export PATH="${HUBOT_DIR}node_modules/.bin:${HUBOT_DIR}node_modules/hubot/node_modules/.bin:$PATH"

cd ${HUBOT_DIR}
#clone the source from our customized repo - including our package.json and custom scripts

sudo chmod 600 scripts/testkey.pem
npm update
exec node_modules/hubot/bin/hubot --name ${HUBOT_USER} --adapter ${ADAPTER} --alias '/'

Our package.json looks like this

{
  "name":        "eps-hosted-hubot",
  "version":     "2.3.2",
  "author":      "GitHub Inc.",
  "keywords":    "github hubot hipchat bot",
  "description": "A simple helpful Robot for your Company",
  "licenses":     [{
    "type":       "MIT",
    "url":        "http://github.com/github/hubot/raw/master/LICENSE"
  }],

  "repository" : {
    "type" : "git",
    "url" : "http://github.com/github/hubot.git"
  },

  "dependencies": {
    "hubot": ">= 2.3.2",
    "hubot-hipchat": ">= 1.0.4",
    "hubot-scripts": ">= 2.1.1",
    "optparse": "1.0.3",
    "coffee-script": "1.3.3",
    "node-stringprep": "0.1.4",
    "scoped-http-client": "0.9.7",
    "log": "1.3.0",
    "connect": "2.3.4",
    "connect_router": "1.8.6",
    "githubot": "0.2.0",
    "date-utils":"1.2.5",
    "htmlparser":"1.7.6",
    "handlebars":"1.0.5beta",
    "scribe-node":"0.0.24",
    "underscore":"1.3.3",
    "underscore.string":"2.2.0rc",
    "wwwdude":"0.1.0",
    "xml2js":"0.1.13",
    "jsdom":"0.2.15",
    "nodepie":"0.4.0",
    "soupselect":"0.2.0",
    "aws2js":"0.6.12",
    "moment":"1.6.2"
  }
}

The directory layout is pretty flat

\opt\hubot
  hubot-scripts.json
  hubot.conf (copied out to /init/etc/hubot.conf)
  install-ubuntu.sh (run once by Cloudinit)
  package.json
  start-hubot.sh (run by Upstart)
\opt\hubot\scripts
  custom local scripts

We were running on 2.3.2, but I just noticed our bot died, and kicked off a new (presumably 2.3.4) install... of course, my tweaks were blown away, and Hubot isn't responding to commands like help once again. But it seems to work for any others just fine.

@Iristyle

This comment has been minimized.

Show comment Hide comment
@Iristyle

Iristyle Sep 24, 2012

And I can reconfirm.. if I drop my changes in on top of 2.3.4 node_modules/.bin/hubot, everything works properly.

And I can reconfirm.. if I drop my changes in on top of 2.3.4 node_modules/.bin/hubot, everything works properly.

@tombell

This comment has been minimized.

Show comment Hide comment
@tombell

tombell Sep 24, 2012

Contributor

I no longer work on hubot, but there will be a bin/hubot binary in your instance of hubot, you should use that to run it.

Contributor

tombell commented Sep 24, 2012

I no longer work on hubot, but there will be a bin/hubot binary in your instance of hubot, you should use that to run it.

@Iristyle

This comment has been minimized.

Show comment Hide comment
@Iristyle

Iristyle Sep 24, 2012

IIRC, I'm starting via

exec node_modules/hubot/bin/hubot --name ${HUBOT_USER} --adapter ${ADAPTER} --alias '/'

Because this would totally bail

exec node_modules/bin/hubot --name ${HUBOT_USER} --adapter ${ADAPTER} --alias '/'

IIRC, I'm starting via

exec node_modules/hubot/bin/hubot --name ${HUBOT_USER} --adapter ${ADAPTER} --alias '/'

Because this would totally bail

exec node_modules/bin/hubot --name ${HUBOT_USER} --adapter ${ADAPTER} --alias '/'
@tombell

This comment has been minimized.

Show comment Hide comment
@tombell

tombell Sep 24, 2012

Contributor

It's not in node_modules.

Contributor

tombell commented Sep 24, 2012

It's not in node_modules.

@Iristyle

This comment has been minimized.

Show comment Hide comment
@Iristyle

Iristyle Sep 24, 2012

It is when you install via NPM

opt/hubot

ubuntu@ip-XX-X-XX-XXX:/opt/hubot$ ls -rtaFl
total 60
drwxr-xr-x  3 root       root       4096 Sep 24 18:25 ../
-rw-r--r--  1 lighthouse lighthouse 6749 Sep 24 18:25 README.md
-rw-r--r--  1 lighthouse lighthouse   36 Sep 24 18:25 Procfile
-rw-r--r--  1 lighthouse lighthouse 1090 Sep 24 18:25 package.json
-rwxr-xr-x  1 lighthouse lighthouse  735 Sep 24 18:25 install-ubuntu.sh*
-rw-r--r--  1 lighthouse lighthouse  980 Sep 24 18:25 hubot-scripts.json
-rw-r--r--  1 lighthouse lighthouse  591 Sep 24 18:25 hubot.conf
-rw-r--r--  1 lighthouse lighthouse  905 Sep 24 18:25 .hgignore
-rw-r--r--  1 lighthouse lighthouse 1194 Sep 24 18:25 .gitignore
-rwxr-xr-x  1 lighthouse lighthouse 2906 Sep 24 18:25 start-hubot.sh*
drwxr-xr-x  2 lighthouse lighthouse 4096 Sep 24 18:25 scripts/
drwxr-xr-x  4 lighthouse lighthouse 4096 Sep 24 18:25 .hg/
drwxr-xr-x  5 lighthouse root       4096 Sep 24 18:28 ./
drwxr-xr-x 27 lighthouse lighthouse 4096 Sep 24 18:28 node_modules/

opt/hubot/node_modules/.bin

ubuntu@ip-XX-X-XX-XXX:/opt/hubot/node_modules/.bin$ ls -rtaFl
total 8
lrwxrwxrwx  1 lighthouse lighthouse   27 Sep 24 18:28 coffee -> ../coffee-script/bin/coffee*
lrwxrwxrwx  1 lighthouse lighthouse   25 Sep 24 18:28 cake -> ../coffee-script/bin/cake*
drwxr-xr-x 27 lighthouse lighthouse 4096 Sep 24 18:28 ../
lrwxrwxrwx  1 lighthouse lighthouse   18 Sep 24 18:28 hubot -> ../hubot/bin/hubot*
lrwxrwxrwx  1 lighthouse lighthouse   28 Sep 24 18:28 handlebars -> ../handlebars/bin/handlebars*
drwxr-xr-x  2 lighthouse lighthouse 4096 Sep 24 18:28 ./

opt/hubot/node_modules/hubot

ubuntu@ip-XX-X-XX-XXX:/opt/hubot/node_modules/hubot$ ls -rtaFl
total 476
-rw-rw-rw-  1 lighthouse lighthouse   1056 May 13 18:48 LICENSE.md
-rw-rw-rw-  1 lighthouse lighthouse 424800 Jun  1 15:39 tags
-rw-rw-rw-  1 lighthouse lighthouse    382 Jun  1 19:23 Makefile
drwxrwxrwx  2 lighthouse lighthouse   4096 Jun  5 17:50 bin/
-rw-rw-rw-  1 lighthouse lighthouse     13 Jun  5 18:59 .npmignore
-rw-rw-rw-  1 lighthouse lighthouse   1180 Aug 26 16:24 index.coffee
-rw-rw-rw-  1 lighthouse lighthouse   2659 Sep  8 18:56 README.md
-rw-rw-rw-  1 lighthouse lighthouse   7473 Sep 21 05:16 CHANGELOG.md
drwxrwxrwx  2 lighthouse lighthouse   4096 Sep 24 18:28 docs/
drwxrwxrwx  5 lighthouse lighthouse   4096 Sep 24 18:28 src/
drwxrwxrwx  3 lighthouse lighthouse   4096 Sep 24 18:28 test/
-rw-rw-rw-  1 lighthouse lighthouse   3533 Sep 24 18:28 package.json
drwxr-xr-x 27 lighthouse lighthouse   4096 Sep 24 18:28 ../
drwxr-xr-x  7 lighthouse lighthouse   4096 Sep 24 18:28 ./
drwxr-xr-x  9 lighthouse lighthouse   4096 Sep 24 18:28 node_modules/

It is when you install via NPM

opt/hubot

ubuntu@ip-XX-X-XX-XXX:/opt/hubot$ ls -rtaFl
total 60
drwxr-xr-x  3 root       root       4096 Sep 24 18:25 ../
-rw-r--r--  1 lighthouse lighthouse 6749 Sep 24 18:25 README.md
-rw-r--r--  1 lighthouse lighthouse   36 Sep 24 18:25 Procfile
-rw-r--r--  1 lighthouse lighthouse 1090 Sep 24 18:25 package.json
-rwxr-xr-x  1 lighthouse lighthouse  735 Sep 24 18:25 install-ubuntu.sh*
-rw-r--r--  1 lighthouse lighthouse  980 Sep 24 18:25 hubot-scripts.json
-rw-r--r--  1 lighthouse lighthouse  591 Sep 24 18:25 hubot.conf
-rw-r--r--  1 lighthouse lighthouse  905 Sep 24 18:25 .hgignore
-rw-r--r--  1 lighthouse lighthouse 1194 Sep 24 18:25 .gitignore
-rwxr-xr-x  1 lighthouse lighthouse 2906 Sep 24 18:25 start-hubot.sh*
drwxr-xr-x  2 lighthouse lighthouse 4096 Sep 24 18:25 scripts/
drwxr-xr-x  4 lighthouse lighthouse 4096 Sep 24 18:25 .hg/
drwxr-xr-x  5 lighthouse root       4096 Sep 24 18:28 ./
drwxr-xr-x 27 lighthouse lighthouse 4096 Sep 24 18:28 node_modules/

opt/hubot/node_modules/.bin

ubuntu@ip-XX-X-XX-XXX:/opt/hubot/node_modules/.bin$ ls -rtaFl
total 8
lrwxrwxrwx  1 lighthouse lighthouse   27 Sep 24 18:28 coffee -> ../coffee-script/bin/coffee*
lrwxrwxrwx  1 lighthouse lighthouse   25 Sep 24 18:28 cake -> ../coffee-script/bin/cake*
drwxr-xr-x 27 lighthouse lighthouse 4096 Sep 24 18:28 ../
lrwxrwxrwx  1 lighthouse lighthouse   18 Sep 24 18:28 hubot -> ../hubot/bin/hubot*
lrwxrwxrwx  1 lighthouse lighthouse   28 Sep 24 18:28 handlebars -> ../handlebars/bin/handlebars*
drwxr-xr-x  2 lighthouse lighthouse 4096 Sep 24 18:28 ./

opt/hubot/node_modules/hubot

ubuntu@ip-XX-X-XX-XXX:/opt/hubot/node_modules/hubot$ ls -rtaFl
total 476
-rw-rw-rw-  1 lighthouse lighthouse   1056 May 13 18:48 LICENSE.md
-rw-rw-rw-  1 lighthouse lighthouse 424800 Jun  1 15:39 tags
-rw-rw-rw-  1 lighthouse lighthouse    382 Jun  1 19:23 Makefile
drwxrwxrwx  2 lighthouse lighthouse   4096 Jun  5 17:50 bin/
-rw-rw-rw-  1 lighthouse lighthouse     13 Jun  5 18:59 .npmignore
-rw-rw-rw-  1 lighthouse lighthouse   1180 Aug 26 16:24 index.coffee
-rw-rw-rw-  1 lighthouse lighthouse   2659 Sep  8 18:56 README.md
-rw-rw-rw-  1 lighthouse lighthouse   7473 Sep 21 05:16 CHANGELOG.md
drwxrwxrwx  2 lighthouse lighthouse   4096 Sep 24 18:28 docs/
drwxrwxrwx  5 lighthouse lighthouse   4096 Sep 24 18:28 src/
drwxrwxrwx  3 lighthouse lighthouse   4096 Sep 24 18:28 test/
-rw-rw-rw-  1 lighthouse lighthouse   3533 Sep 24 18:28 package.json
drwxr-xr-x 27 lighthouse lighthouse   4096 Sep 24 18:28 ../
drwxr-xr-x  7 lighthouse lighthouse   4096 Sep 24 18:28 ./
drwxr-xr-x  9 lighthouse lighthouse   4096 Sep 24 18:28 node_modules/
@tombell

This comment has been minimized.

Show comment Hide comment
@tombell

tombell Sep 24, 2012

Contributor

You're setting it up wrong then. You don't install via npm and run that.

Contributor

tombell commented Sep 24, 2012

You're setting it up wrong then. You don't install via npm and run that.

@technicalpickles

This comment has been minimized.

Show comment Hide comment
@technicalpickles

technicalpickles Sep 24, 2012

Contributor

What node & npm versions are you running?

On Sep 24, 2012, at 3:48 PM, "Ethan J. Brown" notifications@github.com wrote:

It is when you install via NPM

opt/hubot

ubuntu@ip-XX-X-XX-XXX:/opt/hubot$ ls -rtaFl
total 60
drwxr-xr-x 3 root root 4096 Sep 24 18:25 ../
-rw-r--r-- 1 lighthouse lighthouse 6749 Sep 24 18:25 README.md
-rw-r--r-- 1 lighthouse lighthouse 36 Sep 24 18:25 Procfile
-rw-r--r-- 1 lighthouse lighthouse 1090 Sep 24 18:25 package.json
-rwxr-xr-x 1 lighthouse lighthouse 735 Sep 24 18:25 install-ubuntu.sh*
-rw-r--r-- 1 lighthouse lighthouse 980 Sep 24 18:25 hubot-scripts.json
-rw-r--r-- 1 lighthouse lighthouse 591 Sep 24 18:25 hubot.conf
-rw-r--r-- 1 lighthouse lighthouse 905 Sep 24 18:25 .hgignore
-rw-r--r-- 1 lighthouse lighthouse 1194 Sep 24 18:25 .gitignore
-rwxr-xr-x 1 lighthouse lighthouse 2906 Sep 24 18:25 start-hubot.sh*
drwxr-xr-x 2 lighthouse lighthouse 4096 Sep 24 18:25 scripts/
drwxr-xr-x 4 lighthouse lighthouse 4096 Sep 24 18:25 .hg/
drwxr-xr-x 5 lighthouse root 4096 Sep 24 18:28 ./
drwxr-xr-x 27 lighthouse lighthouse 4096 Sep 24 18:28 node_modules/
opt/hubot/node_modules/.bin

ubuntu@ip-XX-X-XX-XXX:/opt/hubot/node_modules/.bin$ ls -rtaFl
total 8
lrwxrwxrwx 1 lighthouse lighthouse 27 Sep 24 18:28 coffee -> ../coffee-script/bin/coffee*
lrwxrwxrwx 1 lighthouse lighthouse 25 Sep 24 18:28 cake -> ../coffee-script/bin/cake*
drwxr-xr-x 27 lighthouse lighthouse 4096 Sep 24 18:28 ../
lrwxrwxrwx 1 lighthouse lighthouse 18 Sep 24 18:28 hubot -> ../hubot/bin/hubot*
lrwxrwxrwx 1 lighthouse lighthouse 28 Sep 24 18:28 handlebars -> ../handlebars/bin/handlebars*
drwxr-xr-x 2 lighthouse lighthouse 4096 Sep 24 18:28 ./
opt/hubot/node_modules/hubot

ubuntu@ip-XX-X-XX-XXX:/opt/hubot/node_modules/hubot$ ls -rtaFl
total 476
-rw-rw-rw- 1 lighthouse lighthouse 1056 May 13 18:48 LICENSE.md
-rw-rw-rw- 1 lighthouse lighthouse 424800 Jun 1 15:39 tags
-rw-rw-rw- 1 lighthouse lighthouse 382 Jun 1 19:23 Makefile
drwxrwxrwx 2 lighthouse lighthouse 4096 Jun 5 17:50 bin/
-rw-rw-rw- 1 lighthouse lighthouse 13 Jun 5 18:59 .npmignore
-rw-rw-rw- 1 lighthouse lighthouse 1180 Aug 26 16:24 index.coffee
-rw-rw-rw- 1 lighthouse lighthouse 2659 Sep 8 18:56 README.md
-rw-rw-rw- 1 lighthouse lighthouse 7473 Sep 21 05:16 CHANGELOG.md
drwxrwxrwx 2 lighthouse lighthouse 4096 Sep 24 18:28 docs/
drwxrwxrwx 5 lighthouse lighthouse 4096 Sep 24 18:28 src/
drwxrwxrwx 3 lighthouse lighthouse 4096 Sep 24 18:28 test/
-rw-rw-rw- 1 lighthouse lighthouse 3533 Sep 24 18:28 package.json
drwxr-xr-x 27 lighthouse lighthouse 4096 Sep 24 18:28 ../
drwxr-xr-x 7 lighthouse lighthouse 4096 Sep 24 18:28 ./
drwxr-xr-x 9 lighthouse lighthouse 4096 Sep 24 18:28 node_modules/

Reply to this email directly or view it on GitHub.

Contributor

technicalpickles commented Sep 24, 2012

What node & npm versions are you running?

On Sep 24, 2012, at 3:48 PM, "Ethan J. Brown" notifications@github.com wrote:

It is when you install via NPM

opt/hubot

ubuntu@ip-XX-X-XX-XXX:/opt/hubot$ ls -rtaFl
total 60
drwxr-xr-x 3 root root 4096 Sep 24 18:25 ../
-rw-r--r-- 1 lighthouse lighthouse 6749 Sep 24 18:25 README.md
-rw-r--r-- 1 lighthouse lighthouse 36 Sep 24 18:25 Procfile
-rw-r--r-- 1 lighthouse lighthouse 1090 Sep 24 18:25 package.json
-rwxr-xr-x 1 lighthouse lighthouse 735 Sep 24 18:25 install-ubuntu.sh*
-rw-r--r-- 1 lighthouse lighthouse 980 Sep 24 18:25 hubot-scripts.json
-rw-r--r-- 1 lighthouse lighthouse 591 Sep 24 18:25 hubot.conf
-rw-r--r-- 1 lighthouse lighthouse 905 Sep 24 18:25 .hgignore
-rw-r--r-- 1 lighthouse lighthouse 1194 Sep 24 18:25 .gitignore
-rwxr-xr-x 1 lighthouse lighthouse 2906 Sep 24 18:25 start-hubot.sh*
drwxr-xr-x 2 lighthouse lighthouse 4096 Sep 24 18:25 scripts/
drwxr-xr-x 4 lighthouse lighthouse 4096 Sep 24 18:25 .hg/
drwxr-xr-x 5 lighthouse root 4096 Sep 24 18:28 ./
drwxr-xr-x 27 lighthouse lighthouse 4096 Sep 24 18:28 node_modules/
opt/hubot/node_modules/.bin

ubuntu@ip-XX-X-XX-XXX:/opt/hubot/node_modules/.bin$ ls -rtaFl
total 8
lrwxrwxrwx 1 lighthouse lighthouse 27 Sep 24 18:28 coffee -> ../coffee-script/bin/coffee*
lrwxrwxrwx 1 lighthouse lighthouse 25 Sep 24 18:28 cake -> ../coffee-script/bin/cake*
drwxr-xr-x 27 lighthouse lighthouse 4096 Sep 24 18:28 ../
lrwxrwxrwx 1 lighthouse lighthouse 18 Sep 24 18:28 hubot -> ../hubot/bin/hubot*
lrwxrwxrwx 1 lighthouse lighthouse 28 Sep 24 18:28 handlebars -> ../handlebars/bin/handlebars*
drwxr-xr-x 2 lighthouse lighthouse 4096 Sep 24 18:28 ./
opt/hubot/node_modules/hubot

ubuntu@ip-XX-X-XX-XXX:/opt/hubot/node_modules/hubot$ ls -rtaFl
total 476
-rw-rw-rw- 1 lighthouse lighthouse 1056 May 13 18:48 LICENSE.md
-rw-rw-rw- 1 lighthouse lighthouse 424800 Jun 1 15:39 tags
-rw-rw-rw- 1 lighthouse lighthouse 382 Jun 1 19:23 Makefile
drwxrwxrwx 2 lighthouse lighthouse 4096 Jun 5 17:50 bin/
-rw-rw-rw- 1 lighthouse lighthouse 13 Jun 5 18:59 .npmignore
-rw-rw-rw- 1 lighthouse lighthouse 1180 Aug 26 16:24 index.coffee
-rw-rw-rw- 1 lighthouse lighthouse 2659 Sep 8 18:56 README.md
-rw-rw-rw- 1 lighthouse lighthouse 7473 Sep 21 05:16 CHANGELOG.md
drwxrwxrwx 2 lighthouse lighthouse 4096 Sep 24 18:28 docs/
drwxrwxrwx 5 lighthouse lighthouse 4096 Sep 24 18:28 src/
drwxrwxrwx 3 lighthouse lighthouse 4096 Sep 24 18:28 test/
-rw-rw-rw- 1 lighthouse lighthouse 3533 Sep 24 18:28 package.json
drwxr-xr-x 27 lighthouse lighthouse 4096 Sep 24 18:28 ../
drwxr-xr-x 7 lighthouse lighthouse 4096 Sep 24 18:28 ./
drwxr-xr-x 9 lighthouse lighthouse 4096 Sep 24 18:28 node_modules/

Reply to this email directly or view it on GitHub.

@Iristyle

This comment has been minimized.

Show comment Hide comment
@Iristyle

Iristyle Sep 24, 2012

Node 0.8.9
NPM 1.1.59

Node 0.8.9
NPM 1.1.59

@tombell

This comment has been minimized.

Show comment Hide comment
@tombell

tombell Sep 24, 2012

Contributor

https://github.com/downloads/github/hubot/hubot-2.3.2.tar.gz

The wiki page for setting up on UNIX is totally incorrect.

Contributor

tombell commented Sep 24, 2012

https://github.com/downloads/github/hubot/hubot-2.3.2.tar.gz

The wiki page for setting up on UNIX is totally incorrect.

@Iristyle

This comment has been minimized.

Show comment Hide comment
@Iristyle

Iristyle Sep 24, 2012

You realize that your hubot\bin does what I'm doing?

#!/bin/sh

npm install
export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH"

exec node_modules/.bin/hubot "$@"

I've just wrapped it up a little differently from your default instructions (preferring upstart, etc)

node_modules/.bin/hubot is of course just a symlink to node_modules/hubot/bin/hubot

You realize that your hubot\bin does what I'm doing?

#!/bin/sh

npm install
export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH"

exec node_modules/.bin/hubot "$@"

I've just wrapped it up a little differently from your default instructions (preferring upstart, etc)

node_modules/.bin/hubot is of course just a symlink to node_modules/hubot/bin/hubot

@tombell

This comment has been minimized.

Show comment Hide comment
@tombell

tombell Sep 24, 2012

Contributor

If you don't follow the instructions for setting it up correctly, things are going to break. Hubot isn't designed to be run from the npm package. But like I said I no longer work on it, so it could change.

Contributor

tombell commented Sep 24, 2012

If you don't follow the instructions for setting it up correctly, things are going to break. Hubot isn't designed to be run from the npm package. But like I said I no longer work on it, so it could change.

@Iristyle

This comment has been minimized.

Show comment Hide comment
@Iristyle

Iristyle Sep 24, 2012

It works just fine as long as you resolve the paths a little more robustly -- the pull req fixes the problem.

IMHO, it doesn't make sense to publish Hubot on NPM and provide a package.json if you can't npm install it.

The other reason that you would want to install via NPM like I am is so that you don't have to maintain copies of the stock scripts / merge upstream changes over time / etc. if I just npm install hubot I get all the latest versions of what you guys have put together in the default scripts when things are refactored / fixed etc.

It works just fine as long as you resolve the paths a little more robustly -- the pull req fixes the problem.

IMHO, it doesn't make sense to publish Hubot on NPM and provide a package.json if you can't npm install it.

The other reason that you would want to install via NPM like I am is so that you don't have to maintain copies of the stock scripts / merge upstream changes over time / etc. if I just npm install hubot I get all the latest versions of what you guys have put together in the default scripts when things are refactored / fixed etc.

@tombell

This comment has been minimized.

Show comment Hide comment
@tombell

tombell Sep 24, 2012

Contributor

The hubot package on npm provides the core of hubot, not the scripts. You maintain your own copies of those scripts. The scripts are included in the npm package because they're used when you provide the -c option to the binary for creating your instance of hubot.

Contributor

tombell commented Sep 24, 2012

The hubot package on npm provides the core of hubot, not the scripts. You maintain your own copies of those scripts. The scripts are included in the npm package because they're used when you provide the -c option to the binary for creating your instance of hubot.

@Iristyle

This comment has been minimized.

Show comment Hide comment
@Iristyle

Iristyle Sep 24, 2012

So they're not included, but they're included! haha. ;0

I'm not trying to be a PITA here, but you can understand how this all extra ceremony seems a bit ridiculous right? IMHO, auto-updating Hubot core by NPM as I have setup, is a nice way to make sure the scripts shipping with Hubot stay matched up with the rest of Hubot. I don't really want to have to constantly make sure that these guys are merged with the latest upstream.

I've been running Hubot via an NPM install just fine for something like a year using this approach.

I understand what you're saying about trying to find things in /opt/hubot/scripts only (and I realize just loading scripts from both could lead to dupe load attempts if you're NPM installing).. so perhaps for what I've tweaked to be accepted, it needs to be wrapped in a (defaulted to false) switch.

I'd really like to see this integrated for convenience... but... I can always just copy the files from /opt/hubot/node_modules/hubot/scripts up to /opt/hubot/scripts after each NPM update, as part of my upstart script.

So they're not included, but they're included! haha. ;0

I'm not trying to be a PITA here, but you can understand how this all extra ceremony seems a bit ridiculous right? IMHO, auto-updating Hubot core by NPM as I have setup, is a nice way to make sure the scripts shipping with Hubot stay matched up with the rest of Hubot. I don't really want to have to constantly make sure that these guys are merged with the latest upstream.

I've been running Hubot via an NPM install just fine for something like a year using this approach.

I understand what you're saying about trying to find things in /opt/hubot/scripts only (and I realize just loading scripts from both could lead to dupe load attempts if you're NPM installing).. so perhaps for what I've tweaked to be accepted, it needs to be wrapped in a (defaulted to false) switch.

I'd really like to see this integrated for convenience... but... I can always just copy the files from /opt/hubot/node_modules/hubot/scripts up to /opt/hubot/scripts after each NPM update, as part of my upstart script.

@tombell

This comment has been minimized.

Show comment Hide comment
@tombell

tombell Jan 10, 2013

Contributor

Closing this as hubot isn't designed to be run from the npm package hubot. Hopefully the thin line around this will be fixed in v3.

Contributor

tombell commented Jan 10, 2013

Closing this as hubot isn't designed to be run from the npm package hubot. Hopefully the thin line around this will be fixed in v3.

@tombell tombell closed this Jan 10, 2013

@Iristyle

This comment has been minimized.

Show comment Hide comment
@Iristyle

Iristyle Jan 11, 2013

No worries... in the end, the best option for us ended up being

  • during a deploy, copy a few of the files out of the hubot pkg to to the local scripts (i.e. from node_modules/hubot/src/scripts to scripts) where we want to stay up to date with the parent hubot scripts -- doc format, bugfixes, etc
  • include some of the stock hubot scripts in our custom scripts package, as they required modifications for security purposes (i.e. role checks based on roles configured during deploy)

It's a little less than ideal IMHO, but it works just fine and I'm satisfied.

No worries... in the end, the best option for us ended up being

  • during a deploy, copy a few of the files out of the hubot pkg to to the local scripts (i.e. from node_modules/hubot/src/scripts to scripts) where we want to stay up to date with the parent hubot scripts -- doc format, bugfixes, etc
  • include some of the stock hubot scripts in our custom scripts package, as they required modifications for security purposes (i.e. role checks based on roles configured during deploy)

It's a little less than ideal IMHO, but it works just fine and I'm satisfied.

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