If you are on OSX you can learn Capistrano to talk. And when you do, he can tell you when your deploy is done.
Just add the following task to your deploy.rb
1 2 3
| task :do_speak do
system("/usr/bin/say -r 250 -v Zarvox 'Sir, your #{rails_env} deploy is done'")
end |
And hook it up to run after deploy
1
| after 'deploy', 'do_speak' |
Now use your imagination, and add more words to Capistrano’s vocabulary
If you are using Linux or windows you can use espeak to get the same results
Cheers!
Posted in
Programming,
Rails,
Ruby at May 19th, 2012.
No Comments
Tagged with
capistrano,
deploy,
Ruby. Written by:
stjernstrom
Note to self.
When deploying my RubyOnRails applications with Capistrano and I get errors like this one
1 2 3 4 5
| servers: ["app.myserver.com"]
[app.myserver.com] executing command
** [out :: app.myserver.com] sh: bundle: command not found
command finished in 31ms
servers: ["app.myserver.com"] [app.myserver.com] executing command ** [out :: app.myserver.com] sh: bundle: command not found command finished in 31ms |
Capistrano executes the commands in a very basic shell so the $PATH environment are not the same as when you login through SSH.
One way to solve this is by setting PermitUserEnvironment to yes in /etc/sshd_config and then add the correct PATH to ~/.ssh/environment
I just found another way that was much easier
In you config/deploy.rb add the following snippet
1 2 3
| set :default_environment, {
'PATH' => "/opt/ruby-enterprise/bin/:$PATH"
} |
Thats it!
Cheers!
Posted in
Programming,
Rails,
Ruby at June 1st, 2011.
4 Comments
Tagged with
capistrano,
deploy,
Ruby. Written by:
stjernstrom
My Sinatra + Apache + Passenger setup did not just run
Deploying a simple Sinatra rack application under Apache and Phusion Passenger turned out not work out of the box for me.
I already had a virtual host so I decided to deploy with passengers sub URI (sub URI documentation).
To make this work you’ll need Apache installed with Phusion Passenger setup (Passenger installation)
This is what I started with
This is my folders for the already existing website.
1 2 3 4
| # Existing homedir
/home/my_web/
# Current webroot
/home/my_web/htdocs |
Creating folders and files for Sinatra
The first thing you want to do is to create folders and files for Sinatra.
1
| mkdir /home/my_web/sinatra |
1 2 3 4 5 6
| cd /home/my_web/sinatra
mkdir tmp
mkdir logs
mkdir public
touch app.rb
touch config.ru |
Create symlink
Create a symbolic link from our current webroot to the new Sinatra app so that apache/passenger can find it.
1
| ln -s /home/my_web/sinatra/public /home/my_web/htdocs/app |
Creating the application
We also need a Sinatra application for this to work so lets fill those files.
File: config.ru
1 2 3 4 5 6 7 8 9 10 11
| require 'app'
set :environment, ENV['RACK_ENV'].to_sym
set :app_file, 'app.rb'
disable :run
log = File.new("logs/sinatra.log", "a")
STDOUT.reopen(log)
STDERR.reopen(log)
run Sinatra::Application |
File: app.rb
1 2 3 4 5 6 7 8 9 10 11
| require 'rubygems'
require 'sinatra'
before do
# Strip the last / from the path
request.env['PATH_INFO'].gsub!(/\/$/, '')
end
get '' do
"Hello world"
end |
Apache configuration
Now we need to setup apache so that it can find our Sinatra app and load it.
The only thing you need to do is add the following line to your existing VirtualHost block:
This line will tell passenger to look into our existing webroot for a symlink thats named app and which points to our rack app. (RackBaseURI documentation)
Virtual host entry
1 2 3 4 5 6 7 8 9 10 11 12
| <VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
DocumentRoot /home/my_web/htdocs/
RackBaseURI /app
<Directory "/home/my_web/htdocs/">
Order allow,deny
Allow from all
AllowOverride All
</Directory>
</VirtualHost> |
The best part is that you are allowed to specify this option multiple times. So you can easily setup multiple apps under the same virtual host.
Cheers!
Just before christmas I worked with one of our customers new server cluster or cloud if you may.
This cluster has production nodes and staging nodes and this post is about how to get capistrano to play nice with both production and the staging environment.
Read More…