Home / Community
Home / Community

Prax the POW for Linux

12bb6ed9fbbd247ced563e5e7ff9fddcby David Vega|

Jul 10, 2013


Recently I've been working on a project that has several services, that means I need at least 2 apps running at the same time, the URL will be something similar to localhost:3000 and localhost:3001, by looking at the URL you can't be sure wich one is running, and the browser's auto-complete feature can make it even more difficult when you have urls like localhost:{port}/:controller/:action/extra_stuff.


Mac Users have POW, which is a zero-config Rack server, you just need to make a link to your-app and it will become available under a local "your-app.dev" domain. That means no rails s command are needed anymore, browser autocomplete features, it becomes more "human-readable", and it is also better for configurations because instead of pointing to "localhost:{port}" you will be pointing to "your-app.dev".

Linux users don't have it that easy as usual, but still, everything I have mentioned is feasible in Linux with "Prax". It is still a little rough, but then, where would the fun be if it wasn't that way, right?

Down to business

The installation is very straightforward. The requirements are the following:

  • Make sure you have all the Ruby dependencies up to date, including: build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev nodejs
  • Have your Ruby on Rails environment running
  • Be sure that your Ruby version is compatible, you can check on the official Prax git repository

Then run the following commands:

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

Inside the prax folder we enter to ext and make the install.

$ cd prax/ext/
$ make
$ sudo make install

Type sudo gedit /etc/nsswitch.conf and add prax at the end of the host line, and restart your browser.

prax resolver

Create your Prax folder in your home directory typing mkdir ~/.prax, you may link the same folder multiple times with different names to serve it from different domains.

Start the Prax server

cd ~/prax/bin
prax start

At this point we have Prax all setup, and to add a new app to it you just need to make a link.

ln -sf ~/route_to/myapp ~/.prax/

And BAM! you have your app running under a ".dev" domain

Prax test

Of course you don't have the fancy commands included in POW, but you can still get things done.

This is the official project on github.

Hope you enjoy working with Prax as much as I do. Remember you can contact me via email, or follow me on twitter

Thanks for reading!

blog comments powered byDisqus