So I ran through a server setup on ec2, and have a text file of all the commands I used to get the server to where I wanted it. I have a few questions now :) I am running Ubuntu 10.10, and this is for a rails application. 1. I need to install Ruby Enterprise edition, which I had to do the following to get running: sudo apt-get install mysql-server libmysqlclient15-dev mkdir -p downloads && cd downloads/ wget http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.03.tar.gz tar xzvf ruby-enterprise-1.8.7-2011.03.tar.gz sudo apt-get install libreadline5-dev sudo apt-get install libssl-dev sudo ./ruby-enterprise-1.8.7-2011.03/installer --auto /opt/ruby/ echo "export PATH=/opt/ruby/bin:$PATH" >> ~/.profile && . ~/.profile The examples I have seen with puppet so far are mostly dealing with creating a node/class, and setting a particular service to be started etc. How would I deal with this situation where I need: i) setup apt-get dependancies ii) download a file iii) make the lib from source iiii) modify my path -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 07/17/2011 12:45 PM, S Ahmed wrote:> So I ran through a server setup on ec2, and have a text file of all > the commands I used to get the server to where I wanted it.step 1: turn your list of commands into an idempotent script #! /bin/sh site=http://rubyenterpriseedition.googlecode.com/files name=ruby-enterprise-1.8.7-2011.03 archive=$name.tar.gz prepath="/opt/ruby/bin" downloads=/root/downloads wanted=" mysql-server libmysqlclient15-dev libreadline5-dev libssl-dev " apt-get install $wanted mkdir -p $downloads [ ! -d $downloads/$archive ] && cd $downloads && wget $site/$archive [ ! -d $downloads/$name ] && cd $downloads && tar xzf $archive [ ! -f /opt/ruby/bin/ruby ] && ./$name/installer --auto /opt/ruby/ grep -q "$prepath" ~/.profile || echo "export PATH=$prepath:$PATH" >> ~/.profile exit 0 step 2: puppetize it class ruby_from_src { $site ="http://rubyenterpriseedition.googlecode.com/files" $name ="ruby-enterprise-1.8.7-2011.03" $archive ="${name}.tar.gz" $prepath ="/opt/ruby/bin" $downloads ="/root/downloads" $wanted = [ "mysql-server", "libmysqlclient15-dev", "libreadline5-dev", "libssl-dev", ] package { $wanted: ensure => installed, } -> file { $downloads: ensure => directory, } -> exec { "ruby from source download": command => "wget ${site}/${archive}", cwd => $downoads, creates => "${dir}/${archive}", } -> exec { "ruby from source extract": command => "tar xzf ${archive}", cwd => $downloads, creates => "${name}", } -> exec { "ruby from source install": command => "./${name}/installer --auto /opt/ruby/", cwd => $downloads, creates => "/opt/ruby/bin/ruby", } file { "ruby from source PATH": path => "/etc/profile.d/puppet_ruby_from_src.sh", content => "PATH=${prepath}:\$PATH", mode => 644, } } step 3: run it and fix the bugs :-) I have not tested it, so there might be bugs. But that''s the general idea. There''s room for improvement though: - parameterise the class so you can pass in the version, site, etc - move some of the dependencies to other classes mysql stuff belongs in a mysql_dev class libssl-dev probably belongs in a network_dev class *_dev classes should include a build_tools class But, the biggest improvement would be to make your own package and install that instead of fiddling around with this low level stuff in the manifests. -- vagn -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Scott Smith
2011-Jul-17 19:04 UTC
Re: [Puppet Users] Installing from source, not a package
Step 1: don''t do that Step 2: make a package On Jul 17, 2011 9:46 AM, "S Ahmed" <sahmed1020@gmail.com> wrote:> So I ran through a server setup on ec2, and have a text file of all the > commands I used to get the server to where I wanted it. > > I have a few questions now :) > > I am running Ubuntu 10.10, and this is for a rails application. > > 1. I need to install Ruby Enterprise edition, which I had to do the > following to get running: > > sudo apt-get install mysql-server libmysqlclient15-dev > > > mkdir -p downloads && cd downloads/ > > > wget >http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.03.tar.gz> > > tar xzvf ruby-enterprise-1.8.7-2011.03.tar.gz > > sudo apt-get install libreadline5-dev > > sudo apt-get install libssl-dev > > sudo ./ruby-enterprise-1.8.7-2011.03/installer --auto /opt/ruby/ > > > echo "export PATH=/opt/ruby/bin:$PATH" >> ~/.profile && . ~/.profile > > > > > The examples I have seen with puppet so far are mostly dealing withcreating> a node/class, and setting a particular service to be started etc. > > How would I deal with this situation where I need: > > > i) setup apt-get dependancies > > ii) download a file > > iii) make the lib from source > > iiii) modify my path > > -- > You received this message because you are subscribed to the Google Groups"Puppet Users" group.> To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email topuppet-users+unsubscribe@googlegroups.com.> For more options, visit this group athttp://groups.google.com/group/puppet-users?hl=en.>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
wow, what can I say, thanks for guidance! The last bit of what you said I don''t understand: "But, the biggest improvement would be to make your own package and install that instead of fiddling around with this low level stuff in the manifests." On Sun, Jul 17, 2011 at 2:33 PM, vagn scott <vagnscott@gmail.com> wrote:> On 07/17/2011 12:45 PM, S Ahmed wrote: > >> So I ran through a server setup on ec2, and have a text file of all the >> commands I used to get the server to where I wanted it. >> > > step 1: turn your list of commands into an idempotent script > > #! /bin/sh > > site=http://**rubyenterpriseedition.**googlecode.com/files<http://rubyenterpriseedition.googlecode.com/files> > name=ruby-enterprise-1.8.7-**2011.03 > archive=$name.tar.gz > prepath="/opt/ruby/bin" > downloads=/root/downloads > wanted=" > mysql-server > libmysqlclient15-dev > libreadline5-dev > libssl-dev > " > > apt-get install $wanted > > mkdir -p $downloads > > [ ! -d $downloads/$archive ] && cd $downloads && wget $site/$archive > [ ! -d $downloads/$name ] && cd $downloads && tar xzf $archive > > [ ! -f /opt/ruby/bin/ruby ] && ./$name/installer --auto /opt/ruby/ > grep -q "$prepath" ~/.profile || echo "export PATH=$prepath:$PATH" >> > ~/.profile > > exit 0 > > > step 2: puppetize it > > class ruby_from_src { > $site ="http://**rubyenterpriseedition.** > googlecode.com/files <http://rubyenterpriseedition.googlecode.com/files>" > $name ="ruby-enterprise-1.8.7-2011.**03" > $archive ="${name}.tar.gz" > $prepath ="/opt/ruby/bin" > $downloads ="/root/downloads" > > $wanted = [ > "mysql-server", > "libmysqlclient15-dev", > "libreadline5-dev", > "libssl-dev", > ] > > package { $wanted: > ensure => installed, > } -> > > file { $downloads: > ensure => directory, > } -> > > exec { "ruby from source download": > command => "wget ${site}/${archive}", > cwd => $downoads, > creates => "${dir}/${archive}", > } -> > > exec { "ruby from source extract": > command => "tar xzf ${archive}", > cwd => $downloads, > creates => "${name}", > } -> > > exec { "ruby from source install": > command => "./${name}/installer --auto /opt/ruby/", > cwd => $downloads, > creates => "/opt/ruby/bin/ruby", > } > > file { "ruby from source PATH": > path => "/etc/profile.d/puppet_ruby_**from_src.sh", > content => "PATH=${prepath}:\$PATH", > mode => 644, > } > > } > > step 3: run it and fix the bugs :-) > > I have not tested it, so there might be bugs. But that''s the general idea. > There''s room for improvement though: > > - parameterise the class so you can pass in the version, site, etc > - move some of the dependencies to other classes > mysql stuff belongs in a mysql_dev class > libssl-dev probably belongs in a network_dev class > *_dev classes should include a build_tools class > > But, the biggest improvement would be to make your own package and install > that > instead of fiddling around with this low level stuff in the manifests. > > -- > vagn > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@** > googlegroups.com <puppet-users%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at http://groups.google.com/** > group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en> > . > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Scott Smith
2011-Jul-17 19:07 UTC
Re: [Puppet Users] Installing from source, not a package
You don''t know what a package is? On Jul 17, 2011 12:05 PM, "S Ahmed" <sahmed1020@gmail.com> wrote:> wow, what can I say, thanks for guidance! > > The last bit of what you said I don''t understand: > > "But, the biggest improvement would be to make your own package andinstall> that > instead of fiddling around with this low level stuff in the manifests." > > > > On Sun, Jul 17, 2011 at 2:33 PM, vagn scott <vagnscott@gmail.com> wrote: > >> On 07/17/2011 12:45 PM, S Ahmed wrote: >> >>> So I ran through a server setup on ec2, and have a text file of all the >>> commands I used to get the server to where I wanted it. >>> >> >> step 1: turn your list of commands into an idempotent script >> >> #! /bin/sh >> >> site=http://**rubyenterpriseedition.**googlecode.com/files<http://rubyenterpriseedition.googlecode.com/files>>> name=ruby-enterprise-1.8.7-**2011.03 >> archive=$name.tar.gz >> prepath="/opt/ruby/bin" >> downloads=/root/downloads >> wanted=" >> mysql-server >> libmysqlclient15-dev >> libreadline5-dev >> libssl-dev >> " >> >> apt-get install $wanted >> >> mkdir -p $downloads >> >> [ ! -d $downloads/$archive ] && cd $downloads && wget $site/$archive >> [ ! -d $downloads/$name ] && cd $downloads && tar xzf $archive >> >> [ ! -f /opt/ruby/bin/ruby ] && ./$name/installer --auto /opt/ruby/ >> grep -q "$prepath" ~/.profile || echo "export PATH=$prepath:$PATH" >> >> ~/.profile >> >> exit 0 >> >> >> step 2: puppetize it >> >> class ruby_from_src { >> $site ="http://**rubyenterpriseedition.** >> googlecode.com/files <http://rubyenterpriseedition.googlecode.com/files>" >> $name ="ruby-enterprise-1.8.7-2011.**03" >> $archive ="${name}.tar.gz" >> $prepath ="/opt/ruby/bin" >> $downloads ="/root/downloads" >> >> $wanted = [ >> "mysql-server", >> "libmysqlclient15-dev", >> "libreadline5-dev", >> "libssl-dev", >> ] >> >> package { $wanted: >> ensure => installed, >> } -> >> >> file { $downloads: >> ensure => directory, >> } -> >> >> exec { "ruby from source download": >> command => "wget ${site}/${archive}", >> cwd => $downoads, >> creates => "${dir}/${archive}", >> } -> >> >> exec { "ruby from source extract": >> command => "tar xzf ${archive}", >> cwd => $downloads, >> creates => "${name}", >> } -> >> >> exec { "ruby from source install": >> command => "./${name}/installer --auto /opt/ruby/", >> cwd => $downloads, >> creates => "/opt/ruby/bin/ruby", >> } >> >> file { "ruby from source PATH": >> path => "/etc/profile.d/puppet_ruby_**from_src.sh", >> content => "PATH=${prepath}:\$PATH", >> mode => 644, >> } >> >> } >> >> step 3: run it and fix the bugs :-) >> >> I have not tested it, so there might be bugs. But that''s the generalidea.>> There''s room for improvement though: >> >> - parameterise the class so you can pass in the version, site, etc >> - move some of the dependencies to other classes >> mysql stuff belongs in a mysql_dev class >> libssl-dev probably belongs in a network_dev class >> *_dev classes should include a build_tools class >> >> But, the biggest improvement would be to make your own package andinstall>> that >> instead of fiddling around with this low level stuff in the manifests. >> >> -- >> vagn >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To post to this group, send email to puppet-users@googlegroups.com. >> To unsubscribe from this group, send email to puppet-users+unsubscribe@** >> googlegroups.com <puppet-users%2Bunsubscribe@googlegroups.com>. >> For more options, visit this group at http://groups.google.com/** >> group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>>> . >> >> > > -- > You received this message because you are subscribed to the Google Groups"Puppet Users" group.> To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email topuppet-users+unsubscribe@googlegroups.com.> For more options, visit this group athttp://groups.google.com/group/puppet-users?hl=en.>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 07/17/2011 03:05 PM, S Ahmed wrote:> > The last bit of what you said I don''t understand: > > "But, the biggest improvement would be to make your own package and > install that > instead of fiddling around with this low level stuff in the manifests." >My apologies. I should remember to use standard English. The biggest improvement to the code I just demonstrated is: Do something else. I showed that code so I could answer your question directly, and because I think it demonstrates some useful techniques. However, there is a better way to solve the problem. If you make a debian package, then you only need to install the package. class my_ruby { package { "my_ruby": ensure => installed, } } All the dependencies and environment setup would be done by the package''s install scripts. Also, you would not leave the download directory and all the other useless files on the server. If you wanted to remove or upgrade the package all the details would be handled by the package system. It takes time to learn to make packages, so you can use the code I showed you as a temporary solution. But, for the future, you should learn to make packages. -- vagn -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
I do, I was confused as to whether that was puppet talk or debian/ubuntu related. On Sun, Jul 17, 2011 at 3:07 PM, Scott Smith <scott@ohlol.net> wrote:> You don''t know what a package is? > On Jul 17, 2011 12:05 PM, "S Ahmed" <sahmed1020@gmail.com> wrote: > > wow, what can I say, thanks for guidance! > > > > The last bit of what you said I don''t understand: > > > > "But, the biggest improvement would be to make your own package and > install > > that > > instead of fiddling around with this low level stuff in the manifests." > > > > > > > > On Sun, Jul 17, 2011 at 2:33 PM, vagn scott <vagnscott@gmail.com> wrote: > > > >> On 07/17/2011 12:45 PM, S Ahmed wrote: > >> > >>> So I ran through a server setup on ec2, and have a text file of all the > >>> commands I used to get the server to where I wanted it. > >>> > >> > >> step 1: turn your list of commands into an idempotent script > >> > >> #! /bin/sh > >> > >> site=http://**rubyenterpriseedition.**googlecode.com/files< > http://rubyenterpriseedition.googlecode.com/files> > > >> name=ruby-enterprise-1.8.7-**2011.03 > >> archive=$name.tar.gz > >> prepath="/opt/ruby/bin" > >> downloads=/root/downloads > >> wanted=" > >> mysql-server > >> libmysqlclient15-dev > >> libreadline5-dev > >> libssl-dev > >> " > >> > >> apt-get install $wanted > >> > >> mkdir -p $downloads > >> > >> [ ! -d $downloads/$archive ] && cd $downloads && wget $site/$archive > >> [ ! -d $downloads/$name ] && cd $downloads && tar xzf $archive > >> > >> [ ! -f /opt/ruby/bin/ruby ] && ./$name/installer --auto /opt/ruby/ > >> grep -q "$prepath" ~/.profile || echo "export PATH=$prepath:$PATH" >> > >> ~/.profile > >> > >> exit 0 > >> > >> > >> step 2: puppetize it > >> > >> class ruby_from_src { > >> $site ="http://**rubyenterpriseedition.** > >> googlecode.com/files <http://rubyenterpriseedition.googlecode.com/files > >" > > >> $name ="ruby-enterprise-1.8.7-2011.**03" > >> $archive ="${name}.tar.gz" > >> $prepath ="/opt/ruby/bin" > >> $downloads ="/root/downloads" > >> > >> $wanted = [ > >> "mysql-server", > >> "libmysqlclient15-dev", > >> "libreadline5-dev", > >> "libssl-dev", > >> ] > >> > >> package { $wanted: > >> ensure => installed, > >> } -> > >> > >> file { $downloads: > >> ensure => directory, > >> } -> > >> > >> exec { "ruby from source download": > >> command => "wget ${site}/${archive}", > >> cwd => $downoads, > >> creates => "${dir}/${archive}", > >> } -> > >> > >> exec { "ruby from source extract": > >> command => "tar xzf ${archive}", > >> cwd => $downloads, > >> creates => "${name}", > >> } -> > >> > >> exec { "ruby from source install": > >> command => "./${name}/installer --auto /opt/ruby/", > >> cwd => $downloads, > >> creates => "/opt/ruby/bin/ruby", > >> } > >> > >> file { "ruby from source PATH": > >> path => "/etc/profile.d/puppet_ruby_**from_src.sh", > >> content => "PATH=${prepath}:\$PATH", > >> mode => 644, > >> } > >> > >> } > >> > >> step 3: run it and fix the bugs :-) > >> > >> I have not tested it, so there might be bugs. But that''s the general > idea. > >> There''s room for improvement though: > >> > >> - parameterise the class so you can pass in the version, site, etc > >> - move some of the dependencies to other classes > >> mysql stuff belongs in a mysql_dev class > >> libssl-dev probably belongs in a network_dev class > >> *_dev classes should include a build_tools class > >> > >> But, the biggest improvement would be to make your own package and > install > >> that > >> instead of fiddling around with this low level stuff in the manifests. > >> > >> -- > >> vagn > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Puppet Users" group. > >> To post to this group, send email to puppet-users@googlegroups.com. > >> To unsubscribe from this group, send email to puppet-users+unsubscribe@ > ** > >> googlegroups.com <puppet-users%2Bunsubscribe@googlegroups.com>. > > >> For more options, visit this group at http://groups.google.com/** > >> group/puppet-users?hl=en< > http://groups.google.com/group/puppet-users?hl=en> > > >> . > >> > >> > > > > -- > > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > > To post to this group, send email to puppet-users@googlegroups.com. > > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Is suppose I should mention that, if you have an idempotent script like the one mentioned, you can use it directly. Again, not tested, so may bugs. class ruby_from_src { file { "/root/ruby_from_src.sh": content => template("ruby_from_src/ruby_from_src.sh"), before => Exec[ "/root/ruby_from_src.sh" ], } exec { "/root/ruby_from_src.sh": creates => "/opt/ruby/bin/ruby", } } -- vagn -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
use fpm <http://www.semicomplete.com/blog/geekery/fpm.html>. You still should know how to make a package, but fpm will make one from a gem, or sources. If you are i a rush, that is. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/SR3xfd9HjWkJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
John Shoemaker
2012-Apr-12 23:14 UTC
Re: [Puppet Users] Installing from source, not a package
Is it possible to install packages to specific directories for most providers? (for example, passing --instdir to dpkg -i). On Monday, July 18, 2011 4:18:18 PM UTC-7, chiggsy wrote:> > use fpm <http://www.semicomplete.com/blog/geekery/fpm.html>. You still > should know how to make a package, but fpm will make one from a gem, or > sources. If you are i a rush, that is.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/qSe563kkMwoJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.