Skip to content

P-Pow makes Pow almost working with Play framework applications.

Notifications You must be signed in to change notification settings

guillaumebort/p-pow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

P-Pow

P-Pow (pronounce /pi-pô/ if you are french) makes Pow almost working with Play framework applications. It uses the Pow's port proxying feature to automatically register any Play application you run from the Play console, to its own .dev subdomain.

First you need Pow on MacOS

It is ridiculously easy to install:

curl get.pow.cx | sh

Then install P-Pow for your Play application

You need to add the P-Pow sbt plugin to your project build configuration. In project/plugins.sbt add the following lines to register the plugin:

resolvers += "Guillaume Bort" at "http://guillaume.bort.fr/repository"

addSbtPlugin("guillaume.bort" % "p-pow" % "0.1")

And then, in your Build.scala file, use the plugin for any Play project you want to expose via Pow:

val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
  playDefaultPort := PPow.EPHEMERAL,
  playOnStarted <+= name(PPow.register),
  playOnStopped <+= name(PPow.deregister)
)

Now, see the magic

Once you have P-Pow enabled for your application, it will be automatically registered on the .dev domain name when you run it.

For example:

       _            _ 
 _ __ | | __ _ _  _| |
| '_ \| |/ _' | || |_|
|  __/|_|\____|\__ (_)
|_|            |__/ 
             
play! 2.1-SNAPSHOT, http://www.playframework.org

> Type "help play" or "license" for more information.
> Type "exit" or use Ctrl+D to leave this console.

[helloworld] $ run

And then go to http://helloworld.dev/ to see your application running.

Why is it useful?

  • Because you don't have to choose (and remember) unique port number anymore for each application.
  • Because it supports subdomains (such as http://customer1.helloworld.dev/).
  • Because you skip all the cookie conflicts when running different applications on the same localhost domain.
  • Because you can use it with http://xip.io/ and http://showoff.io/.

Of course you can use different settings

Using the previous settings, the Play application will start on any free ephemeral port available, and use the application name as hostname.

Here is another possible configuration:

// Fixes the port
playDefaultPort := 1234, 

// And fixes the hostname to http://mycoolapp.dev/
playOnStarted <+= PPow.register("mycoolapp"), 
playOnStopped <+= PPow.deregister("mycoolapp")

Or this one could be useful if you have developers not using Pow:

playDefaultPort := { 
  if(file(System.getProperty("user.home") + "/.pow").exists) PPow.EPHEMERAL else 9000 
},
playOnStarted <+= name(PPow.register),
playOnStopped <+= name(PPow.deregister)

About

P-Pow makes Pow almost working with Play framework applications.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages