Installing MySQL with Capistrano

292 views
Skip to first unread message

No BS

unread,
May 12, 2009, 9:18:42 PM5/12/09
to Capistrano
I'm surprised I haven't been able to find any postings or articles
about this so far, but I was wondering if it's possible to install
MySQL on a new VPS using Capistrano.

I've seen some really good Rails stack install scripts and even made
my own, but all of them require you to initially SSH into your server
to create a new user and change your default root password, and then
after the stack install script is run, you must then SSH back into the
server to install MySQL and configure it.

That still seems like too much work to me, so I'm trying to create
some Capistrano scripts to do both the pre- and post-stack install
work for me as well. Obviously the issue with installing MySQL from
Capistrano is the big blue and gray screen you're presented with on
installation to set your root password and whatnot. Anyone know how
you might go about handling this sort of input/output?

So far, we have something like this:
<code>
desc "Install MySQL"
task :install_mysql, :roles => :app do
sudo "apt-get install mysql-server libmysql-ruby -y"
end
</code>

And for simpler input requirements, we could do something like this:
<code>
run "apt-get install mysql-server libmysql-ruby -y" do |ch,stream,out|
next if out.chomp == input.chomp || out.chomp == ''
print out
ch.send_data(input = $stdin.gets) if out =~ /regex_stuff_here/
end
</code>

But how do you handle that big blue prompt screen?

-Steve

Greg Pederson

unread,
May 12, 2009, 9:32:39 PM5/12/09
to capis...@googlegroups.com
Not sure if it's what you're looking for, but have a look at deprec.
It installs and configures everything while integrating with capistrano.

Greg Pederson
Nsight Web Development
www.NsightDevelopment.com

Nick Howard

unread,
May 13, 2009, 5:00:43 PM5/13/09
to capis...@googlegroups.com
You could try using sprinkle and passenger-stack. Sprinkle is a server provisioning tool built on capistrano and passenger-stack is a set of package definitions etc to get a slice/new server ready for a rails install. If you aren't using rails, you could just strip all the unnecessary stuff in /config/install.rb.

http://github.com/crafterm/sprinkle/
http://github.com/benschwarz/passenger-stack/

--
-Nick Howard


jangosteve

unread,
Mar 31, 2012, 2:24:48 PM3/31/12
to capis...@googlegroups.com
If anyone ends up coming across this, I forgot to post again way back when I eventually had figured this out. The solution I ended up coming up with was this: https://gist.github.com/2267333

Though as someone else pointed out, and even better solution now would probably be to use something like Chef for this sort of thing.

Donovan Bray

unread,
Apr 7, 2012, 3:26:32 PM4/7/12
to capis...@googlegroups.com
This is how I solved the problem with capistrano

https://github.com/donnoman/cap-recipes/blob/master/lib/cap_recipes/tasks/mysql/install.rb#L37

In your example you don't describe how apt_quiet_install is defined.

> --
> * You received this message because you are subscribed to the Google Groups
> "Capistrano" group.
> * To post to this group, send email to capis...@googlegroups.com
> * To unsubscribe from this group, send email to
> capistrano+...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/capistrano?hl=en

Reply all
Reply to author
Forward
0 new messages