Access local servers on .dev domains.
npm install -g pult
~ $ pult-server
node-project $ pult node app # available at http://node-project.dev
ruby-project $ pult rackup # available at http://ruby-project.dev
Pult works by setting the PORT
environment variable, so it can be used
to start any server process that reads PORT
.
By default, Pult uses the name of the current directory to determine
what .dev
domain to serve from. You can specify a different domain
using the -n
option:
node-project $ pult -n my-project node app # available at http://my-project.dev
You can also set the domain in the .pult
file of the current
directory:
node-project $ echo 'my-project' > .pult
node-project $ pult node app # available at http://my-project.dev
Pult also serves the same application on all subdomains of its .dev
domain. For example, node-project
will be available at
http://node-project.dev
, http://www.node-project.dev
, etc.
Pult also allows you to serve different applications on subdomains
simply by specifying the subdomain with -n
or in the .pult
file:
other-project $ pult -n other.project node app # available at http://other.project.dev
To find out which domains are being forwarded to which ports, simply run
pult
with no arguments:
~ $ pult
pult.dev 80
node-project.dev 7000
ruby-project.dev 7001
By default, pult-server
spawns itself with sudo then forks to the
background. To run pult-server
as a foreground process, pass the -f
option:
~ $ pult-server -f
To stop pult-server
while it is running in the background, pass the
-k
option to pult
:
~ $ pult-server
~ $ pult -k
pult-server
spawns itself withsudo
pult-server
starts a DNS serverpult-server
adds itself to/etc/resolv.conf
pult-server
starts an HTTP serverpult
requests a port for the applicationpult-server
finds or assigns a new port for the domainpult-server
begins responding to DNS queries for the domainpult-server
begins reverse-proxying HTTP for the domain to the portpult-server
returns the port topult
pult
sets thePORT
environment variablepult
spawnsnode app
Pult assigns ports sequentially starting from 7000.
- Pow
- Advantages:
- Runs as regular user
- Allows serving the same application from multiple domains (not just subdomains)
- Disadvantages:
- OS X only
- Rack-specific
- Requires symlinking (explicit setup)
- Takes over control of your server processes
- Advantages:
Pult has been tested on:
- Ubuntu 13.10
- Mac OS X 10.9.1
- Arch Linux (2014-01-26)
Copyright © 2014, Curtis McEnroe programble@gmail.com
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.