OBS 2.4 Distributed Servers

From Tizen Wiki
Jump to: navigation, search


Add zypper repositories

Refer to the "OBS 2.4 Zypper Repositories" page.



Install BACKEND Server

BACKEND server = REPO server + SCHEDULER + DISPATCHER + PUBLISHER + WARDEN

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 BACKEND packages

# zypper install obs-server
# zypper install obs-utils


Install BUILD packages

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


Modify OBS account

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


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

my $frontend = undef; # FQDN of the WebUI/API server if it's not $hostname
my $api_host = "xxx.xxx.xxx.xxx";    ## FQDN, IP address, or short hostname of the API (FRONTEND) server
my $rep_host = "yyy.yyy.yyy.yyy";    ## FQDN, IP address, or short hostname of the REPO (BACKEND) server
my $src_host = "zzz.zzz.zzz.zzz";    ## FQDN, IP address, or short hostname of the SRC (STORAGE) server
my $api_ip = quotemeta inet_ntoa(inet_aton($api_host));
my $rep_ip = quotemeta inet_ntoa(inet_aton($rep_host));
my $src_ip = quotemeta inet_ntoa(inet_aton($src_host));

······

our $ipaccess = {
   '127\..*' => 'rw', # only the localhost can write to the backend
   "^$ip" => 'rw', # Permit IP of FQDN
   "^$api_ip" => 'rw', # Permit IP of API server
   "^$rep_ip" => 'rw', # Permit IP of REPO server
   "^$src_ip" => 'rw', # Permit IP of SRC server
   '.*' => 'worker', # build results can be delivered from any client in the network
};

······

#our $obsname = $hostname; # unique identifier for this Build Service instance
our $obsname = $rep_host;

······

#our $srcserver = "http://$hostname:5352";
our $srcserver = "http://$src_host:5352";
#our $reposerver = "http://$hostname:5252";
our $reposerver = "http://$rep_host:5252";
#our $serviceserver = "http://$hostname:5152";
our $serviceserver = "http://$src_host:5152";

······

#our $repodownload = "http://$hostname/repositories";
our $repodownload = "http://$rep_host:82";

······

#our @reposervers = ("http://$hostname:5252");
our @reposervers = ("http://$rep_host:5252");

······

#our $noproxy = "localhost, 127.0.0.1";
## Domains, FQDNs, IP addresses, short hostnames
our $noproxy = ="localhost, 127.0.0.1, pilot.tizen.org, build, frontend, front, fe, api, webui, backend, be, rep, storage, src, db";

······


Install Apache2 for REPO download

    Install Apache2

# zypper install apache2


    Set up server name for apache2 service

# vi /etc/sysconfig/apache2

······
APACHE_SERVERNAME="yyy.yyy.yyy.yyy"    ## FQDN, IP address, or short hostname of the REPO (BACKEND) server
······


Configure Apache2 for REPO download

    Edit httpd.conf file

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


    Edit obs.conf file

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

# 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>


Set up firewall for BACKEND server

    Add TCP ports for BACKEND server

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

5252 82


Start BACKEND services

# systemctl start obsrepserver obsscheduler obsdispatcher obspublisher obswarden apache2


Test BACKEND server installation

Browse to http://yyy.yyy.yyy.yyy:82 with your web browser (yyy.yyy.yyy.yyy = FQDN or IP address of the REPO server)


Register BACKEND services

# chkconfig --add obsrepserver obsscheduler obsdispatcher obspublisher obswarden apache2



Install STORAGE Server

STORAGE server = SOURCE server + SERVICE server + MySQL 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.


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 SOURCE/SERVICE packages

    Install OBS packages

# zypper install obs-server
# zypper install obs-utils
# zypper install obs-source_service obs-service-download_files obs-service-tar_scm


    Install GBS service packages (for only Tizen)

# zypper install obs-service-gbs obs-service-git-buildpackage
# zypper install librpm-tizen


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.


Modify OBS account

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


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.


Create OBS databases

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


Modify BSConfig.pm file

Refer to the "Modify BSConfig.pm file" section in the "Install BACKEND Server" chapter.


Set up firewall for STORAGE server

    Add TCP ports for STORAGE server

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

3306 5152 5352


Start STORAGE services

# systemctl start obssrcserver obsservice


Register STORAGE services

# chkconfig --add mysql obssrcserver obsservice



Install FRONTEND Server

FRONTEND server = WebUI server + API server

Install Apache2 for FE

    Install apache2 package

# zypper install apache2


    Set up server name for apache2 service

# vi /etc/sysconfig/apache2

······
APACHE_SERVERNAME="xxx.xxx.xxx.xxx"    ## FQDN, IP address, or short hostname of the WebUI (FRONTEND) server
······


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 FRONTEND packages

# zypper install obs-api
# zypper install obs-utils
# zypper install perl-GD


Configure {api,webui} database.yml files

    API

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

······
production:
  adapter: mysql2
  database: api_production
  host: zzz.zzz.zzz.zzz    ## The hostname of the MySQL server for OBS
  port: 3306    ## The port number of the MySQL service in the MySQL server
  username: rootobs    ## The user name in the step of "Create OBS databases"
  password: opensuseobspassword    ## The password in the step of "Create OBS databases"
  encoding: utf8
······


    WebUI

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

······
production:
  adapter: mysql2
  database: webui_production
  host: zzz.zzz.zzz.zzz    ## The hostname of the MySQL server for OBS
  port: 3306    ## The port number of the MySQL service in the MySQL server
  username: rootobs    ## The user name in the step of "Create OBS databases"
  password: opensuseobspassword    ## The password in the step of "Create OBS databases"
  encoding: utf8
······


Populate {api,webui}_production databases

Refer to the "Populate {api,webui}_production databases" section in the "Install All-in-One Server" chapter in the "OBS 2.4 All-in-One Server" page.


Configure {api,webui} options.yml files

    API

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

······
#use_xforward: true
use_xforward: true
······
#source_host: localhost
source_host: "zzz.zzz.zzz.zzz"    ## The hostname or the IP address of the SRC server
······
#download_url: http://localhost:82/
download_url: http://yyy.yyy.yyy.yyy:82/    ## The hostname or the IP address of the REPO server
······


    WebUI

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

······
#download_url: http://myhost:82/
download_url: http://yyy.yyy.yyy.yyy:82/    ## The hostname or the IP address of the REPO server
······
#use_xforward: true
use_xforward: true
······
#frontend_host: api.opensuse.org
frontend_host: "xxx.xxx.xxx.xxx"    ## The hostname or the IP address of the API (FRONTEND) server
······
## If the HTTP protocol must be used for OBS API service instead of HTTPS, the port number for API should be 81.
#frontend_port: 443
frontend_port: 81
#frontend_protocol: https
frontend_protocol: http
······


Configure Apache2 for FE

    Edit /etc/sysconfig/apache2 file

Refer to the "Edit /etc/sysconfig/apache2 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.


    Generate SSL certificate (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 Web UI and API

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

Listen 80
Listen 81
Listen 82
Listen 443
Listen 444

······

<VirtualHost *:80>
    # just give an overview about this OBS instance via static web page
    DocumentRoot "/srv/www/obs/overview"

    <Directory /srv/www/obs/overview>
        Options Indexes
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:82>
    # The resulting repositories
    DocumentRoot "/srv/obs/repos"

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

# OBS WEB interface
<VirtualHost *:80>
    ServerName webui

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

    PassengerPreStart http://build

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

# OBS API
<VirtualHost *:81>
    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:81

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


Change owner/group of {api,webui} directories

# chown -R wwwrun:www /srv/www/obs/{api,webui}


Set up firewall for FRONTEND server

    Add TCP ports for FRONTEND server

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

80 81 443 444

"443 444" ports should be enabled only if it is used.


Start FRONTEND services

# systemctl start apache2 memcached obsapidelayed


Test FRONTEND server installation

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


Register FRONTEND services

# chkconfig --add apache2 memcached obsapidelayed



Install Workers

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