librelist archives

« back to archive

fabric script to install mongrel from scratch on debian stable

fabric script to install mongrel from scratch on debian stable

From:
Christopher Mahan
Date:
2010-08-29 @ 19:17
All,

This fabfile installs python 2.6.6 and mongrel2 on a stock or typical
vps-image Debian Stable (tested on 64 bit, should work as-in on 32bit)

It goes all the way to "configuring the first time" on the
http://mongrel2.org/wiki?name=GettingStarted page


Any feedback welcome. !


First, the makefile, which I call makefilepatch (in the fabfile
below). It just comments out the test in the makefile

--- oldMakefile 2010-08-29 22:54:01.000000000 +0400
+++ Makefile    2010-08-29 22:50:07.000000000 +0400
@@ -41,7 +41,7 @@
        rm -f run/*

 tests: build/libm2.a tests/config.sqlite ${TESTS}
-       sh ./tests/runtests.sh
+#      sh ./tests/runtests.sh

 tests/config.sqlite: src/config/config.sql src/config/example.sql
src/config/mimetypes.sql
        sqlite3 $@ < src/config/config.sql


_______________________________
Now the fabfile.

It installs python 2.6.6 (debian stable comes with 2.5.2 and mongrel2
needs 2.6 at least)
The second with cd("/root"): is where the mongrel2 and dependencies start.


from fabric.api import *

env.hosts = ['0.0.0.0']  # your server ip ip address goes here
env.user = u'root'
env.password = u'thefancypassword'  # the root password goes here



def zembu():
   with settings(warn_only = True):

       # install python 2.6.6 on target system
       with cd("/root"):
           run("apt-get -y update", pty = True)
           run("apt-get -y install debian-keyring
debian-archive-keyring", pty = True)
           run("apt-get -y update", pty = True)
           run("rm -rf pythontemp", pty = True)
           run("mkdir pythontemp", pty = True)
           # cleanup apache if present
           run("apt-get -y remove --purge apache2*", pty = True)

       with cd("/root/pythontemp"):
           run("apt-get -y install bzip2", pty = True)
           run("apt-get -y install wget", pty = True)
           run("wget
http://python.org/ftp/python/2.6.6/Python-2.6.6.tar.bz2", pty = True)
           run("tar xjvf Python-2.6.6.tar.bz2", pty = True)

       with cd("/root/pythontemp/Python-2.6.6"):
           run("apt-get -y install make", pty = True)
           run("apt-get -y install gcc", pty = True)
           run("apt-get -y install libssl-dev", pty = True)
           run("apt-get -y install libsqlite3-dev", pty = True)
           run("apt-get -y install libbz2-dev", pty = True)
           run("apt-get -y install tk8.4-dev libgdbm-dev libdb-dev
libreadline-dev libncurses-dev", pty = True)
           run("apt-get -y install patch", pty = True)
           run("apt-get -y install checkinstall", pty = True)
           run('./configure', pty = True)
           run("make", pty = True)
           run("checkinstall -y --pkgname=python2.6 --showinstall=no",
pty = True)

       with cd("/root"):
           run("apt-get -y install uuid-dev")
           run("wget
http://www.zeromq.org/local--files/area:download/zeromq-2.0.8.tar.gz",
pty = True)
           run("tar -xzvf zeromq-2.0.8.tar.gz", pty = True)
       with cd("/root/zeromq-2.0.8"):
           run("./configure", pty = True)
           run("make", pty = True)
           run("make install", pty = True)
       # setup distribute
       with cd("/root"):
           run("mkdir distribute", pty=True)
       with cd("/root/distribute"):
           run("wget
http://python-distribute.org/distribute_setup.py", pty = True)
           run("python2.6 distribute_setup.py", pty = True)
       # setup pyzmq
       with cd("/root"):
           run("apt-get -y install sqlite3", pty = True)
           run("apt-get -y install git-core", pty = True)
           run("git clone http://github.com/zeromq/pyzmq.git", pty = True)
       with cd("/root/pyzmq"):
           run("python2.6 setup.py install", pty=True)
       with cd("/root"):
           run("easy_install-2.6 pip", pty=True)
           run("pip install web.py", pty=True)
           run("wget
http://mongrel2.org/static/downloads/mongrel2-1.0beta4.tar.bz2",
pty=True)
           run("tar -xjvf mongrel2-1.0beta4.tar.bz2", pty=True)
       with cd("/root/mongrel2_2010-08-28_073756_f837a14c6a/tests"):
          
 put("makefilepatch","/root/mongrel2_2010-08-28_073756_f837a14c6a/tests")
           run("patch -p0 < makefile", pty = True )
       with cd("/root/mongrel2_2010-08-28_073756_f837a14c6a"):
           run("make clean all install", pty=True)







Chris Mahan
(818) 671-1709
http://christophermahan.com/
chris.mahan@gmail.com
http://twitter.com/chris_mahan

Re: [mongrel2] fabric script to install mongrel from scratch on debian stable

From:
Zed A. Shaw
Date:
2010-08-30 @ 01:11
On Sun, Aug 29, 2010 at 12:17:54PM -0700, Christopher Mahan wrote:
> All,
> First, the makefile, which I call makefilepatch (in the fabfile
> below). It just comments out the test in the makefile

Alright I just fixed this so that the unixy_tests don't bother with
stuff that fails in root.  I'll push out a release tonight with that.

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] fabric script to install mongrel from scratch on debian stable

From:
Christopher Mahan
Date:
2010-08-30 @ 02:26
Thanks!

Christopher Mahan 818.671.1709 christophermahan.com

On Aug 29, 2010 6:11 PM, "Zed A. Shaw" <zedshaw@zedshaw.com> wrote:

On Sun, Aug 29, 2010 at 12:17:54PM -0700, Christopher Mahan wrote:
> All,

> First, the makefile, which I call makefilepatch (in the fabfile
> below). It just comments out the...
Alright I just fixed this so that the unixy_tests don't bother with
stuff that fails in root.  I'll push out a release tonight with that.

--

Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] fabric script to install mongrel from scratch on debian stable

From:
Zed A. Shaw
Date:
2010-08-30 @ 00:03
On Sun, Aug 29, 2010 at 12:17:54PM -0700, Christopher Mahan wrote:
> All,
> 
> This fabfile installs python 2.6.6 and mongrel2 on a stock or typical
> vps-image Debian Stable (tested on 64 bit, should work as-in on 32bit)
> 
> It goes all the way to "configuring the first time" on the
> http://mongrel2.org/wiki?name=GettingStarted page

Cool I'll check this out.

Question: Does fabric still ssh into the machine for *every* run()
rather than just once for the whole session?

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] fabric script to install mongrel from scratch on debian stable

From:
Christopher Mahan
Date:
2010-08-30 @ 00:18
Unless something chnged recently, most likely :(

Christopher Mahan 818.671.1709 christophermahan.com

On Aug 29, 2010 5:03 PM, "Zed A. Shaw" <zedshaw@zedshaw.com> wrote:

On Sun, Aug 29, 2010 at 12:17:54PM -0700, Christopher Mahan wrote:
> All,
>
> This fabfile installs...
Cool I'll check this out.

Question: Does fabric still ssh into the machine for *every* run()
rather than just once for the whole session?

--
Zed A. Shaw
http://zedshaw.com/