ReleaseEngineering/How To/Setup a buildbot master: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:


* Create a virtual environment for your master
* Create a virtual environment for your master
  <pre>
<pre>
  virtualenv --distribute --no-site-packages -p /tools/python-2.6.5/bin/python /builds/buildbot/mymaster
virtualenv --distribute --no-site-packages -p /tools/python-2.6.5/bin/python /builds/buildbot/mymaster
  </pre>
</pre>


* Install required packages
* Install required packages
    <pre>
<pre>
    pip install simplejson
pip install simplejson
    pip install mysql-python
pip install mysql-python
    pip install Twisted==10.1.0
pip install Twisted==10.1.0
    pip install sqlalchemy
pip install sqlalchemy
    pip install argparse
pip install argparse
    pip install pycrypto
pip install pycrypto
    pip install pyasn1
pip install pyasn1
    pip install mysql-python
pip install mysql-python
    pip install pyopenssl==0.10
pip install pyopenssl==0.10
    pip install http://hg.mozilla.org/users/clegnitto_mozilla.com/mozillapulse/archive/tip.tar.bz2
pip install http://hg.mozilla.org/users/clegnitto_mozilla.com/mozillapulse/archive/tip.tar.bz2
    hg clone http://hg.mozilla.org/build/buildbot
hg clone http://hg.mozilla.org/build/buildbot
    (cd buildbot/master; $PYTHON setup.py develop install)
(cd buildbot/master; $PYTHON setup.py develop install)
    (cd buildbot/slave; $PYTHON setup.py develop install)
(cd buildbot/slave; $PYTHON setup.py develop install)
    hg clone -b production-0.8 http://hg.mozilla.org/build/buildbotcustom
hg clone -b production-0.8 http://hg.mozilla.org/build/buildbotcustom
    hg clone -b production http://hg.mozilla.org/build/buildbot-configs
hg clone -b production http://hg.mozilla.org/build/buildbot-configs
    hg clone http://hg.mozilla.org/build/tools
hg clone http://hg.mozilla.org/build/tools
    </pre>
</pre>


* Add Makefile
* Add Makefile
    <pre>
<pre>
    PWD=$(shell pwd)
PWD=$(shell pwd)
    BUILDBOT=$(PWD)/bin/buildbot
BUILDBOT=$(PWD)/bin/buildbot
    HG=/tools/python-2.6.5/bin/hg
HG=/tools/python-2.6.5/bin/hg
    export PYTHONDONTWRITEBYTECODE=1
export PYTHONDONTWRITEBYTECODE=1
    export PYTHONPATH=/builds/buildbot/mymaster/tools/lib/python
export PYTHONPATH=/builds/buildbot/mymaster/tools/lib/python


    start:
start:
            cd master && $(BUILDBOT) start $$PWD
        cd master && $(BUILDBOT) start $$PWD
    stop:
stop:
            cd master && $(BUILDBOT) stop $$PWD
        cd master && $(BUILDBOT) stop $$PWD
    restart:
restart:
            cd master && $(BUILDBOT) restart $$PWD
        cd master && $(BUILDBOT) restart $$PWD
    reconfig:
reconfig:
            cd master && $(BUILDBOT) reconfig $$PWD
        cd master && $(BUILDBOT) reconfig $$PWD
    checkconfig:
checkconfig:
            cd master && $(BUILDBOT) checkconfig
        cd master && $(BUILDBOT) checkconfig
    update:
update:
            (cd buildbotcustom && $(HG) pull && $(HG) update -C)
        (cd buildbotcustom && $(HG) pull && $(HG) update -C)
            (cd buildbot-configs && $(HG) pull && $(HG) update -C)
        (cd buildbot-configs && $(HG) pull && $(HG) update -C)
            (cd tools && $(HG) pull && $(HG) update -C)
        (cd tools && $(HG) pull && $(HG) update -C)
    version:
version:
            $(BUILDBOT) --version
        $(BUILDBOT) --version
</pre>


* Setup master
* Setup master
    <pre>
<pre>
    mkdir master
mkdir master
    cd master
cd master
    ln -s ../buildbot-configs/config.py .
ln -s ../buildbot-configs/config.py .
    ln -s ../buildbot-configs/production_config.py localconfig.py
ln -s ../buildbot-configs/production_config.py localconfig.py
    etc. --catlee too tired to fill this in right now. add symlinks and run make checkconfig until it works!
etc. --catlee too tired to fill this in right now. add symlinks and run make checkconfig until it works!
</pre>
 
* Setup cron jobs
<pre>
# In /home/cltbld/.mymaster_update_from_files.conf
[DEFAULT]
database = mysql://buildbot:password@tm-b01-master01.mozilla.org/buildbot
master = http://fqdn:8011
name = My master!
 
# In /etc/cron.d/mymaster
MAILTO=release@mozilla.com
 
@hourly cltbld (source /home/cltbld/.bash_profile && /builds/buildbot/mymaster/bin/python tools/buildfarm/maintenance/watch_twistd_log.py -t .mymaster-last-time.txt -n mymaster -f cltbld@`hostname --fqdn` -e release@mozilla.com /builds/buildbot/mymaster/master)
 
15 * * * * cltbld lockfile -60 -r 3 $HOME/lockfile.mymaster_cleanup && (source /home/cltbld/.bash_profile && hg -R tools pull -u && nice -n 19 /builds/buildbot/mymaster/bin/python tools/buildfarm/maintenance/master_cleanup.py -t4 /builds/buildbot/mymaster/master ; rm -f $HOME/lockfile.mymaster_cleanup) >> cleanup.log 2>&1
 
*/10 * * * * cltbld lockfile -60 -r 3 $HOME/lockfile.bbdb 2>/dev/null && (source /home/cltbld/.bash_profile && cd /builds/buildbot/mymaster/master; time nice /builds/buildbot/mymaster/bin/python /builds/buildbot/mymaster/buildbotcustom/bin/update_from_files.py -c /home/cltbld/.mymaster_update_from_files.conf . ; rm -f $HOME/lockfile.bbdb ) >> update.log 2>&1
</pre>
 
* Update production-masters.json in tools if appropriate

Revision as of 05:43, 8 March 2011

These instructions are probably incomplete, but should serve as a good starting point for setting up a new buildbot master. If you find something missing or inaccurate, please update!

  • Create a new directory for your master, e.g. /builds/buildbot/mymaster
  • Create a virtual environment for your master
virtualenv --distribute --no-site-packages -p /tools/python-2.6.5/bin/python /builds/buildbot/mymaster
  • Install required packages
pip install simplejson
pip install mysql-python
pip install Twisted==10.1.0
pip install sqlalchemy
pip install argparse
pip install pycrypto
pip install pyasn1
pip install mysql-python
pip install pyopenssl==0.10
pip install http://hg.mozilla.org/users/clegnitto_mozilla.com/mozillapulse/archive/tip.tar.bz2
hg clone http://hg.mozilla.org/build/buildbot
(cd buildbot/master; $PYTHON setup.py develop install)
(cd buildbot/slave; $PYTHON setup.py develop install)
hg clone -b production-0.8 http://hg.mozilla.org/build/buildbotcustom
hg clone -b production http://hg.mozilla.org/build/buildbot-configs
hg clone http://hg.mozilla.org/build/tools
  • Add Makefile
PWD=$(shell pwd)
BUILDBOT=$(PWD)/bin/buildbot
HG=/tools/python-2.6.5/bin/hg
export PYTHONDONTWRITEBYTECODE=1
export PYTHONPATH=/builds/buildbot/mymaster/tools/lib/python

start:
        cd master && $(BUILDBOT) start $$PWD
stop:
        cd master && $(BUILDBOT) stop $$PWD
restart:
        cd master && $(BUILDBOT) restart $$PWD
reconfig:
        cd master && $(BUILDBOT) reconfig $$PWD
checkconfig:
        cd master && $(BUILDBOT) checkconfig
update:
        (cd buildbotcustom && $(HG) pull && $(HG) update -C)
        (cd buildbot-configs && $(HG) pull && $(HG) update -C)
        (cd tools && $(HG) pull && $(HG) update -C)
version:
        $(BUILDBOT) --version
  • Setup master
mkdir master
cd master
ln -s ../buildbot-configs/config.py .
ln -s ../buildbot-configs/production_config.py localconfig.py
etc. --catlee too tired to fill this in right now. add symlinks and run make checkconfig until it works!
  • Setup cron jobs
# In /home/cltbld/.mymaster_update_from_files.conf
[DEFAULT]
database = mysql://buildbot:password@tm-b01-master01.mozilla.org/buildbot
master = http://fqdn:8011
name = My master!

# In /etc/cron.d/mymaster
MAILTO=release@mozilla.com

@hourly	cltbld	(source /home/cltbld/.bash_profile && /builds/buildbot/mymaster/bin/python tools/buildfarm/maintenance/watch_twistd_log.py -t .mymaster-last-time.txt -n mymaster -f cltbld@`hostname --fqdn` -e release@mozilla.com /builds/buildbot/mymaster/master)

15 * * * * cltbld lockfile -60 -r 3 $HOME/lockfile.mymaster_cleanup && (source /home/cltbld/.bash_profile && hg -R tools pull -u && nice -n 19 /builds/buildbot/mymaster/bin/python tools/buildfarm/maintenance/master_cleanup.py -t4 /builds/buildbot/mymaster/master ; rm -f $HOME/lockfile.mymaster_cleanup) >> cleanup.log 2>&1

*/10 * * * *	cltbld lockfile -60 -r 3 $HOME/lockfile.bbdb 2>/dev/null && (source /home/cltbld/.bash_profile && cd /builds/buildbot/mymaster/master; time nice /builds/buildbot/mymaster/bin/python /builds/buildbot/mymaster/buildbotcustom/bin/update_from_files.py -c /home/cltbld/.mymaster_update_from_files.conf . ; rm -f $HOME/lockfile.bbdb ) >> update.log 2>&1
  • Update production-masters.json in tools if appropriate