Nodester Clientyanc: Yet Another
STATUS: Defunct - When I started this CLI, there was no official nodester CLI. Just around when I finished it, the official CLI client was released. It was still a fun project because I got to learn a lot about writing CLI apps in node.js, but you're much better off taking a look at the official client.
WARNING: THE README IS A LIE (for now)
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.
What is this I don't even.
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
Request a coupon
$ 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
Register a user
$ 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
Creating an app
$ 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.
- Server where
yancexpects to talk to the API service
- Defaults to
- Server where
- The email you want to receive a coupon to or register your user with
- Defaults to your email from git, as reported by
git config user.email
- Your username on the nodester system
- Defaults to your system user name, as reported by
- Path to an SSH identity file
- Defaults to
~/.ssh/id_dsa.pub, if available, in that order
- Name of the application on nodester
- Defaults to the current directory name
- Name of the script to run forever
- Defaults to "main" as described in
package.json, falls back to
app.jsif available, and in that order
- Password to authenticate with nodester
- Defaults to ... nothing. Prompt the user every time by default.
- Name of git remote to connect to nodester
- Defaults to "nodester"
- Name of branch to push to nodester
- Defaults to "master"
Setting and Getting
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:
- First, if a value is specified on the command-line via
--configkey="value", use that.
- Next, check the value via
- Third, check for a sensible default.
- If we couldn't use a sensible default, prompt the user.
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!