-
Notifications
You must be signed in to change notification settings - Fork 3
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
everything #1
base: main
Are you sure you want to change the base?
everything #1
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Npm? ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, yes. :)
package.json
Outdated
"sanctuary-type-classes": "*" | ||
}, | ||
"devDependencies": { | ||
"eslint": "2.9.x", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very old version of Eslint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is. The reason I'm specifying an old version is that [email protected]
does not make use of any rules added since [email protected]
. We should update sanctuary-style to the latest version of ESLint then update both dependencies at once (here and in other projects).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
package.json
Outdated
"version": "0.0.0", | ||
"private": true, | ||
"author": "David Chambers <[email protected]>", | ||
"description": "A simple helpful robot for your Company", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this description from the boilerplate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was. ⚡
circle.yml
Outdated
|
||
machine: | ||
node: | ||
version: 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why Node 4 instead of 6 or 7?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent point! I had not considered that. I'll install Node 6 on the server. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you review this, @svozza? I'm quite new to Docker. I followed some of these suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a really good article. I like the trick about caching the node_modules
layer. LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.log
in snippets)