Yet Another Nodester CLI
Yet Another Nodester Client
In the spirit of Readme-Driven Development, this document describes the intended 0.1.0 behavior. The management bears no responsibility for divergent, or even deviant, behavior on the part of the software in the current pre-release state.
nodester is an open-source platform for hosting node apps, and I think that's the bee's knees. However, their API - while delicious and moist - is a bit cumbersome to use with only curl. So, to fill this gap, yanc should give you a nice command-line tool to interface with it. If you've used the heroku CLI, you'll know what we're going for here.
To get started quickly, install with npm:
$ npm install yanc
If you've already registered with nodester, deploying a new app is easy:
$ cd ~/projects/pantscompetition/ $ yanc create OK: app pantscompetition created, added remote nodester $ yanc push OK: pushed branch master to nodester $ yanc start OK: app pantscompetetion started
That should do it!
$ yanc status # Checking status on api.nodester.com... done OK: The system is up! Apps hosted: 152 Apps running: 74
$ yanc coupon # Requesting coupon for firstname.lastname@example.org... done OK: Coupon requested. You will receive an email when capacity allows. OK: Saved email address and api server in the global config
$ yanc register MYCOUPONCODE INFO: Registering user with the following information: Username: fancypants Email: email@example.com Coupon: MYCOUPONCODE SSH Key: /Users/fancypants/.ssh/id_rsa.pub Server: api.nodester.com INFO: If anything is incorrect, abort with Ctrl-C and use "nodester config" Password: ******** Confirm password: ******** # Registering user "fancypants"... done OK: User created OK: Saved user information in global config
$ yanc create # Creating application "pantscompetetion"... done OK: Application created successfully Name: pantscompetetion Running: false Port: 8375 Git repo: firstname.lastname@example.org:/home/ec2-user/hosted_apps/fancypants/222-c4d515bd6f0df4ac625d33daab98f4e6.git Start: server.js PID: unknown OK: Added git remote: yanc OK: Saved app name, remote, and branch settings
$ yanc push # Pushing branch "master" to remote "yanc"... Counting objects: 103, done. Delta compression using up to 2 threads. Compressing objects: 100% (102/102), done. Writing objects: 100% (103/103), 39.22 KiB, done. Total 103 (delta 44), reused 0 (delta 0) remote: From /home/ec2-user/hosted_apps/fancypants/222-c4d515bd6f0df4ac625d33daab98f4e6.git/. remote: * [new branch] master -> origin/master remote: cat: .app.pid: No such file or directory remote: kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec] To email@example.com:/home/ec2-user/hosted_apps/fancypants/222-c4d515bd6f0df4ac625d33daab98f4e6.git * [new branch] master -> master OK: Push successful
$ yanc start # Starting app "pantscompetition"... done OK: App domainzomg started $ yanc stop # Stopping app "pantscompetition"... done OK: App domainzomg stopped
$ yanc npm install express OK: installed package firstname.lastname@example.org in app pantscompetition $ yanc npm uninstall express OK: uninstalled package express in app pantscompetition
Or, install all advertised dependencies from
$ yanc npm deps # resolving dependencies from package.json... OK: installed package email@example.com OK: installed package firstname.lastname@example.org OK: installed package email@example.com OK: installed package firstname.lastname@example.org OK: installed package email@example.com
yanc has a small set of configuration keys, and it'll try to guess sensible defaults so you don't have to type them.
yancexpects to talk to the API service
git config user.email
~/.ssh/id_dsa.pub, if available, in that order
package.json, falls back to
app.jsif available, and in that order
You can specify a value for any key by passing
--configkey="value" on the command line.
You can also use
$ yanc config user fancypants # source: whoami email firstname.lastname@example.org # source: git config user.email key /home/fancypants/.ssh/id_rsa.pub # source: default app pantscompetition # source: package.json start app.js # source: package.json
Setting a config variable works, too:
$ yanc config app "pantscompetition" # in a .git project, setting local configuration app pantscompetition # source: git config nodester.app $ yanc config pass --prompt --global Password: Confirm: # set global configuration pass ************** # source: git config nodester.pass $ yanc config user "fancy" --global # set global configuration user fancy # source: git config nodester.app
The fallback logic is:
--configkey="value", use that.
In practice, this gives you an enormous amount of flexibility. Enough flexibility to shoot yourself in the foot, and nobody likes gangrene, so I recommend Keeping It Simple, Señor!