A pure ruby alternative to Pow!!
Aka a Rack application spawner and proxy for simpler local development. Calling myapp.dev
and subdomain.myapp.dev
with no configuration is simpler than editing your hosts file, starting your applications manually on port 3000, etc.
My GNU/Linux fork of Pow just broke on me badly. I ain’t smart enought to understand, less write, any Coffee-Script, so I decided to try an alternative in Ruby, which I am capable to write, learning a lot about sockets, HTTP and Rack on the way.
It also only requires Ruby and the Rack gem, both you should have already installed if you are a Ruby Web developer.
There ain’t no install script yet. So you must install things manually for now.
Please note it has only been tested on Ruby MRI 1.9.3 and that it may not work correctly on another or older Ruby engine.
First clone the repository, install the port forwaring script and NSSwitch extension.
$ git clone git://github.com/ysbaddaden/prax.git $ cd prax/ $ sudo cp install/initd /etc/init.d/prax $ sudo chmod +x /etc/init.d/prax $ sudo update-rc.d prax defaults $ sudo /etc/init.d/prax start $ cd prax/ext/ $ make $ sudo make install
Edit /etc/nsswitch.conf
and add prax
to the hosts
line, then restart your browser, otherwise it won’t use the newly configured prax resolver.
Create the ~/.prax
directory and link your apps to it. You may link the same folder multiple times as different names to serve it from different domains.
$ mkdir ~/.prax $ ln -sf ~/Work/myapp ~/.prax/
Eventually start bin/prax
to run Prax, point your browser to http://myapp.dev/
and wait for your Rack app to spawn.
Mac OS X isn’t supported yet. Feel free to contribute!
This is a work in progress, and Prax is missing some features to be on par with Pow. Mostly on the configuration side of your development machine. Yet it’s already capable to start the HTTP server, spawn your apps, proxy requests, and more.
-
HTTP Server
-
HTTP Proxy
-
Rack Handler (Racker)
-
Rack Application spawn / restart / always restart
-
SSL support (if certs and keys are generated)
-
xip.io support
-
GNU/Linux:
-
NSSwitch DNS resolver (resolves
*.dev
domains to127.0.0.1
) -
firewall rule (redirects root ports 80/443 to user ports 20559/20558)
-
-
app spawn failure notice (with backtrace)
-
put logs somewhere else than /tmp (~/.prax/.logs ?)
-
commands for the prax script:
-
prax install
-
prax default
-
prax list
-
prax link [name]
-
prax unlink [name]
-
prax log
-
prax restart
-
prax always_restart
-
prax cleanup
-
-
GNU/Linux:
-
install script
-
-
Mac OS X:
-
firewall rule
-
DNS resolver
-
install script
-
-
Julien Portalier <[email protected]>
-
pyromaniac for the initial NSSwitch extension.