OBS 2.5 All-in-One Server

From Tizen Wiki
Jump to: navigation, search


Add zypper repositories

Refer to the "OBS 2.5 Zypper Repositories" page.



Install All-in-One Server

Make HOME directory for OBS (if necessary)

Refer to the "Make a HOME directory for OBS" section in the "Install All-in-One Server" chapter in the "OBS 2.4 All-in-One Server" page.


Make repository directory

Refer to the "Make repository directory" section in the "Install All-in-One Server" chapter in the "OBS 2.4 All-in-One Server" page.


Install MySQL (MariaDB)

Refer to the "Install MySQL (MariaDB)" section in the "Install All-in-One Server" chapter in the "OBS 2.4 All-in-One Server" page.


Install Apache2

Refer to the "Install Apache2" section in the "Install All-in-One Server" chapter in the "OBS 2.4 All-in-One Server" page.


Install PHP5

Refer to the "Install PHP5" section in the "Install All-in-One Server" chapter in the "OBS 2.4 All-in-One Server" page.


Install BUILD packages

# zypper remove -u build build-mkbaselibs build-mkdrpms build-initvm-x86_64 build-initvm-i586
# zypper install build-20140424-1.1 build-mkbaselibs-20140424-1.1 build-mkdrpms-20140424-1.1
# zypper install build-initvm-x86_64-20140424-1.1 build-initvm-i586-20131112-7.1
(# zypper install build-initvm-x86_64 build-initvm-i586)
The latest build package (build-20150115-4.1.noarch) from "http://download.opensuse.org/update/13.1" makes ARM build in OBS very slow.


Fix build script bugs

# vi /usr/lib/build/qemu-reg

······
#:aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-binfmt:P
:aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-arm64-binfmt:P
······

This is because duplicated definitions for "aarch64" makes ARM build in OBS impossible.


# vi /usr/lib/build/build-pkg-rpm

······
pkg_finalize_rpm() {
    if test -n "${CUMULATED_LIST[*]}" ; then
        echo "now installing cumulated packages"
        ADDITIONAL_PARAMS=
        for ((num=0; num<=cumulate; num++)) ; do
······

This bug in the "Cumulation" functionality makes ARM build in OBS impossible.


Install OBS packages

Refer to the "Install OBS packages" section in the "Install All-in-One Server" chapter in the "OBS 2.4 All-in-One Server" page.


Install additional packages for dependencies

# zypper install sqlite3 perl perl-Net-SSLeay perl-GD perl-BSSolv perl-Socket-MsgHdr ruby rubygem-rails rubygem-delayed_job rubygem-exception_notification rubygem-nokogiri rubygem-sqlite3 rubygem-daemons rubygem-erubis rubygem-ci_reporter rubygem-rdoc rubygem-json rubygem-xmlhash
† Refer to https://github.com/openSUSE/open-build-service/blob/2.5/INSTALL


Configure OBS services

Refer to the "Configure OBS services" section in the "Install All-in-One Server" chapter in the "OBS 2.4 All-in-One Server" page.


Generate configuration.xml file

# vi /srv/obs/configuration.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <description>Tizen OBS</description>
  <title>Open Build Service</title>
  <schedulers>
    <arch>armv7l</arch>
    <arch>i586</arch>
    <arch>x86_64</arch>
  </schedulers>
</configuration>


Modify OBS account

# vi /etc/passwd

······
obsrun:x:482:481:User for build service backend:/usr/lib/obs:/bin/false/bin/bash
······

† This is for OBS shell scripts to be executed by the OBS account.


Set owner of OBS HOME directory (if necessary)

Refer to the "Set owner of OBS HOME directory" section in the "Install All-in-One Server" chapter in the "OBS 2.4 All-in-One Server" page.


Modify BSConfig.pm file

# vi /usr/lib/obs/server/BSConfig.pm

#our $service_maxchild = 20;
our $service_maxchild = 20;
······
#our $repodownload = "http://$hostname/repositories";
our $repodownload = "http://$hostname:82";
······


Create OBS database

# mysql -u root -p

/* Create empty databases */
mysql> create database api_production;
/* Create new account obs with password obspassword */
mysql> create user 'obs'@'%' identified by 'obspassword';
mysql> create user 'obs'@'localhost' identified by 'obspassword';
/* Configure permissions */
mysql> GRANT all privileges ON api_production.* TO 'obs'@'%', 'obs'@'localhost';
mysql> FLUSH PRIVILEGES;
/* Exit MySQL */
mysql> exit


Configure API database.yml file

# vi /srv/www/obs/api/config/database.yml

······
production:
  adapter: mysql2
  database: api_production
  username: rootobs    ## The user name in the step of "Create OBS database"
  password: opensuseobspassword    ## The password in the step of "Create OBS database"
  encoding: utf8
······


Populate API production database

# cd /srv/www/obs/api
# RAILS_ENV="production" rake db:setup
# RAILS_ENV="production" rake writeconfiguration


Configure API options.yml file (like as follows)

# vi /srv/www/obs/api/config/options.yml

······
#use_xforward: true
use_xforward: true

······
#frontend_port: 443
frontend_port: 80    ## If HTTP must be used for OBS API service instead of HTTPS, the port number for API must be 80.
#frontend_protocol: https
frontend_protocol: http
······


Configure Apache2

    Edit /etc/sysconfig/apache2 file

# vi /etc/sysconfig/apache2

······
APACHE_MODULES="······ passenger rewrite proxy proxy_http xforward headers socache_shmcb"
······
APACHE_SERVER_FLAGS="SSL"    ## Enable SSL if it is necessary.
······


    Generate SSL certificate (only if HTTPS is used)

Refer to the "Generate SSL certificate ..." subsection in the "Configure Apache2" section in the "Install All-in-One Server" chapter in the "OBS 2.4 All-in-One Server" page.


    Edit httpd.conf file

Refer to the "Edit httpd.conf file" subsection in the "Configure Apache2" section in the "Install All-in-One Server" chapter in the "OBS 2.4 All-in-One Server" page.


Configure virtual hosts for OBS

# vi /etc/apache2/vhosts.d/obs.conf

Listen 80
Listen 443
Listen 82
······

······
## Comment out or remove this block.
#<VirtualHost *:80>
#    ······
#</VirtualHost>

······
## Comment out or remove this block.
#<VirtualHost *:82>
#    ······
#</VirtualHost>

······
## Comment out this block if HTTPS is NOT used.
#<VirtualHost *:443>
#    ······
#</VirtualHost>

# OBS WEBUI & API without SSL
<VirtualHost *:80>
    ServerName api

    DocumentRoot "/srv/www/obs/api/public"
    ErrorLog /srv/www/obs/api/log/apache_error_log
    TransferLog /srv/www/obs/api/log/apache_access_log

    PassengerMinInstances 2
    PassengerPreStart http://api

    <Directory /srv/www/obs/api/public>
        AllowOverride all
        Options -MultiViews
        XForward on
        Allow from all
    </Directory>
</VirtualHost>

# Build Results
<VirtualHost *:82>
    ServerName rep

    # The resulting repositories
    DocumentRoot "/srv/obs/repos"

    <Directory /srv>
        Options FollowSymLinks
    </Directory>

    <Directory /srv/obs/repos>
        Options Indexes FollowSymLinks
        Allow from all
    </Directory>
</VirtualHost>


Change owner/group of API directories

# chown -R wwwrun:www /srv/www/obs/api


Set up firewall

    Add TCP ports for OBS server

YaST --> Security and Users --> Firewall --> Allowed Services --> Advanced... --> TCP Ports

5152 5252 5352 80 82 443

"443" port should be enabled only if it is used.


Register OBS server services

# systemctl enable mysql
# chkconfig --add obsrepserver obssrcserver obsservice obsscheduler obsdispatcher obspublisher
# systemctl enable apache2
# chkconfig --add obsapidelayed memcached



Reboot OBS Server

  • Reboot OBS server



Install Workers

Refer to the "Install Workers" chapter in the "OBS 2.4 All-in-One Server" page.