Conversation
bin/hubot
Outdated
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH" \ |
There was a problem hiding this comment.
This is from the automatically generated boilerplate. Is it required? If not, let's remove it.
Makefile
Outdated
| @@ -0,0 +1,14 @@ | |||
| ESLINT = node_modules/.bin/eslint --config node_modules/sanctuary-style/eslint-es3.json --env es3 --env node | |||
| NPM = npm | |||
package.json
Outdated
| "sanctuary-type-classes": "*" | ||
| }, | ||
| "devDependencies": { | ||
| "eslint": "2.9.x", |
There was a problem hiding this comment.
This is a very old version of Eslint.
There was a problem hiding this comment.
It is. The reason I'm specifying an old version is that sanctuary-style@0.4.x does not make use of any rules added since eslint@2.9.x. We should update sanctuary-style to the latest version of ESLint then update both dependencies at once (here and in other projects).
package.json
Outdated
| "version": "0.0.0", | ||
| "private": true, | ||
| "author": "David Chambers <dc@davidchambers.me>", | ||
| "description": "A simple helpful robot for your Company", |
There was a problem hiding this comment.
Is this description from the boilerplate?
circle.yml
Outdated
|
|
||
| machine: | ||
| node: | ||
| version: 4 |
There was a problem hiding this comment.
Out of curiosity, why Node 4 instead of 6 or 7?
There was a problem hiding this comment.
No good reason. Node 4 came installed on Ubuntu. For a small project it doesn't matter much to me which Node version we use so I'm happy to stick with the default.
There was a problem hiding this comment.
Gotcha. In the case of a bot it might be worth it to consider updating. It would allow us to use the full set of ES6 features in the code we write.
There was a problem hiding this comment.
Excellent point! I had not considered that. I'll install Node 6 on the server. :)
There was a problem hiding this comment.
Where is the server? It would be nice to do it with infrastructure as code, maybe use a Docker container so its configuration would be in source control.
There was a problem hiding this comment.
Where is the server?
On Linode currently.
It would be nice to do it with infrastructure as code, maybe use a Docker container so its configuration would be in source control.
Sounds great! This needn't happen as part of this initial pull request though. ;)
There was a problem hiding this comment.
Fair enough. My preference is to always put code into production with provisioning scripts. Retrofitting is always harder.
Dockerfile
Outdated
|
|
||
| COPY . . | ||
|
|
||
| ENTRYPOINT ["dumb-init", "bin/hubot"] |
There was a problem hiding this comment.
Could you review this, @svozza? I'm quite new to Docker. I followed some of these suggestions.
There was a problem hiding this comment.
That's a really good article. I like the trick about caching the node_modules layer. LGTM.
There was a problem hiding this comment.
Btw, if you want to set Hubot to listen on a specific port you can do ENV PORT 3000. Then when running your container you do the port mapping with the -p option on docker run.
There was a problem hiding this comment.
Also, is it possible to make CircleCI build and push new image to DockerHub whenever there's a successful merge to master?
There was a problem hiding this comment.
Btw, if you want to set Hubot to listen on a specific port you can do
ENV PORT 3000.
Does Hubot listen? My understanding is that it makes a request to the Gitter streaming API and consumes the response indefinitely.
Also, is it possible to make CircleCI build and push new image to DockerHub whenever there's a successful merge to
master?
Would it also be possible to automatically update the Linode in response to this push? If not it seems reasonable to me to publish to Docker Hub via xyz, then pull and restart the bot on the Linode manually.
There was a problem hiding this comment.
Yeah, looking at the docs Linode really doesn't seem set up for CD, if it was something like Elastic Beanstalk I could knock up a fully automated build pipeline relatively simply. But lets leave that for another day. 😉
scripts/eval.js
Outdated
|
|
||
| module.exports = bot => { | ||
|
|
||
| bot.respond(/```(?:javascript|js)?$([\s\S]*)```/m, res => { |
There was a problem hiding this comment.
We could replace [\s\S] with [^], I think.
53ad407 to
6a7ddfb
Compare
6a7ddfb to
856313f
Compare
154e99e to
6e49b8f
Compare
TODO:
console(so one can useconsole.login snippets)