Build Service/Build Service Installation Tutorial/openSUSE 10.3

From openSUSE


Installing the Build Service is fairly painless on openSUSE 10.3, if you have internet access:

Contents

YaST Setup

Installation Source Setup

The first thing you want to do is tell YaST where to look for the packages.

  1. Open YaST
  2. Go to the Installation Source module.
  3. Add an http source:
  4. You have to add an additional Installation Source with recent ruby packages in order to get obs working:
  5. It may also be necessary to enable (or, alternatively, add) the oss catalog from opensuse.org

Installation of Open Build Service

Next, you want to install the build service packages:

  1. Go to the Software Management YaST module
  2. Search for obs
  3. Install obs-api, obs-server, and obs-worker (and their dependencies).

Configuration

(The following contents are copied shamelessly from /usr/share/doc/packages/obs-api/README.SETUP in the obs-api package).

By default all service run on the same system, but they can get distributed to increase reliability and do load balancing.

Run the backend

The backend hosts all sources, build packages and calculates the jobs. You need to install the "obs-server" package for this.

Start the Services

Start the following services in this order. 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
# rcobsdispatcher start
# rcobspublisher start

The data get hosted inside of /srv/obs directory by default.

Start the Workers

The workers ask the backend for open build jobs and do the build. You need to install the "obs-worker" package for this.

Local Worker

A worker can be started on the localhost by calling

# rcobsworker start
Multiple Workers on Remote Systems

A worker can be started on other machine in your network (in Internet too, but you should have really fast Internet connection ;-)). You must install package obs-worker on this machine and change few configuration files on both system.

  • necessary changes on machine *main* machine
In file /usr/lib/obs/server/BSConfig.pm you should change variables $srcserver, $reposerver and
array @reposervers. After install there are http://localhost but in this case you should have there
output of hostname -f or IPs. (You should keep port number)
  • necessary changes on worker machine

Install package obs-worker and in file /etc/sysconfig/obs-worker change variable

# OBS_STORAGE_SERVER to main.fqdn:6262

where main.fqdn is output of hostname -f or IP on *main* machine.

example: (assumed 192.168.0.10 is IP of *main* machine)

# OBS_STORAGE_SERVER="192.168.0.10:6262"

Run the Frontend

You need to install the "obs-api" package for this and a mysql server on this or a remote host.

MySQL Setup & Configuration

Initialize fresh Database
  • start the MySQL database
 # rcmysql start    # use "insserv mysql" for permanent start
If you do this for the first time, MySQL will initialize itself and ask to create a root password in the database, like this:
 # /usr/bin/mysqladmin -u root password 'your-password'
  • Create the empty production databases:
     # mysql -u root -p
     mysql> create database frontend_production;
     mysql> create database webclient_production;
     mysql> quit
  • If you use the MySQL database for other services, too, then it's recommended to add a separate MySQL user, e.g.g 'obs', like

this:

     # mysql -u root -p'your-password'
     CREATE USER obs IDENTIFIED BY 'obs-password';
     GRANT all privileges
     ON frontend_production.*
     TO 'obs'@'%', 'obs'@'localhost';
     GRANT all privileges
     ON webclient_production.*
     TO 'obs'@'%', 'obs'@'localhost';
  • Configure your MySQL user and password in the "production_slave:" section of these files:
     # /srv/www/obs/frontend/config/database.yml
     # /srv/www/obs/webclient/config/database.yml
  • populate the database
     # cd /srv/www/obs/frontend/
     # RAILS_ENV="production_slave" rake db:migrate
Update Database Schema

Updaters of build server versions before 0.9 needs to rename their databases from "development" to production. This can be performed by the following steps:

 # mysql -u root -p
   mysql> create database frontend_production;
   mysql> create database webclient_production;
   mysql> quit
 # mysqldump -p frontend_development > DUMP
 # mysql -u root -p frontend_production < DUMP
 # mysqldump -p webclient_development > DUMP
 # mysql -u root -p webclient_production < DUMP

All Updaters needs to update their database schema in any case by running the following commands:

 # cd /srv/www/obs/frontend/
 # RAILS_ENV="production_slave" rake db:migrate


Configure the Frontend and Web Client

After 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

If you need other hostnames, edit that file /etc/lighttpd/vhosts.d/obs.conf:

   $HTTP["host"] =~ "buildserver.my.domain.example.org" {
     ...
   }

To enable these vhosts, make sure to uncomment the following is in the 'custom includes' section at the bottom of /etc/lighttpd/lighttpd.conf:


 ##
 ## custom includes like vhosts.
 ##
 #include "conf.d/config.conf"
 # following line uncommented as per
 # /usr/share/doc/packages/obs-api/README.SETUP
 include_shell "cat vhosts.d/*.conf"

Also, the modules "mod_magnet", "mod_rewrite" and fastcgi need to be enabled by uncommenting the corresponding lines in /etc/lighttpd/modules.conf:

   server.modules = (
     "mod_access",
   #  "mod_alias",
   #  "mod_auth",
   #  "mod_evasive",
   #  "mod_redirect",
     "mod_rewrite",
   #  "mod_setenv",
   #  "mod_usertrack",
   )
   ##
   ## mod_magnet
   ##
   include "conf.d/magnet.conf"
   ##
   ## FastCGI (mod_fastcgi)
   ##
   include "conf.d/fastcgi.conf"


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

The OBS does need some base projects and packages to start the building. You can setup it for example in this way to build for openSUSE 10.3:

  • visit http://127.0.42.1 The default user is "Admin" with the password "opensuse".
  • Create an "openSUSE:10.3" project by starting the browser with the following URL: http://127.0.42.1. Click on "Projects", then (near the bottom of the page) "All projects (including home projects)", and finally "Add a new project"
  • in this project, click on '[Add Repository]' and on the next page on '[Advanced]' (underneath a bunch of distro buttons) in the name field, enter 'standard'
  • A resulting project xml file should have been created at /srv/obs/projects/openSUSE:10.3.xml and looks like this:
<project name="openSUSE:10.3">
  <repository status='disabled' name='standard'>
    <arch>i586</arch>
  </repository>
  <title>the openSUSE 10.3 distribution</title>
  <description></description>
</project>

The status='disabled' will stop any builds inside of this project, but it can be used anyway as a base in other projects.

Afterwards you need to copy the rpms from the base distribution to /srv/obs/build/openSUSE:10.3/standard/i586/:full/ Simply create the directory, if it does not exist. In order to be sure that the directory structure has the proper rights set, execute:

chown -R obsrun.obsrun /srv/obs

Once you copied all rpms from the base distribution's i586 and noarch directory inside /srv/obs/build/openSUSE:10.3/standard/i586/:full/ you need to trigger the reading of the directory of the scheduler. The easiest way to achieve this is to restart it.

Last but not least you need to copy the distribution configuration to define how a base distribution needs to get setup. These configurations for SUSE are part of the build rpm.

# cp /usr/lib/obs/server/build/configs/sl10.3.conf /srv/obs/projects/openSUSE:10.3.conf

You may also want to read Build Service/Tips and Tricks#How is a buildenvironment defined? for a description of the configuration format.

The project is now ready to be used as a base for other projects.

Other distros can be added similarly, which makes the 'distro' buttons given when adding a repository work.

Names of projects to create for other distros:

Linux Distribution Name
SLED/SLES 10 SUSE:SLE-10:SDK
SLES 9 SUSE:SLES-9
Fedora 6 (with Extras) Fedora:Extras6

(I'm sure there's others...)

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".

Updating

When the obs-api package has been updated, it might be required to upgrade the database. Therefore, you should execute

cd /srv/www/obs/frontend/
rake migrate

after updating obs-api.

Command-Line Interface (osc)

In order to use the command line tool for the build service, change your ~/.oscrc to something like this:

[general]

# Downloaded packages are cached here. Must be writable by you.
#packagecachedir = /var/tmp/osbuild-packagecache

# Wrapper to call build as root (sudo, su -, ...)
#su-wrapper = su -c

# rootdir to setup the chroot environment
# can contain %(repo)s and/or %(arch)s for replacement
#build-root = /var/tmp/build-root

# use this API server
# (it needs a section [api.opensuse.org] with the credentials)
#apisrv = api.opensuse.org

# our local build service api:
apisrv = 127.0.42.2

# for local build service, use http (not https)
scheme = http

# local default admin account
[127.0.42.2]
user = Admin
pass = opensuse

# normal build service account
[api.opensuse.org]
user = foo
pass = bar