Installing a ruby application and data into /opt/<myapp>


#1

And lo, the client came from afar and said, “Thou shalt make me a web
application,” and mod_ruby and PageTemplate came to my rescue. And lo,
he then said, “Thou shalt interface it with mysql,” and ruby-mysql did
steppeth up mightily to the task.

But then, said he: "And now, thou shalt maketh an installer to checketh
for required versions of installed packages, and thou shalt maketh it
install into /opt/thineapp, with subdirectories of cgi-bin, sql,
rbsource, data, templates, and all else as thine wish.

And, having said, he left, leaving me with a blank stare as I didst ply
the ruby application archive and the mighty rubyforge, looking for a
prior example, an application installer, anything to assuage the client.

I’m about to just give in and make a ./configure --prefix=/opt/myapp ;
make ; make install script for this, but wanted to ask if there’s any
ruby installers out there that could do this. setup.rb has served me so
well in the past.

In particular, I need these features:

  • Check for the needed versions of Ruby, ruby-mysql, etc.

  • Do a straight cp into /opt, or a configurable directory, and edit some
    ruby files to replace a PREFIX with.

And optionally:

  • Run some configuring scripts to set up the database, to edit the
    config.rb for the application (sql passwords, etc), and the like.

Has anyone written such an installer before?

As for what this is: It’s a kind of web-based forum intended for medical
hospitals, complete with web pages, sample data, etc. It wouldn’t really
fit anywhere else, and putting it into /usr/bin, /usr/share, etc would
be a bit of a stretch.

Thanks!

  • Greg

#2

On Thu, 16 Feb 2006, Greg M. wrote:

And, having said, he left, leaving me with a blank stare as I didst ply the

  • Check for the needed versions of Ruby, ruby-mysql, etc.
    if it were me, i’d simply install the right version of each into /opt.
    that
    was the client would break your app by doing something like

gem install mysql # oops, upgrade breaks everything

so

ruby :

   export LD_LIBRARY_PATH=/opt/lib
   export LD_RUN_PATH=/opt/lib
   export PATH=/opt/bin

   ./configure --prefix=/opt && make && make install

gem :

   /opt/bin/ruby setup.rb

mysql :

 /opt/bin/gem install mysql
  • Do a straight cp into /opt, or a configurable directory, and edit some ruby
    files to replace a PREFIX with.

i’d consider using yaml here so you don’t have to ‘edit’ them but can
easily
generate them.

And optionally:

  • Run some configuring scripts to set up the database, to edit the config.rb
    for the application (sql passwords, etc), and the like.

same here.

Has anyone written such an installer before?

similar but simpler

http://codeforpeople.com/lib/ruby/rq/rq-all-2.3.1/install.sh

if it did this again i’d just install ruby using /bin/sh and then do the
rest
in ruby - not sure why i did the whole thing this way.

cheers.

-a