Archive:Build Service Installation CentOS
Please refer to this article's discussion page for more information.
CentOS
Introduction
We are currently trying to install the Build Service on CentOS 4.2 using the Fedora Core 6 RPMs. This document does briefly describe how to setup an openSUSE Build Service (OBS) with the rpm packages from the openSUSE project. By default, all service run on the same system, but they can get distributed to increase reliability and do load balancing.
Building OBS RPMs
At the time of writing, the build of the obs-server package fails for the Fedora Core 6 platform. If you want to build the obs-server RPMs yourself, you download all the code of the openSUSE:tools project to /usr/src/redhat/SOURCES. Place your obs-server.spec file in /usr/src/redhat/SPECS.
The commonly used macros %insserv_prereq and %fillup_prereq are not supported on the FC6 platform, so I just comment out these lines.
Use the following spec file.
Name: obs-server Requires: perl-Socket-MsgHdr perl-XML-Parser perl-Compress-Zlib createrepo #PreReq: %fillup_prereq %insserv_prereq License: GPL Group: Productivity/Networking/Web/Utilities Autoreqprov: on Version: 0.1.1 Release: 0 Url: http://en.opensuse.org/Build_Service Summary: The openSUSE Build Service -- Server Component # svn export https://forgesvn1.novell.com/svn/opensuse/trunk/buildservice Source: %{name}-%{version}.tar.bz2 Source1: obsworker Source3: BSConfig.pm Source4: obsrepserver Source5: obssrcserver Source6: obsscheduler Source7: obs.conf Source8: cleanurl-v5.lua Source9: rails.include Source10: README.SETUP Source11: sysconfig.obs-worker Source12: sysconfig.obs-server Patch: HOTFIX.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArchitectures: noarch %description Authors: -------- The openSUSE Team <opensuse-buildservice@opensuse.org> %package -n obs-worker Requires: perl-Socket-MsgHdr perl-TimeDate screen curl perl-XML-Parser per l-Compress-Zlib #PreReq: %fillup_prereq %insserv_prereq Group: Productivity/Networking/Web/Utilities Summary: The openSUSE Build Service -- Build Host Component %description -n obs-worker %package -n obs-api #PreReq: %fillup_prereq %insserv_prereq Requires: lighttpd rubygem-fcgi mysql rubygem-mysql rubygem-rake rubygem-r ails Group: Productivity/Networking/Web/Utilities Summary: The openSUSE Build Service -- The Frontend part %description -n obs-api %prep %setup -q -n buildservice/src/ #%patch0 cp %SOURCE10 . %build echo empty build section %install # # Install all web and frontend parts. # for i in common frontend webclient; do mkdir -p $RPM_BUILD_ROOT/srv/www/obs/ cp -a $i $RPM_BUILD_ROOT/srv/www/obs/$i done # configure lighttpd web service mkdir -p $RPM_BUILD_ROOT/etc/lighttpd/vhosts.d/ install -m 0644 %SOURCE7 $RPM_BUILD_ROOT/etc/lighttpd/vhosts.d/ install -m 0644 %SOURCE9 $RPM_BUILD_ROOT/etc/lighttpd/vhosts.d/rails.inc install -m 0644 %SOURCE8 $RPM_BUILD_ROOT/etc/lighttpd/ rm $RPM_BUILD_ROOT/srv/www/obs/frontend/README_LOGIN rm $RPM_BUILD_ROOT/srv/www/obs/frontend/files/specfiletemplate # fix path for i in $RPM_BUILD_ROOT/srv/www/obs/*/config/environment.rb; do sed "s,/srv/www/opensuse/common/current/lib,/srv/www/obs/common/lib," \ "$i" > "$i"_ && mv "$i"_ "$i" done #set default api on localhost for the webclient sed 's,FRONTEND_HOST.*,FRONTEND_HOST = "127.0.42.2",' \ $RPM_BUILD_ROOT/srv/www/obs/webclient/config/environments/development.rb > tmp -file \ && mv tmp-file "$RPM_BUILD_ROOT/srv/www/obs/webclient/config/environments/deve lopment.rb" sed 's,FRONTEND_PORT.*,FRONTEND_PORT = 80,' \ $RPM_BUILD_ROOT/srv/www/obs/webclient/config/environments/development.rb > tmp -file \ && mv tmp-file "$RPM_BUILD_ROOT/srv/www/obs/webclient/config/environments/deve lopment.rb" mkdir -p $RPM_BUILD_ROOT/srv/www/docs/api/ cp -a ../docs/api/frontend $RPM_BUILD_ROOT/srv/www/docs/api/ # # Install all backend parts. # cd backend/ install -d -m 755 $RPM_BUILD_ROOT/usr/lib/obs/server/ install -d -m 755 $RPM_BUILD_ROOT/usr/sbin/ install -d -m 755 $RPM_BUILD_ROOT/etc/init.d/ install -d -m 755 $RPM_BUILD_ROOT/srv/obs/projects install -d -m 755 $RPM_BUILD_ROOT/srv/obs/log install -d -m 755 $RPM_BUILD_ROOT/srv/obs/run # install executables and code cp -a * $RPM_BUILD_ROOT/usr/lib/obs/server/ # install runlevel scripts install -m 0755 %SOURCE1 %SOURCE4 %SOURCE5 %SOURCE6 \ $RPM_BUILD_ROOT/etc/init.d/ for i in obssrcserver obsrepserver obsscheduler obsworker ; do ln -sf /etc/init.d/$i $RPM_BUILD_ROOT/usr/sbin/rc$i done install -m 0644 %SOURCE3 $RPM_BUILD_ROOT/usr/lib/obs/server/ # Ship latest version of build to be always in sync. do not use the symlink. rm -rf $RPM_BUILD_ROOT/usr/lib/obs/server/build cp -a ../build $RPM_BUILD_ROOT/usr/lib/obs/server/build # install fillups FILLUP_DIR=$RPM_BUILD_ROOT/var/adm/fillup-templates mkdir -p $FILLUP_DIR cp -a %SOURCE11 %SOURCE12 $FILLUP_DIR/ %pre /usr/sbin/groupadd -r obsrun 2> /dev/null || : /usr/sbin/useradd -r -o -s /bin/false -c "User for build service backend" -d /us r/lib/obs -g obsrun obsrun 2> /dev/null || : %post -n obs-server %{fillup_and_insserv -n obs-server} %post -n obs-worker %{fillup_and_insserv -n obs-worker} %post -n obs-api touch /srv/www/obs/{webclient,frontend}/log/development.log chown lighttpd:lighttpd /srv/www/obs/{webclient,frontend}/log/development.log %files %defattr(-,root,root) %dir /usr/lib/obs /etc/init.d/obssrcserver /etc/init.d/obsrepserver /etc/init.d/obsscheduler /usr/sbin/rcobssrcserver /usr/sbin/rcobsrepserver /usr/sbin/rcobsscheduler /usr/lib/obs/server %attr(-,obsrun,obsrun) /srv/obs /var/adm/fillup-templates/sysconfig.obs-server %files -n obs-worker %defattr(-,root,root) /var/adm/fillup-templates/sysconfig.obs-worker /etc/init.d/obsworker /usr/sbin/rcobsworker %files -n obs-api %defattr(-,root,root) %doc README.SETUP %dir /srv/www/obs /srv/www/docs /srv/www/obs/common /srv/www/obs/frontend/app /srv/www/obs/frontend/Changelog /srv/www/obs/frontend/components /srv/www/obs/frontend/db /srv/www/obs/frontend/doc /srv/www/obs/frontend/lib /srv/www/obs/frontend/public /srv/www/obs/frontend/Rakefile /srv/www/obs/frontend/README /srv/www/obs/frontend/script /srv/www/obs/frontend/test /srv/www/obs/frontend/vendor /srv/www/obs/webclient/app /srv/www/obs/webclient/Changelog /srv/www/obs/webclient/components /srv/www/obs/webclient/db /srv/www/obs/webclient/doc /srv/www/obs/webclient/lib /srv/www/obs/webclient/public /srv/www/obs/webclient/Rakefile /srv/www/obs/webclient/README /srv/www/obs/webclient/script /srv/www/obs/webclient/test /srv/www/obs/webclient/vendor %config(noreplace) /srv/www/obs/frontend/config %config(noreplace) /srv/www/obs/webclient/config %attr(-,lighttpd,lighttpd) /srv/www/obs/frontend/log %attr(-,lighttpd,lighttpd) /srv/www/obs/frontend/tmp %attr(-,lighttpd,lighttpd) /srv/www/obs/webclient/log %attr(-,lighttpd,lighttpd) /srv/www/obs/webclient/tmp %config(noreplace) /etc/lighttpd/vhosts.d/obs.conf %config /etc/lighttpd/cleanurl-v5.lua %config /etc/lighttpd/vhosts.d/rails.inc
Build your RPMs with:
rpmbuild -ba /usr/src/redhat/SPECS/obs-server.spec
Note: I also made a few other changes to the spec file. See below for more information!
Install: backend
The backend hosts all sources, build packages and calculates the jobs. You need to install the "obs-server" package for this. Also add the user obsrun because it is needed to install the obs-server package
# useradd obsrun # rpm -ivh obs-server-0.1-17.1.i386.rpm
Note: obs-server-0.1-17.1.i386.rpm has following dependencies
- perl-Socket-MsgHdr => downloaded from the official CentosDistro
- perl => downloaded from the official CentosDistro
- perl-Compress-Zlib => downloaded from the official CentosDistro
- perl-XML-Parser => downloaded from the official CentosDistro
- perl-libwww-perl => downloaded from the official CentosDistro
- perl-HTML-Parser => downloaded from the official CentOSDistro
- perl-URI => downloaded from the official CentOSDistro
- perl-HTML-Tagset => downloaded from the official CentOSDistro
- perl-Compress-Zlib => downloaded from Centos Extra Packages
Configure: backend
WARNING: The following starts services which are accessable from the outside. Do not do this on a system connected to an untrusted network or be sure to block the ports via a firewall.
# rcobsrepserver start # rcobssrcserver start # rcobsscheduler start
The data get hosted inside of /srv/obs directory by default.
The problem is that these scripts use /etc/rc.status, which is typical openSUSE and not on a CentOS system. So I had to rewrite the scripts
rcobsrepserver
#! /bin/sh # Copyright (c) 1995-1998 SuSE GmbH Nuernberg, Germany. # # Author: adrian@suse.de # # /etc/init.d/bsworker # and its symbolic link # /usr/sbin/rcbsworker # ### BEGIN INIT INFO # Provides: obsreserver # Required-Start: $time $syslog # Required-Stop: # Default-Start: 3 5 # Default-Stop: 0 1 2 4 6 # Description: openSUSE build service repository server ### END INIT INFO . /etc/rc.d/init.d/functions function rc_reset () { _rc_status=0 _rc_status_all=0 rc_check return 0 } function rc_check () { _rc_status_ret=$? test $_rc_status_ret -eq 0 || _rc_status=$_rc_status_ret test $_rc_status -eq 0 || _rc_status_all=$_rc_status return $_rc_check_ret } function rc_exit () { exit $_rc_status_all } # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} obsdir=/usr/lib/obs/server/ rc_reset case "$1" in start) cd "$obsdir" # FIXME: not nice, this should receive a proper daemon handling, # including real logging, pid file and startproc ./bs_repserver >& /srv/obs/log/rep_server.log & status bs_repserver ;; stop) killall bs_repserver status bs_repserver ;; restart) echo -n "NOT IMPLEMENTED " ## If first returns OK call the second, if first or ## second command fails, set echo return value. #$0 stop && $0 start status bs_repserver ;; try-restart) $0 status if test $? = 0; then $0 restart else rc_reset # Not running is not a failure. fi # Remember status and be quiet status bs_repserver ;; reload) ;; status) echo "NOT IMPLEMENTED" #rc_status -v ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|reload}" exit 1 ;; esac rc_exit
rcobssrcserver
#! /bin/sh # Copyright (c) 1995-1998 SuSE GmbH Nuernberg, Germany. # # Author: adrian@suse.de # # /etc/init.d/bsworker # and its symbolic link # /usr/sbin/rcbsworker # ### BEGIN INIT INFO # Provides: obssrcserver # Required-Start: $time $syslog # Required-Stop: # Default-Start: 3 5 # Default-Stop: 0 1 2 4 6 # Description: openSUSE build service source repository server ### END INIT INFO . /etc/rc.d/init.d/functions function rc_reset () { _rc_status=0 _rc_status_all=0 rc_check return 0 } function rc_check () { _rc_status_ret=$? test $_rc_status_ret -eq 0 || _rc_status=$_rc_status_ret test $_rc_status -eq 0 || _rc_status_all=$_rc_status return $_rc_check_ret } function rc_exit () { exit $_rc_status_all } # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} obsdir=/usr/lib/obs/server/ rc_reset case "$1" in start) cd "$obsdir" # FIXME: not nice, this should receive a proper daemon handling, # including real logging, pid file and startproc ./bs_srcserver >& /srv/obs/log/src_server.log & status bs_srcserver ;; stop) killall bs_srcserver status bs_srcserver ;; restart) echo -n "NOT IMPLEMENTED " ## If first returns OK call the second, if first or ## second command fails, set echo return value. #$0 stop && $0 start status bs_srcserver ;; try-restart) $0 status if test $? = 0; then $0 restart else rc_reset # Not running is not a failure. fi # Remember status and be quiet status bs_srcserver ;; reload) ;; status) echo "NOT IMPLEMENTED" #rc_status -v ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|reload}" exit 1 ;; esac rc_exit
rcobsscheduler
#! /bin/sh # Copyright (c) 1995-1998 SuSE GmbH Nuernberg, Germany. # # Author: adrian@suse.de # # /etc/init.d/bsworker # and its symbolic link # /usr/sbin/rcbsworker # ### BEGIN INIT INFO # Provides: obsscheduler # Required-Start: $time $syslog obssrcserver obsrepserver # Required-Stop: # Default-Start: 3 5 # Default-Stop: 0 1 2 4 6 # Description: openSUSE build service scheduler ### END INIT INFO . /etc/rc.d/init.d/functions function rc_reset () { _rc_status=0 _rc_status_all=0 rc_check return 0 } function rc_check () { _rc_status_ret=$? test $_rc_status_ret -eq 0 || _rc_status=$_rc_status_ret test $_rc_status -eq 0 || _rc_status_all=$_rc_status return $_rc_check_ret } function rc_exit () { exit $_rc_status_all } # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} obsdir=/usr/lib/obs/server/ rc_reset case "$1" in start) cd "$obsdir" # FIXME: not nice, this should receive a proper daemon handling, # including real logging, pid file and startproc ./bs_sched >& /srv/obs/log/scheduler.log & status bs_sched ;; stop) killall bs_sched status bs_sched ;; restart) echo -n "NOT IMPLEMENTED " ## If first returns OK call the second, if first or ## second command fails, set echo return value. #$0 stop && $0 start status bs_sched ;; try-restart) $0 status if test $? = 0; then $0 restart else rc_reset # Not running is not a failure. fi # Remember status and be quiet status bs_sched ;; reload) ;; status) echo "NOT IMPLEMENTED" #rc_status -v ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|reload}" exit 1 ;; esac rc_exit
Install: worker
The workers ask the backend for open build jobs and do the build. You need to install the "obs-worker" package for this.
# rpm -ivh obs-worker-0.1-17.1.i386.rpm
Note: obs-worker-0.1-17.1.i386.rpm has following dependencies
- curl => downloaded from the official CentOSDistro
- libidn => downloaded from the official CentOSDistro
- perl-Compress-Zlib => downloaded from the official CentOSDistro
- perl-XML-Parser => downloaded from the official CentOSDistro
- perl-libwww-perl => downloaded from the official CentOSDistro
- perl-URI => downloaded from the official CentOSDistro
- perl-TimeDate => downloaded from http://rpmforge.net/user/packages/perl-TimeDate/
- utempter => downloaded from the official CentOSDistro
- screen => downloaded from the official CentOSDistro
- perl-TimeDate
Configure: worker
A worker can be started on the localhost by calling
# rcobsworker start
Install: frontend
You need to install the "obs-api" package for this and a mysql server on this or a remote host.
# rpm -ivh obs-api-0.1-17.1.i386
Note: obs-api-0.1-17.1.i386 has following dependencies
- ruby-1.8.5-1.el4.centos
=> downloaded from the official CentOSDistro
- lighttpd
=> this was quit a pain in the ass. We downloaded the lighttpd from source: lighttpd-1.4.13.tar.gz and created an rpm using this script => also, make sure you have the pcre and pcre-devel package on the machine where you build lighttpd! Otherwise, you'll not be able to start your lighttpd!
#!/bin/bash rm -rf build mkdir -p build/RPMS build/SRPMS build/SOURCES build/BUILD build/tmp build/SPECS rpmbuild -ta lighttpd-1.4.13.tar.gz --buildroot=`pwd`/build/tmp --define "_topdir `pwd`/build" --with lua
You should have these files:
$ find . . ./vhosts.d ./vhosts.d/obs.conf ./vhosts.d/rails.inc ./vhosts.d/CVS ./vhosts.d/CVS/Root ./vhosts.d/CVS/Repository ./vhosts.d/CVS/Entries ./cleanurl-v5.lua ./conf-available ./conf-available/CVS ./conf-available/CVS/Root ./conf-available/CVS/Repository ./conf-available/CVS/Entries ./conf-available/10-auth.conf ./conf-available/10-cgi.conf ./conf-available/10-cml.conf ./conf-available/10-fastcgi.conf ./conf-available/10-proxy.conf ./conf-available/10-simple-vhost.conf ./conf-available/10-ssi.conf ./conf-available/10-ssl.conf ./conf-available/10-trigger-b4-dl.conf ./conf-available/10-userdir.conf ./conf-available/README ./conf-enabled ./conf-enabled/CVS ./conf-enabled/CVS/Root ./conf-enabled/CVS/Repository ./conf-enabled/CVS/Entries ./conf-enabled/.dummy ./modules.conf ./conf.d ./conf.d/access_log.conf ./conf.d/auth.conf ./conf.d/cgi.conf ./conf.d/compress.conf ./conf.d/debug.conf ./conf.d/dirlisting.conf ./conf.d/evhost.conf ./conf.d/expire.conf ./conf.d/fastcgi.conf ./conf.d/mime.conf ./conf.d/mod.template ./conf.d/proxy.conf ./conf.d/scgi.conf ./conf.d/secdownload.conf ./conf.d/simplev_host.conf ./conf.d/ssi.conf ./conf.d/status.conf ./conf.d/userdir.conf ./conf.d/CVS ./conf.d/CVS/Root ./conf.d/CVS/Repository ./conf.d/CVS/Entries ./lighttpd.conf.opensuse ./CVS ./CVS/Root ./CVS/Repository ./CVS/Entries ./lighttpd.conf
Also, make sure you place those scripts files in /usr/sbin/
- lighty-disable-mod
#!/usr/bin/perl -w # # Copyright (c) 2006 Krzysztof Krzyzaniak # # Contains changes from: # - Tobias Gruetzmacher <tobias@portfolio16.de> # # You may distribute under the terms of either the GNU General Public # License[1] or the Artistic License[2]. # # [1] http://www.gnu.org/licenses/gpl.html # [2] http://www.perl.com/pub/a/language/misc/Artistic.html # use strict; use Term::ReadLine; use File::Basename; use File::Glob ':glob'; use File::stat; #--- some initializations my $confdir = "/etc/lighttpd/"; my %available = (); my %enabled = (); my @todo = (); my %moduledeps = (); my $enabling = 1; #--- first check if we enabling or disabling if ($0 =~ /disable-mod$/) { #--- disabling mode $enabling = 0; } #--- list of available modules my @files = bsd_glob($confdir.'conf-available/*.conf'); print "Available modules: "; foreach my $file (@files) { if (basename($file) =~ /^\d+\-([\w\-]+)\.conf$/) { $available{$1} = $file; print qq{$1 }; } } print "\n"; #--- list of already enabled modules @files = bsd_glob($confdir.'conf-enabled/*.conf'); print "Already enabled modules: "; foreach my $file (@files) { if (basename($file) =~ /^\d+\-([\w\-]+)\.conf$/) { $enabled{$1} = $file; print qq{$1 }; } } print "\n"; unless (defined($ARGV[0])) { my $prompt = $enabling ? 'Enable module: ' : 'Disable module: '; my $term = new Term::ReadLine $prompt; my $OUT = $term->OUT || \*STDOUT; my $var = lc($term->readline($prompt)); @todo = split(/ /, $var); } else { @todo = @ARGV; } #--- activate (link) or deactivate (remove) module foreach my $do (@todo) { my $target = sprintf("%s/conf-enabled/%s", $confdir,basename($available{$do})); if ($enabling) { print qq{Enabling $do: }; my $st = stat($target); unless ( -f $target ) { if (symlink($available{$do}, $target)) { print "ok\n"; } else { print "failure: $!\n"; } } else { print "already enabled\n"; } #--- check dependencies for my $module (@{$moduledeps{$do}}) { unless ( -f $target && -l $target ) { print qq{Module $do depends on module $module which is not activated.\n}; } } } else { print qq{Disabling $do\n}; unlink($target); } } print "Run /etc/init.d/lighttpd force-reload to enable changes\n";
- lighty-enable-mod
#!/usr/bin/perl -w # # Copyright (c) 2006 Krzysztof Krzyzaniak # # Contains changes from: # - Tobias Gruetzmacher <tobias@portfolio16.de> # # You may distribute under the terms of either the GNU General Public # License[1] or the Artistic License[2]. # # [1] http://www.gnu.org/licenses/gpl.html # [2] http://www.perl.com/pub/a/language/misc/Artistic.html # use strict; use Term::ReadLine; use File::Basename; use File::Glob ':glob'; use File::stat; #--- some initializations my $confdir = "/etc/lighttpd/"; my %available = (); my %enabled = (); my @todo = (); my %moduledeps = (); my $enabling = 1; #--- first check if we enabling or disabling if ($0 =~ /disable-mod$/) { #--- disabling mode $enabling = 0; } #--- list of available modules my @files = bsd_glob($confdir.'conf-available/*.conf'); print "Available modules: "; foreach my $file (@files) { if (basename($file) =~ /^\d+\-([\w\-]+)\.conf$/) { $available{$1} = $file; print qq{$1 }; } } print "\n"; #--- list of already enabled modules @files = bsd_glob($confdir.'conf-enabled/*.conf'); print "Already enabled modules: "; foreach my $file (@files) { if (basename($file) =~ /^\d+\-([\w\-]+)\.conf$/) { $enabled{$1} = $file; print qq{$1 }; } } print "\n"; unless (defined($ARGV[0])) { my $prompt = $enabling ? 'Enable module: ' : 'Disable module: '; my $term = new Term::ReadLine $prompt; my $OUT = $term->OUT || \*STDOUT; my $var = lc($term->readline($prompt)); @todo = split(/ /, $var); } else { @todo = @ARGV; } #--- activate (link) or deactivate (remove) module foreach my $do (@todo) { my $target = sprintf("%s/conf-enabled/%s", $confdir,basename($available{$do})); if ($enabling) { print qq{Enabling $do: }; my $st = stat($target); unless ( -f $target ) { if (symlink($available{$do}, $target)) { print "ok\n"; } else { print "failure: $!\n"; } } else { print "already enabled\n"; } #--- check dependencies for my $module (@{$moduledeps{$do}}) { unless ( -f $target && -l $target ) { print qq{Module $do depends on module $module which is not activated.\n}; } } } else { print qq{Disabling $do\n}; unlink($target); } } print "Run /etc/init.d/lighttpd force-reload to enable changes\n";
- lua >= 5.1
=> downloaded from http://rpmfind.net//linux/RPM/fedora/extras/5/i386/lua-5.1-6.fc5.i386.html => rebuilded it on the CentOS machine and installed the RPM
- MySQL-server-5.1.14-0.glibc23
=> downloaded from the official CentOSDistro
- rubygem-fcgi
=> gem 2 rpm using a script
- rubygem-mysql
=> gem 2 rpm using a script
- rubygem-rails
=> gem 2 rpm using a script
- rubygem-rake
=> gem 2 rpm using a script
Now, you see lighttpd_mod_magnet is missing as a dependency. We didn't have this RPM and we didn't want to install it as the mod_magnet.c and mod_magnet.so were in our source code. So we had to rebuild the obs-server package using this spec file. We wiped out the mod_magnet dependency. We also had to change some of the gem packages' names. (See top of the page for spec file.)
Setup & configure: MySQL database
- start your MySQL database
/etc/init.d/mysql start
- create the root account
/usr/bin/mysqladmin -u root password 'your-password'
- configure your used mysql user in under the "development:" section.
/srv/www/obs/frontend/config/database.yml /srv/www/obs/webclient/config/database.yml
- create the database
mysql -u root -p mysql> create database frontend_development; mysql> quit
- move to the frontend folder
cd /srv/www/obs/frontend/
- fill in the database
rake migrate
Setup & configure: frontend and webclient
Afterwards the configuration of the frontend (and webclient) rails interface is needed. A configuration for accessing via http://127.0.42.1 and http://127.0.42.2 gets automatically installed into /etc/lighttpd/vhosts.d/obs.conf
We are using a different lighttpd. Our config files look like this:
- /etc/lighttpd/lighttpd.conf
############ Options you really have to take care of #################### ## modules to load # mod_access, mod_accesslog and mod_alias are loaded by default # all other module should only be loaded if neccesary # - saves some time # - saves memory server.modules = ( "mod_access", "mod_alias", "mod_accesslog", "mod_rewrite", "mod_redirect", "mod_magnet", "mod_fastcgi", # "mod_status", # "mod_evhost", "mod_compress", # "mod_usertrack", # "mod_rrdtool", # "mod_webdav", # "mod_expire", # "mod_flv_streaming", # "mod_evasive", "mod_setenv" ) ## a static document-root, for virtual-hosting take look at the ## server.virtual-* options server.document-root = "/srv/www/docs/api" ## where to send error-messages to server.errorlog = "/var/log/lighttpd/error.log" ## files to check for if .../ is requested index-file.names = ( "index.php", "index.html", "index.htm", "default.htm" ) ## Use the "Content-Type" extended attribute to obtain mime type if possible # mimetype.use-xattr = "enable" #### accesslog module accesslog.filename = "/var/log/lighttpd/access.log" ## deny access the file-extensions # # ~ is for backupfiles from vi, emacs, joe, ... # .inc is often used for code includes which should in general not be part # of the document-root url.access-deny = ( "~", ".inc" ) ######### Options that are good to be but not neccesary to be changed ####### ## bind to port (default: 80) #server.port = 81 ## bind to localhost only (default: all interfaces) #server.bind = "localhost" ## error-handler for status 404 #server.error-handler-404 = "/error-handler.html" #server.error-handler-404 = "/error-handler.php" server.error-handler-404 = "/dispatch.fcgi" ## to help the rc.scripts server.pid-file = "/var/run/lighttpd.pid" ## ## Format: <errorfile-prefix><status>.html ## -> ..../status-404.html for 'File not found' #server.errorfile-prefix = "/var/www/" ## virtual directory listings dir-listing.encoding = "utf-8" server.dir-listing = "disable" ## send unhandled HTTP-header headers to error-log #debug.dump-unknown-headers = "enable" ### only root can use these options # # chroot() to directory (default: no chroot() ) #server.chroot = "/" ## change uid to <uid> (default: don't care) #server.username = "www-data" server.username = "lighttpd" ## change uid to <uid> (default: don't care) #server.groupname = "www-data" server.groupname = "lighttpd" #### compress module #compress.cache-dir = "/var/tmp/lighttpd/cache/compress/" #compress.filetype = ("text/plain", "text/html") #### status module # status.status-url = "/server-status" # status.config-url = "/server-config" #### url handling modules (rewrite, redirect, access) # url.rewrite = ( "^/$" => "/server-status" ) # url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" ) # url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" ) # # define a pattern for the host url finding # %% => % sign # %0 => domain name + tld # %1 => tld # %2 => domain name without tld # %3 => subdomain 1 name # %4 => subdomain 2 name # # evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/" #### expire module # expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes") #### rrdtool # rrdtool.binary = "/usr/bin/rrdtool" # rrdtool.db-name = "/var/www/lighttpd.rrd" ## this is a hack alias.url = ("___invalid___" => "___invalid___") #### handle Debian Policy Manual, Section 11.5. urls #### and by default allow them only from localhost $HTTP["host"] == "localhost" { dir-listing.activate = "disable" } #### variable usage: ## variable name without "." is auto prefixed by "var." and becomes "var.bar" #bar = 1 #var.mystring = "foo" ## integer add #bar += 1 ## string concat, with integer cast as string, result: "www.foo1.com" #server.name = "www." + mystring + var.bar + ".com" ## array merge #index-file.names = (foo + ".php") + index-file.names #index-file.names += (foo + ".php") #### external configuration files ## mimetype mapping include_shell "/usr/share/lighttpd/create-mime.assign.pl" ## load enabled configuration files, ## read /etc/lighttpd/conf-available/README first include_shell "/usr/share/lighttpd/include-conf-enabled.pl" ## files needed for OBS setenv.add-environment = ("LUA_INIT" => "@/usr/share/lua/5.1/compat-5.1.lua") var.conf_dir = "/etc/lighttpd" var.log_root = "/srv/obs/log" include "vhosts.d/obs.conf"
Change /srv/www/obs/webclient/config/environments/production_slave.rb
If you changed the hostnames/ips away from 10.0.42.x, you need to configure also /srv/www/obs/webclient/config/environments/production_slave.rb (2 entries).
Restart lighttpd
Afterwards you can start the OBS web frontends via
rclighttpd start # use "insserv lighttpd" for permanent start
If lighttpd does not start you need to enable/disable IPv6
Setup: initial distributions
( I've never reached to this part :p )
Access
By default you can access the api via using any browser with the URL
http://127.0.42.2
The web interface is accessable via
http://127.0.42.1
The default user is "Admin" with the password "opensuse".
FIXES
Not using 127.0.42.2 for frontend
If you use, like me, another ip for your frontend, your BS will not run correctly. Therefore, go to: /srv/www/obs/webclient/config/environments/development.rb and change the FRONTEND_HOST to your other IP
Credits
This document has been created by Jochen Hebbrecht. I made this tutorial because I'm doing a project for school (stage) and we are planning to use the openSUSE buildtool. Don't blame me for the mistakes I made, but try to correct them. I know this tutorial is not quiet complete, I tried to note everything I did, but as you know, nobody does that perfectly. If you have further questions, you can always Jabber me through jochenhebbrecht [AT] gmail [DOT] com (or contact me on irc.freenode.net => nick: jochus)
Packages
I (martin-juhl) have implemented these instructions (along with some of my own) into a repository.. Everything should be working See here for repository and here for source.. Installation Instructions:
First of all, remember to setup either DNS or /etc/hosts to match hostname of the server...
RHEL6:
wget -O /etc/yum.repos.d/RHEL-CBS.repo http://download.opensuse.org/repositories/home:/martin-juhl:/branches:/openSUSE:/Tools/RHEL_6/home:martin-juhl:branches:openSUSE:Tools.repo
or
CentOS6:
wget -O /etc/yum.repos.d/CentOS-CBS.repo http://download.opensuse.org/repositories/home:/martin-juhl:/branches:/openSUSE:/Tools/CentOS_6/home:martin-juhl:branches:openSUSE:Tools.repo
yum install obs-web-httpd obs-server obs-worker obs-api mysql-server
chkconfig iptables off chkconfig obsworker on chkconfig mysqld on service mysqld start
Edit: /etc/sysconfig/obs-server
Set: OBS_API_AUTOSETUP=”no” to: OBS_API_AUTOSETUP=”yes”
and: OBS_VM_TYPE=”auto” to: OBS_VM_TYPE=”none”
/etc/init.d/obsapisetup start
mv /etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf.bak
chkconfig httpd on chkconfig obssignd on
reboot
Now go the servers IP-adresse/Hostname for the web-interface…
Login: Admin
Pass: opensuse