shockey / do Goto Github PK
View Code? Open in Web Editor NEW:sparkles: Slack-based remote task runner
:sparkles: Slack-based remote task runner
Currently, due to ES6 presence in the codebase, Do requires node >=6.0.0
.
We can transpile ES6 on the fly in older Node versions using Babel's require hook. This may have runtime performance implications, but IMO it's better to run more slowly in older Nodes than to not run at all ๐
The sequence API is kinda weird, in that you usually end up passing an array of words broken by spaces, for example ['npm', 'install']
.
I've yet to see a use case that breaks that pattern, actually.
We could save users some keystrokes (and headaches) by allowing them to pass in a string (for example, npm install
, which will be broken down into the command and array of arguments to be passed into exec behind the scenes.
@do pm2 start a
: starts the a
pm2 process@do pm2 stop b
: stops the b
pm2 process@do pm2 restart c
: restarts the c
pm2 process@do pm2 list
: List current processesWe have an empty wizard.js
file in the repository.
There should be a config wizard there ๐
>>> pm2 restart -s wmsv-wmffmpeg
/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon/node_modules/amp-message/index.js:126
return new Buffer('j:' + JSON.stringify(arg));
^
TypeError: Converting circular structure to JSON
at Object.stringify (native)
at pack (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon/node_modules/amp-message/index.js:126:33)
at encode (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon/node_modules/amp-message/index.js:101:14)
at Message.toBuffer (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon/node_modules/amp-message/index.js:68:10)
at ReqSocket.Socket.pack (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/sock.js:92:14)
at ReqSocket.send (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/req.js:96:21)
at Client.call (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon-rpc/lib/client.js:34:13)
at Object.executeRemote (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/lib/Satan.js:563:23)
at /home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/lib/CLI.js:1047:13
at /home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/async/lib/async.js:181:20
I think there may be some isolation regarding our runner process system thatโs keeping the pm2 binary from communicating with its god process.
Imagine we wanted a log
verb that outputs the last n lines from a process manager.
Possible formats, where n = 100
:
@do log example 100
@do log example n:100
Accepting arguments may require us to augment the sequence API (which is going on in #3 for 1.0 as well).
We'll also want to sanitize the argument inputs- though we can generally trust users, we can't Trust Usersโข, so let's stay on the safe side.
Currently, we have to prefix Do commands with @do
even when messaging Do directly.
Currently, anyone on a Slack team can invoke any command. This is suboptimal from a security perspective: consider a use case where Do is running on a production system.
Possible solution: a user is defined as the superuser (by handle or some other unique Slack identifier) in Do config, and commands are added to instruct Do to start and stop trusting additional users. Those users, in turn, can instruct Do to start or stop trusting any other users (except the user defined as superuser in the config).
Currently, the codebase is a bit murky in regards to what data is being sent where. Problems include inconsistent variable naming, and a relative lack of comments.
Let's start using the PM2 API to start Do in the background, and package a local PM2 with Do so it works without needing to install PM2 globally.
We have plenty of testable logic in the app, and an easily mockable slackbot
instance.
Let's write some tests! ๐
Currently, handlers for help
, hello
, and list
are hardcoded into index.js
.
We should break those out into a module system similar to targets, so they're easier to reason about and easier to create and customize.
Beacuse of the way the verb runner is written (that is, synchronously), Do is unable to handle any incoming requests while it's executing a verb sequence.
This may cause problems with Slack connectivity and state when running very long verb sequences.
We should refactor the verb runner to an asynchronous shell execution API, being careful to preserve the waterfall pattern of a sequence's execution.
This is a bug newly introduced by the resolution of #1.
Running child processes asynchronously allows us to kick off the same verb twice at once, which is a bad thing: being at two places in a build pipeline at once can cause some seriously subtle headaches to end users.
We should block a verb from starting if it's already running!
If I forget to add a required key to a target, I get this:
Oops! There was a problem parsing targets/example.js:
'AssertionError: expected { Object (verbs, description, ...) } to have keys 'verbs', 'name', 'description', and 'workingDir''
While this is helpful, it would be nice to be more user-friendly.
We should adopt the WeMash ESLint presets.
This should keep us from having any issues regarding changes to data in bundles for incoming messages, etc
note: need to add clarity to this issue
It'd be awesome to be able to update do via Slack.
Do could, itself, be a target, with an update
verb that runs git pull
and then exits, allowing the process manager running Do to restart it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.