Play Capistrano Module
Very draft of the module, contributions are welcome
This module is released under Apache License 2.0
This is a very first draft of a Play module allowing to deploy easily a play app on a remote server with Capistrano, this marvelous remote control tool!
Capistrano is written in Ruby and if you are like me, a complete noob in Ruby, you certainly don’t want to write any line of Ruby within a Play application.
This module is aimed at that without preventing people more skilled in Capistrano and Ruby to do what they want.
I had problems using Ubuntu Synaptic packages so I installed manually with RVM and this is perfect. Go there
To learn the basics of Capistrano, go there
Install Play Capistrano module in your conf/dependencies.yml
play -> capistrano 1.0.0
Don’t forget to run the traditional
Run the play capify command
Play-Capistrano module is delivered with one single command for the time being:
This command copies the following required Capistrano files to your project (this is not perfect because it duplicates files from module):
- Capfile : the file expected by Capistrano containing the main entry point for it
- conf/play-recipes.rb : the deploy commands traditionaly provided by capistrano and tuned to Play
- conf/deploy.rb : the specific configuration file containing the remote servers/VCS addresses YOU MUST EDIT THIS FILE AND PUT YOUR CONFIG IN IT
- run.sh : a simple shell file (yes only linux support currently) containing the command to launch Play server in background.
For an unknown reason, it’s impossible to run a background shell command from capistrano directly and you must wrap it into a shell.
Edit conf/deploy.rb with your remote/VCS config
Just edit the file and replace parts in UPPER CASE
Then you enter into Capistrano world…
A few links:
The tweaked Capistrano Play recipes
Thanks to this Stackoverflow post for giving me a very good ground knowing my complete incompetence in Ruby:
You can setup team notifications every time a deployment happens through Hipchat by following this tutorial.
Deploying to Multiple Environments
You can also use Capistrano to deploy to multiple environments (staging, production, etc). For more information, please see this tutorial which goes over the changes necessary on play-recipes.rb you need to make to deploy to multiple environments without the multistage extension.
Please find more information on how to deploy to multiple environments on Felipe Oliveira’s Blog.
This remote start the server in nohup using the run.sh to make it background.
This remote stops the server.
This remote stops/starts the server.
This “tail -f” remote logs.
This kills the remote server.
This view remote process info.
This retrieves play application pid.
This retrieves play application status.
This retrieves play application version.