• Stars
    star
    683
  • Rank 63,469 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 10 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

(use hotel instead)

katon


Note except if you need a particular feature in katon, please use hotel. Hotel is cross-platform and doesn't require admin privileges to be installed.

A huge thank you to all the people who contributed to katon!


Access your dev servers by their names

katon is a development tool that makes dev servers accessible on beautiful local .ka domains. It also autostarts/stops them for you.

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

Linux, Windows

Please use hotel.

Install

Make sure Node is installed first, then:

$ npm install -g katon

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

Known issue: if Apache is running, it needs to be stopped to avoid conflict with katon.

Add servers

$ 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.

How it works

  • When you add a server using the katon add command, its configuration is saved locally to ~/.katon/hosts/<app> and an equivalent ~/.katon/logs/<app> directory is also created.
  • The server is not started until you make your first request to your <app>.ka domain.
  • If no request is made to your <app>.ka server within an hour, then katon automatically stops it. Therefore, Katon automatically manages resources by starting only needed servers and stopping them when they're not used.

Subdomains

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.

Access from other devices

Using xip.io you can access your servers from other devices (iPad, iPhone, ...) on your LAN.

# Let's say your local address is 192.168.1.12
http://<app_name>.192.168.1.12.xip.io/

You can find your local address using ifconfig or going to index.ka

Remote access behind NAT/firewall

Using ngrok.com you can share access to your servers with others, when running behind a firewall or NAT.

First, follow the instructions to install ngrok, then register on the site to enable custom subdomains.

Then run ngrok with your application name as the subdomain:

ngrok http -subdomain app_name 80

This exposes port 80 to the internet on app_name.ngrok.io. Use at your own risk: all of your web hosts are accessible on this port while ngrok is running.

Access using HTTPS

You can also use HTTPS to access your servers https://<app_name>.ka.

Logs

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

Version managers

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

Troubleshoot

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

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

Uninstall

$ 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.

More Repositories

1

json-server

Get a full fake REST API with zero coding in less than 30 seconds (seriously)
JavaScript
70,794
star
2

husky

Git hooks made easy 🐶 woof!
JavaScript
31,302
star
3

lowdb

Simple and fast JSON database
JavaScript
20,699
star
4

hotel

🏩 A simple process manager for developers. Start apps from your browser and access them using local domains
JavaScript
9,953
star
5

jsonplaceholder

A simple online fake REST API server
HTML
4,945
star
6

tlapse

📷 Create a timelapse of your web development... or just automatically take screenshots of your hard work ;)
JavaScript
2,026
star
7

xv

🙅‍♀️ ✌️ fastest test runner
JavaScript
829
star
8

pegasus

Load JSON while still loading other scripts
JavaScript
702
star
9

steno

Super fast async file writer with atomic write ⚡
JavaScript
664
star
10

react-fake-props

🔮 Magically generate fake props for your React tests
JavaScript
628
star
11

fetchival

Easy window.fetch requests
JavaScript
517
star
12

lodash-id

Makes it easy to manipulate id-based resources with lodash or lowdb
JavaScript
467
star
13

react-lodash

⚛️ 🔧 Lodash as React components
JavaScript
356
star
14

stop-server

📱 Shut down your computer with your phone
JavaScript
341
star
15

demo

A demo repository for My JSON Server (Alpha)
326
star
16

pinst

🍺 dev only postinstall hooks (package.json)
JavaScript
256
star
17

please-upgrade-node

💁 Show a message to your users to upgrade Node instead of a stacktrace
JavaScript
238
star
18

jsop

JSON file reader/writer (powered by Object.observe)
JavaScript
205
star
19

mistcss

Write atomic React components using only CSS! (JS-from-CSS™) 🌬️
JavaScript
168
star
20

husky-4-to-8

Quickly migrate your hooks from husky v4 to husky@latest
JavaScript
126
star
21

user-startup

Auto start commands when you log in (cross-platform)
JavaScript
123
star
22

cult

cult monitors gulpfile changes and reloads gulp
JavaScript
118
star
23

logan

Mini template system for the console and colors
JavaScript
80
star
24

bg.nvim

Automatically sync your terminal background with your colorscheme 🎆
Lua
70
star
25

minihost

Easily start and access servers
JavaScript
45
star
26

ghwn

Get desktop notifications for new issues, comments, stars... (no installation required)
HTML
42
star
27

shoutjs

Make your ShellJS commands explicit and get a beautiful output
JavaScript
29
star
28

homerun

Turn npm package scripts into CLI commands
JavaScript
24
star
29

server-ready

Know when a server is ready to receive requests
JavaScript
20
star
30

husky-init

JavaScript
20
star
31

backbone-pegasus

Load models and collections data while loading Backbone
JavaScript
19
star
32

server-ready-cli

Run commands only when a server is available
JavaScript
18
star
33

typicode.github.io

HTML
7
star
34

eslint-config

JavaScript
7
star