[UNDER CONSTRUCTION] YAC? (Yet Another Capistrano)


#1

My needs are far more modest than Capistrano’s capabilities. Also, when
working in a shared hosting environment, the Capistrano model can be
outside the capabilities allowed by the Web host.

I simply need to push selected directories (on a changed-file basis) out
to a server. I have about 80% of the code written to do this (I’m
considering YAC for the name, with a nod to yacc). Another name might be
YAST (Yet Another SwitchTower).

Enough about what I’m doing… what I’m interested in is some
post-install config stuff. Capistrano does some magic to execute
commands on the server like operating spinner/spawner/reaper, and the
like. How are these command communicated to the server for execution?

Thanks


#2

My needs are far more modest than Capistrano’s capabilities.
like. How are these command communicated to the server for execution?

ssh -> scp -r (or ssh remotehost “svn up app/ && ngc -r lighttpd”)
coupled with ssh keys can make deployment an effortless and
capistrano-free process, if you desire

Thanks

btw i assume you know YAST is already taken, by SuSE…


#3

On Tue, Mar 07, 2006 at 08:29:43PM +0100, Steve R. wrote:

Yeah, I’m aware of “yet another setup tool.” Geez, the namespace
collisions ;-|

According to this, quacks cannot be trademarked, so one would
presumably be free to use them liberally in new product names without
fear of reprisal. It’ll give the ducks something to do during the
mandatory carpal tunnel breaks.

http://www.vindy.com/print/294235974238811.php


- Adam

** Expert Technical Project and Business Management
**** System Performance Analysis and Architecture
****** [ http://www.adamfields.com ]

[ http://www.aquick.org/blog ] … Blog
[ http://www.adamfields.com/resume.html ]… Experience
[ http://www.flickr.com/photos/fields ] … Photos
[ http://www.aquicki.com/wiki ]…Wiki


#4

rsync --exclude-from takes a file with list of excludes

On 3/7/06, Steve R. removed_email_address@domain.invalid wrote:

My needs are far more modest than Capistrano’s capabilities.


Posted via http://www.ruby-forum.com/.


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Tobi
http://shopify.com - modern e-commerce software
http://typo.leetsoft.com - Open source weblog engine
http://blog.leetsoft.com - Technical weblog


#5

On 3/7/06, Steve R. removed_email_address@domain.invalid wrote:

My needs are far more modest than Capistrano’s capabilities. Also, when
working in a shared hosting environment, the Capistrano model can be
outside the capabilities allowed by the Web host.

Why not just use Capistrano as the basic tool while overriding the
deployment recipes to only do what you want. That’s the beauty of
Capistrano – although it ships with good default configurations for
most Rails apps, it’s essentially just a tool for managing the
execution of commands on remote servers. I (along with others) have
even used it to manage non-Rails tasks ranging from legacy (;-)) PHP
site management to general sysadmin tasks.

I really dont see much point in reinventing the wheel, here.


Regards,
John W.
http://johnwilger.com


Alice came to a fork in the road. “Which road do I take?” she asked.
“Where do you want to go?” responded the Cheshire cat.
“I don’t know,” Alice answered.
“Then,” said the cat, “it doesn’t matter.”

  • Lewis Carrol, Alice in Wonderland

#6

But… the original question was how to execute a command on a remote
host. What I’m trying to accomplish is:

yac -e production -f myopts.yml

and all my stuff is grabbed from my local dev directory, some lighttpd
script config mods, database.yml mods may or may not be made, etc., then
some of that is uploaded using rsync.

I’ve been using rsync happily thus far, but my scripts don’t allow a
configuration step that both props to the server and leaves the dev
environment perking along happily.

Y’d think there would be a tool for this, but the need is so narrow,
it’s not surprising there’s not one. The basic idea is to upload to a
live server without hosing it or the development copy. I believe the
driving force behind Capistrano was to 1) create a one-touch deployment
mechanism that didn’t hose the development environment; and 2) create a
rollback mechanism on the deployment server. I can live without (2) but
really need (1) enough to write the code.

If I could trigger a server side command to put a symlink to a new
directory on the server that would be peachy, but I’m at a place where
it’s almost good enough as it is.

Steve

PS: I think I’ll call it Sparrow, adding to the name confusion and
possible trademark conflict (at least I’m not calling it Windows or
Macintosh), but if you think about it sparrows are small, and they (in
days of old) returned to the Mission at San Juan Capistrano every year.
No flames, please :slight_smile:

Tobias Lütke wrote:

rsync --exclude-from takes a file with list of excludes

On 3/7/06, Steve R. removed_email_address@domain.invalid wrote:

My needs are far more modest than Capistrano’s capabilities.


Posted via http://www.ruby-forum.com/.


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Tobi
http://shopify.com - modern e-commerce software
http://typo.leetsoft.com - Open source weblog engine
http://blog.leetsoft.com - Technical weblog


#7

On Mar 7, 2006, at 1:03 PM, Steve R. wrote:

But… the original question was how to execute a command on a remote
host. What I’m trying to accomplish is:

yac -e production -f myopts.yml

and all my stuff is grabbed from my local dev directory, some lighttpd
script config mods, database.yml mods may or may not be made, etc.,
then
some of that is uploaded using rsync.

As was mentioned earlier, you can use ssh to do this pretty easily:

ssh some.host.machine uptime

Capistrano, of course, uses the Net::SSH library so that you can
easily multiplex and manage connections to several servers
simultaneously and atomically, but if that isn’t a requirement for
you, just use the command-line ssh. It works great for simple one-off
tasks.

  • Jamis

#8

On 3/7/06, Jamis B. removed_email_address@domain.invalid wrote:

then
tasks.

  • Jamis

This is a bit off topic for this thread, but are there any plans to
abstract
out Net:SSH so that us poor windows users can feel the love as well?


#9

Yeah, I’m aware of “yet another setup tool.” Geez, the namespace
collisions ;-|

rsync and scp are slightly too blunt of instruments. I really don’t want
to copy up config items that only pertain to a dev environment. E.g.,
changing lighttpd ports, development/test modes, database.yml, and on
and on…

carmen wrote:

My needs are far more modest than Capistrano’s capabilities.
like. How are these command communicated to the server for execution?

ssh -> scp -r (or ssh remotehost “svn up app/ && ngc -r lighttpd”)
coupled with ssh keys can make deployment an effortless and
capistrano-free process, if you desire

Thanks

btw i assume you know YAST is already taken, by SuSE…


#10

On Mar 7, 2006, at 1:45 PM, Tanner B. wrote:

lighttpd
simultaneously and atomically, but if that isn’t a requirement for
you, just use the command-line ssh. It works great for simple one-off
tasks.

  • Jamis

This is a bit off topic for this thread, but are there any plans to
abstract out Net:SSH so that us poor windows users can feel the
love as well?

Net::SSH is available for all platforms. Just do:

gem install net-ssh

The manual, if you’re feeling insomniac, is:

http://net-ssh.rubyforge.org

  • Jamis

#11

On 3/7/06, Jamis B. removed_email_address@domain.invalid wrote:

yac -e production -f myopts.yml

abstract out Net:SSH so that us poor windows users can feel the

  • Jamis

Yes, but SSH isn’t available on all windows servers. And there are
ways,
without extra software on the serverside, to do remote command execution
across the network in windows. I’d really like an interface where I can
plug in an alternate method of command execution (knowing full well that
commands could vary from recipe to recipe, I’m okay with that). Then I
could get all of the good parts of capistrano, without having to go put
SSH
onto a bunch of windows servers that would never be used by anything but
this.


#12

On Mar 7, 2006, at 3:20 PM, Tanner B. wrote:

parts of capistrano, without having to go put SSH onto a bunch of
windows servers that would never be used by anything but this.

Net::SSH has no dependency on any external SSH utility. All it needs
is the OpenSSL module that ships with Ruby.

Am I misunderstanding your objection?

  • Jamis

#13

On 3/7/06, Jamis B. removed_email_address@domain.invalid wrote:

gem install net-ssh
an interface where I can plug in an alternate method of command
execution (knowing full well that commands could vary from recipe
to recipe, I’m okay with that). Then I could get all of the good
parts of capistrano, without having to go put SSH onto a bunch of
windows servers that would never be used by anything but this.

Net::SSH has no dependency on any external SSH utility. All it needs
is the OpenSSL module that ships with Ruby.

Am I misunderstanding your objection?

Yes, as it relies on the external dependency of an SSH server :wink:
Windows by
default does not include an SSH server with which to connect Capistrano
to
(nor is it something I would wish to do to all of our production
servers).
Abstracting the entire SSH interface out, would let those of us on
Windows
use an alternate method to connect to our servers. But currently (from
my
brief look at the sources) Net::SSH is used directly in the majority of
the
code. Putting an interface between the rest of Capistrano and Net:SSH
would
allow me to replace SSH with something that will work against an
un-modified
Windows server. If I’m still being too vague feel free to e-mail me off
list and I’ll attempt to be clearer.

  • Jamis

#14

Google for openssh + winows and install the requirements. What you are
doing is like complaining that newly bought wallets come without money
in them.

list and I’ll attempt to be clearer.


Tobi
http://shopify.com - modern e-commerce software
http://typo.leetsoft.com - Open source weblog engine
http://blog.leetsoft.com - Technical weblog


#15

Thats exactly what I did to solve the same problem, I even posted the
recipe here. I’ll copy it as it is small…

For those who want use switchtower to deploy to a remote server that
does not have
access to the main subversion repository, here is a task I just hacked
up to use
switchtower to deploy to my servers by copying a local directory to the
servers, rather
than have the servers use svn checkout.

I actually create my local directory using an svn export, but you can do
whatever you
like here, and just deploy a local copy of your development directory
tree if you like.

You can also exclude whatever directories or files you want using tar’s
–exclude FILE option.

I include my after_update_code as this seems something most people need
to do.

This could be done a lot better but it works :slight_smile:

desc “fix up database and .htaccess”
task :after_update_code do
run “cp #{release_path}/config/database.yml.templ
#{release_path}/config/database.yml”
run “cp #{release_path}/public/dot.htaccess.deploy
#{release_path}/public/.htaccess”
end

desc <<DESC
Update all servers with the latest release of the source code.
This is a modified version that copies a local copy to the remote site
DESC

task :update_code, :roles => [:app, :db, :web] do
on_rollback { delete release_path, :recursive => true }

#puts "doing my update_code"
temp_dest= "tmp_code"

#puts "...get a local copy of the code into #{temp_dest} from local 

svn"
# but this could also just be your local development folder
system(“svn export -q #{configuration.repository} #{temp_dest}”)

#puts "...tar the folder"
# you could exclude files here that you don't want on your 

production server
system(“tar -C #{temp_dest} -c -z -f code_update.tar.gz .”)

#puts "...Sending tar file to remote server"
put(File.read("code_update.tar.gz"), "code_update.tar.gz")

#puts "...detar code on server"
run <<-CMD
    mkdir -p #{release_path} &&
    tar -C #{release_path} -x -z -f code_update.tar.gz &&
    rm -rf code_update.tar.gz &&
    rm -rf #{release_path}/log #{release_path}/public/system &&
    ln -nfs #{shared_path}/log #{release_path}/log &&
    ln -nfs #{shared_path}/system #{release_path}/public/system
CMD

#puts "...cleanup"
system("rm -rf #{temp_dest} code_update.tar.gz")

end


#16

On Mar 7, 2006, at 4:34 PM, Tanner B. wrote:

vague feel free to e-mail me off list and I’ll attempt to be clearer.
Ah, understood. I thought you were talking about SSH clients (which
Net::SSH is). You are talking about SSH servers. Got it.

Yup, that would be nifty if someone were to submit a patch for that.

  • Jamis

#17

On 3/7/06, Tobias Lütke removed_email_address@domain.invalid wrote:

Google for openssh + winows and install the requirements. What you are
doing is like complaining that newly bought wallets come without money
in them.

No, I’m not complaining in the least. I think Capistrano is a very well
done peice of software, that doesn’t quite fit my needs. I’m making a
suggestion and attempting to explain what would get it closer to fitting
my
needs. I’m aware that openssh can be installed on windows, I’m also
aware
of our security policies and I imagine that of many other people. I’m
not
allowed to put anything on a server, that will open more ports or
require
changes to the firewall. I can however install clients (svn for
instance).
Capistrano in it’s current state cannot fit my needs, I made a
suggestion of
something that could get it there. I don’t expect Jamis to do it, it
was
just a suggestion. Sorry if my suggestion was taken as a demand, or as
unaware of other potential solutions.