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.
How-To
Install/Learn Capistrano
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
play deps
Run the play capify command
Play-Capistrano module is delivered with one single command for the time being:
play capify
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:
cap deploy:start
This remote start the server in nohup using the run.sh to make it background.
cap deploy:stop
This remote stops the server.
cap deploy:restart
This remote stops/starts the server.
cap play:logs
This “tail -f” remote logs.
cap play:kill
This kills the remote server.
cap play:ps
This view remote process info.
cap play:pid
This retrieves play application pid.
cap play:status
This retrieves play application status.
cap play:version
This retrieves play application version.