katon

Automatically starts your development servers so that you can be more productive. Servers are accessible on local .ka domains.

katon

Autostarts your development servers so that you can be more productive

With katon, there's no need anymore to open a Terminal and manually start developement servers each time you want to develop.

Instead, add your development servers once to katon and they'll be autostarted and always accessible on local .ka domains.


Click here to view a screenshot of katon + Express + Rails

katon supports any server: Node, Ruby, Python, Go, Java, PHP, ... that can be started with a command-line and runs on Mac OS (Yosemite included).

Make sure Node is installed first, then:

$ npm install -g katon

To manually install katon, you can run sudo katon install && katon start.

$ katon add 'nodemon'
$ katon add 'npm start'
$ katon add 'grunt server'
$ katon add 'rails server --port $PORT'
$ katon add 'python -m SimpleHTTPServer $PORT'
$ katon add 'php -S 127.0.0.1:$PORT'

To add a server with a different name than its directory.

$ katon add 'grunt server' my-custom-name
Application is now available at http://my-custom-name.ka

Note: it's important to use ' and not " to avoid $PORT to be evaluated.

Port is dynamically set by katon using PORT environment variable but can be passed as a parameter using $PORT.

In case your server doesn't accept a port parameter, you can retrieve the PORT environment variable in your code. For example, for a Node server you would write something like:

var port = process.env.PORT || 3000;

The same technique can be applied with other languages too.

When adding a server, you can access it by its URL http://app.ka. But you can also use subdomains (e.g. http://foo.app.ka, http://bar.app.ka, ...).

If you want to map a server to a subdomain, let's say api.app.ka, simply use katon add <cmd> api.app.

katon is also fully compatible with xip.io service.

Server logs are stored in ~/.katon/logs/<app_name>.log, to view them you can use:

$ katon tail [app_name]
$ katon tail all # View all logs

katon works with any version manager, simply set the desired version before adding your server and katon will remember it.

$ nvm use 0.11 && katon add 'npm start'
$ rbenv local 2.0.0-p481 && katon add 'rails server --port $PORT'

Depending on your version manager, you may need to add environment variables.

$ rvm use ruby-2.0.0-p576 && katon add 'bundle exec unicorn' --env GEM_PATH
# Will use GEM_PATH previously set by rvm

For Node users, to keep access to katon CLI accross Node versions, add an alias to your .profile and reopen the Terminal.

echo "alias katon=`which katon`" >> ~/.profile

Run katon status or check ~/.katon/daemon.log.

If you're stuck, feel free to create an issue.

$ npm rm -g katon

This will run the uninstall script wich does basically katon stop && sudo katon uninstall. To remove katon completely, run also rm -rf ~/.katon.

Credits

  • Pow for daemon inspiration.
  • Powder for CLI inspiration.

License

katon is released under the MIT License.