15 ms·
Introducing Pow, a zero-configuration Rack server for Mac OS X
- sstephenson 16y agoPow is a Node.js app written in CoffeeScript. It includes an HTTP and a DNS server and runs Rack apps by way of Josh Peek's Nack library: https://github.com/josh/nack https://github.com/josh/nack The screencast shows how it works and why we made it: http://get.pow.cx/media/screencast.mov http://get.pow.cx/media/screencast.mov If you're interested, you can read the annotated source code, written in literate style and generated with the wonderful Docco: http://pow.cx/docs/ http://pow.cx/docs/
- jashkenas 16y agoRun, don't walk, to read through the source... Sam's documentation is really enlightening, for folks who want to try their hand at building little servers in Node. http://pow.cx/docs/http_server.html http://pow.cx/docs/http_server.html
- 2mur 16y agoVery cool. Can't wait to dig into the source (learning node currently)!
- deleted 16y ago[deleted]
- koenigdavidmj 16y agoI do not much like this 'curl $random_url | sh' installation method. I am not going to be running some random script without looking long and hard at it first.
- sstephenson 16y agoCompletely understandable. That's why the installer source is fully documented and linked up for your review. http://get.pow.cx/ http://get.pow.cx/
- clint 16y agoWhy not just download it and then read it yourself? Do you enter your root password when installing some GUI applications? At least in this instance you can read over the commands that will be run beforehand—in fact, Sam actively encourages you to do so.
- burke 16y agoI don't understand how this is any different from running the application after you install it by whatever other method. Your shell doesn't have some higher level of access than most other software.
- bradleyland 16y ago> I don't understand how this is any different from running the application after you install it I'll tell you one difference. It takes me 10 minutes to review the shell based installer. It takes a whole lot longer to inspect an installation package or application source code.
- jarin 16y agoThis just goes to show that there will be naysayers for literally every good idea. It's a one-page script and a reasonably small, public git repo, from a company that doesn't exactly have a reputation for hacky, unreliable software.
- tlrobinson 16y agoDo you read through the source of every piece of software you download and install? If not then why worry about one shell script?
- swindsor 16y agoThen 'curl get.pow.cx > pow.sh'. Take you time and look at the script, then run it. Worked for me.
- tptacek 16y agoThis is a great web page, but I think it's borderline irresponsible to keep using this gimmick: curl get.pow.cx | sh for installation. Yes, it's easy and slick. Yes, you'd have to read the code itself to make sure Pow didn't own your machine up after a secure install. Yes, you can just read the shell script. But 0.0001% of people playing with Pow will do that. Why make things easier for attackers at all? This is an idea that I think started with Ximian back in 2000 and I think we're ready for it to die. It'd be neat if the authors of Pow were cool enough to strike it from their (otherwise amazing) front page. (I'd also be happier if the thread where the guy explains how Pow works and what it's components are were voted higher than this comment.)
- burke 16y agoWhy is this bad? I get why it seems offensive, but how is running a random shell script from some host any different than running some random software downloaded and installed from the same host? Anything malicious that the shell script could do could also be done by the software itself once installed, no? If they're from the same official source, why should one be considered more trustworthy than the other? EDIT: Okay, I see it's because of the use of sudo. But graphical installers often require the root/administrator password, and could be equally destructive.
- tptacek 16y agoIf you download an installer from an https:// https:// link, even though you still aren't capital-S Secure, you're still more secure than running shell scripts spat out over TCP port 80.
- burke 16y agoSure, but a huge amount of software is distributed over plain old HTTP anyway. I agree that we should be using HTTPS for things like this, but I don't buy that curling a shell script is worse than downloading an installer over an unencrypted connection.
- bretthoerner 16y ago
- mef 16y agoPow uses an interesting trick to get the *.dev urls resolving to localhost: it adds /etc/resolver/dev which acts as a resolv.conf for the .dev domain, and points to the nameserver at 127.0.0.1 port 20560. The Pow server binds to that port and acts like a nameserver for .dev domains.
- weehuy 16y agoThis is cool idea and I wish it was available for linux.
- mickeyben 16y agogem install passenger passenger start no preference panes to install. No Apache configuration files to update. And Passenger eliminates the need to edit /etc/hosts. To get a Rack app running, just type a single command.
- sstephenson 16y agoYou conveniently omitted the step where you get an app running. And upgrading Passenger requires you to install a gem, then run a command, copy and paste a bunch of text into your Apache config file, and restart Apache.
- FooBarWidget 16y agoNot in the example he gave. He was using Phusion Passenger Standalone, i.e. not Phusion Passenger for Apache. Phusion Passenger Standalone does not require an external web server. It literally is just running 'passenger start'. No config files to edit. http://blog.phusion.nl/2010/07/01/the-road-to-passenger-3-technology-preview-3-closing-the-gap-between-development-and-production-rethinking-the-word-easy/ http://blog.phusion.nl/2010/07/01/the-road-to-passenger-3-te...
- clint 16y agoI did this and soon my computer was downloading and compiling nginx. When this finished, I got an error and it all failed: "* ERROR: Please install file-tail first: sudo gem install file-tail"… So I did and now its supposedly running on Port 3000 except I just get a 403 error when I visit it in my browser. The docs aren't very helpful either (http://www.modrails.com/documentation/Users%20guide%20Standalone.html#_usage http://www.modrails.com/documentation/Users%20guide%20Standa...). Update: I apparently missed the line about going to my application's root directory. I still didn't really like all the stuff that got downloaded and compiled on my machine, when all I would like to do is get started developing.
- FooBarWidget 16y agoI'm a Phusion Passenger developer. The goal for Phusion Passenger Standalone really is to have the command 'passenger start' Just Work(tm). After installing all required libraries, if it says it's running on port 3000 and it doesn't, then it's either a bug which we are dedicated to fix, or there might be something wrong with your system. The 'file-tail' thing is actually a bug (we should no longer have a requirement on file-tail). We've already fixed it in git master 3 days ago and the fix will be released very soon. Can you give me some more details about the 403 error? Do you see anything in the console or in the browser window that tells you more about the error?
- mjijackson 16y agoHooray! No more mucking around in /etc/hosts, .rvmrc, or .profile! Now you can muck around in ~/Library/Application Support/Pow/Hosts, .powrc, and .powenv instead! Thanks but no thanks. Do yourself a favor and learn how to install rack and nginx. It's already dirt simple, and you'll save yourself having to go back and learn it when it's time to deploy your app somewhere other than your laptop.
- jarin 16y agoOr, you could NOT muck about in ~/Library/Application Support/Pow/Hosts, .powrc, and .powenv, and just symlink your app directories into ~/.pow, which is probably how 99% of developers will use it.
- telemachos 16y agoIn fairness to the parent post, it may not always be that simple. I installed, symlinked as you described and am currently looking at a page filled with "Pow: Error Starting Application". (Apparently it thinks I don't have Bundler installed. This is likely an issue because of pow + rvm + gemsets + factor x.) The downside of zero configuration is "What do you do when it doesn't just work?" (I'm digging around the manual now...) (A quick follow-up: The second app I symlinked in the exact same way does "Just work", so I don't doubt that there's something odd about my config for the first. Still, no fun to debug.)
- msbarnett 16y agoAs near as I can tell at the moment, it doesn't seem to respect any gemsets specified in your project .rvmrc, just the ruby interpreter specified.
- telemachos 16y agoOdd - my two apps have identical .rvmrc files (both using the same interpreter and gemset). Even odder, the first app is now working, and I'm completely not sure why.
- Timothee 16y agoNot important, but why the ".cx" TLD? Is this intended to be pronounced a certain way?
- jarin 16y agoI would guess it's more of a "pow.* was available for this TLD" decision.
- jarin 16y agoLet's take an informal poll: how many people grousing about the installation method were actually planning to install and use this?
- whalesalad 16y agoWhat the hell it's written in node.js and coffeescript. Color me impressed. I'm now motivated to tackle this for python.
- mrkurt 16y agoI don't know much about wsgi, but it seems like you could make a node.js <-> wsgi adapter pretty easily.
- sstephenson 16y agoI'd love to see a WSGI adapter for Pow! Check out Nack (https://github.com/josh/nack https://github.com/josh/nack) to see how Pow runs Rack apps.
- _Fil_ 16y agoIndeed, that would be awesome if we could have the same kind of zero-conf, instant-deploy-via-symlink for wsgi/python apps.
- chrisledet 16y agoMaybe it's just me but I can not seem to get any application to work. Chrome just says "Server Not Found". I tried to check the logs in ~/Library/Logs/Pow but the directory doesn't even exist. Didn't know if it was something silly before I created a ticket on Github.
- Deadsunrise 16y agoyep, same thing here. I get this if I launch it manually on 10.6.7: launchctl load "$HOME/Library/LaunchAgents/cx.pow.powd.plist" Bug: launchctl.c:2325 (23930):13: (dbfd = open(g_job_overrides_db_path, O_RDONLY | O_EXLOCK | O_CREAT, S_IRUSR | S_IWUSR)) != -1 launch_msg(): Socket is not connected
- Deadsunrise 16y agoit's seems to have something to do with Iterm or tmux. It works using the terminal. edit: I only get the error using tmux, strange..
- chrisledet 16y agoyeah, that seemed to have fixed it. Terminal works, iTerm doesn't.
- ujeezy 16y agoWhen I ran this, I got the following error: "launchctl: Dubious permissions on file (skipping)" The file was chmodded to 664; changing it to 644 did the trick.
- josefrichter 16y agoI have no f*kin'idea how you did this, guys. But the result is amazing even for us, casual weekend spaghetti coders ;-)
- weehuy 16y agoHow much of this is OSX specific since it's a node.js app? Other than the launchctl and plist stuff could this be ported to linux?
- pudquick 16y agoThe majority of the OS X -specific aspects have to do with how it launches (launchd .plist files) and how it automagically resolves .dev domains (using /etc/resolver - see: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man5/resolver.5.html http://developer.apple.com/library/mac/#documentation/Darwin... ) Substituting launchd is easily done with any process launcher of your choice. As for the .dev TLD trick - that's a little harder, as OS X 10.6 has support for flat files inside /etc/resolver/* which the name of the file indicates what configuration/settings to use when resolving that domain. As such, they just drop a file named 'dev' in there and tell it to look to localhost on a custom port for DNS resolution. Then they run a mini DNS server on that port to resolve .dev domains to localhost. Probably the only way to do something similar to this for linux would be to run a name server of your own on your box and add a custom zone configuration for the .dev TLD and recursive lookup for anything else.
- weehuy 16y agoYea this is interesting, with a little fiddling I was able to get the webserver up. It's not picking up my app yet. Though I'm not sure if it's because it's not being initialized or because I can't reach it due to not having the dns setup.
- Frozzare 16y agoGreat stuff!
- bonaldi 16y agoInstallation wasn't easy or slick here: *** Installing local configuration files... /Users/bonaldi/Library/Application Support/Pow/Versions/0.2.2/lib/command.js:50 throw err; ^ Error: EACCES, Permission denied '/Users/bonaldi/Library/LaunchAgents/cx.pow.powd.plist'
- bonaldi 16y agoIf anyone else sees this, the script assumes it can write to ~/Library/LaunchAgents as you. Make sure you can!
- bradgessler 16y agoA gem distribution of this would have been nice... simply so that instead of: $ curl get.pow.cx | sh $ cd ~/.pow $ ln -s /path/to/myapp We could have: $ gem install pow $ pow /path/to/myapp
- joshpeek 16y agopow isn't written in ruby, but javascript. So it might be installable from npm soon. If you `git clone git://github.com/37signals/pow.git`, you can install it from source with `npm install -g` (requires npm 1.0)
- bradgessler 16y agoNice!
- deleted 16y ago[deleted]
- xtacy 16y agoIt would be nice if there were an easy way to start/stop pow when needed.
- tvon 16y agoThat x86_64 node executable doesn't play nice with Core Duo Mac's.
- marcomonteiro 16y agoOk, we get it, some people are paranoid and afraid of running a "random script" and having to sudo to install it. Can we please have a discussion on the merits of the actual application. I just installed it - I trust 37signals enough to give them the benefit of the doubt - and love how simple it is to access different apps I'm working on at the same time without having to worry about configuration. Thanks 37signals.
- matthewsinclair 16y agoAs an aside, does anyone know what was used to generate the "Annotated Source" code listings? They look absolutely beautiful. Were they generated from the underlying source, or put together by hand?
- slashclee 16y agoSam says it's generated by http://jashkenas.github.com/docco/ http://jashkenas.github.com/docco/ here: http://news.ycombinator.com/item?id=2420535 http://news.ycombinator.com/item?id=2420535
- deleted 16y ago[deleted]
- tvon 16y agoA shell function to add directories to ~/.pow: function pow { if [ -d "`cd $1; pwd`" ]; then ln -s "`cd $1; pwd`" ~/.pow/ fi }
- brndnhy 16y agohttp://pow.cx/docs/ http://pow.cx/docs/ This is very nice documentation. Is it generated using a freely available tool?
- Aleran 16y agoGenerated with Docco: http://jashkenas.github.com/docco/ http://jashkenas.github.com/docco/
- jpcx01 16y agoPretty awesome. It took a restart to get it to work, but it's great now. As a minor aside, is there a way to get Chrome to treat .dev domain the same as .com? Whenever I type in my .dev app name, it tries to google search for it.
- jpcx01 16y agoNice, you can change the env variable POW_DOMAIN to ".local". Much better in my opinion (works better with chrome at least) EDIT: scratch that. You can't do this.
- deleted 16y ago[deleted]
- stephth 16y ago+1, I'd like to know that. In the meantime, you can access a new app the first time by entering http://myapp.dev http://myapp.dev (including the http:// http://). Looks like after that, Chrome treats myapp.dev as desired.
- deleted 16y ago[deleted]
- stephth 16y agoI love this. You simply create a symlink to your app, and boom, the app works at nameofthesymlink.dev. Even after a system restart. And pow is clever enough to only start workers if the app is accessed and shut them down when idle. This is a blessing if you usually need multiple local apps running. It also means you can now elegantly use local ruby webapps as personal desktop applications. Say you'd like to build a simple journal or expenses app to use on your desktop for personal use. You can now quickly build it with - say - Sinatra, Datamapper and SQLite. And no need to launch or quit it. Beautiful.
- sohara 16y agoEspecially after a system restart
- sstephenson 16y agoThanks for posting this... after reading all the FUD, it really made my day.
- stephth 16y agoThanks for building and sharing it. By the way, I didn't completely understand why I would use it instead of Thin until I had it running and had read http://pow.cx/manual.html http://pow.cx/manual.html. Maybe the mechanism I described in the first paragraph of the grandparent should be more prominently and clearly communicated? Maybe that's part of what you meant with the first two paragraphs under "Pow prevails over the forces of evil.", but in that case I think they could be more specific. But maybe that's just me.
- tptacek 16y agoSeriously, dude, nobody is out to get you. I'm glad you made Pow. Pow looks awesome. I don't control what gets voted to the top of the page, and I'm probably no happier than you are about the sprawling nerdwar that resulted.
- stephth 16y agoSeriously, dude, nobody is out to get you. I'm glad you made Pow. Pow looks awesome. I don't control what gets voted to the top of the page, and I'm probably no happier than you are about the sprawling nerdwar that resulted. Seriously, dude, get over yourself. It's pretty ridiculous how much FUD this project announcement received in here, versus positive focus. There are multiple other long FUD threads that missed the point of Pow; you only started (and kept throwing fire at) the one that doesn't even touch what the project is about.
- kunley 16y agoI don't see any connection between being "super-hero" and a mindset when you don't know how your code works inside.