Introduction

This document describes how to setup Tizen infrastructure using Docker images. Docker is a container-based software framework for automating deployment of applications. Containers are encapsulated, lightweight, and portable application modules. Docker is a platform for developers and sysadmins to develop, ship, and run applications. Docker lets you quickly assemble applications from components and eliminates the friction that can come when shipping code. Docker lets you get your code tested and deployed into production as fast as possible.

This will trigger jenkin's job load-repo-conf, which will download the repos.yaml and persists the configuration in redis db.
If job is not a build, please unchecked the "Restrict where this project can be run" of the load-repo-conf job and other jobs

1.1 One OBS target project must contain two attributes at least, OBS_project means the final target OBS project, OBS_staging_project means the staging build project. Jenkins will sync gerrit project to OBS_staging_project directly, then create one OBS SR to request to merge to OBS_project according to whether this change modified changes file and attached one tag. As the example shows, the master branch of /pkgs/m/mic maps to Tizen:Main project and uses Tizen:Main:build as the staging project.

1.2 One branch could be mapped to multiply OBS project. The 4.4.7 branch of /pkgs/g/gcc maps to two OBS project Tizen:Main and Tools:dev.

1.3 If packaging directory contains multiply specfiles, use attribute OBS_package to specify the specfile name, like pkgs/g/gcc will use gcc-4.4.7.spec when submitting to Tools:dev.

1.4 When attribute submission equals N, it will block Jenkins sync this project or branch. As example shows, the whole project git-obs-mapping and the master branch of /pkgs/g/gcc are blocked. Default value of submission is "Y".

Triggered by Gerrit Event plugin
Triggered by obs-event-plugin
Triggered by upstream project
Using by jenkins-snapdiff project

OBS server docker image

Setup

The Open Build Service (OBS) is a generic system to build and distribute packages from sources in an automatic, consistent and reproducible way. It makes it possible to release software for a wide range of operating systems and hardware architectures. OBS docker image version is 2.4.0.7. OBS version is 2.4 and docker image version is 0.7

$ vi config.conf
# Configuration of the dobsserver.sh
# You can change the hostname. Do not change others.
export HOSTNAME= #hostname in container
#If you remove the Container, the changed values are deleted,
# the backup data must be managed volumes.
export VOLUMES="<host dir or filename>:<container dir or filename>

Start/Stop OBS server

Load the obs docker image

$ sudo ./dobsserver.sh load

List docker images

$ sudo docker images
tizendocker:443/obsserver 2.4.0.7

Start the container

This will start the OBS server

$ sudo ./dobsserver.sh start

If you use a firewall on host OS, you have to allow a port number.(80 81 82 443 444 873 5152 5252 5352)

$ vi config.conf
### In the value of the OBS_WORKER_PORTBASE of the obs-server file must be increased by the number of OBS_WORKER_INSTANCES.
# Use different ports for different containers
## ex) "hostport1 hostport2" or "hostport1:containerport1" or "exposeport1-exposeport2"
export PORTS="60000-60003"
### Container name
export CONTAINER="obsworker" # If you are running multiple containers in same system then name this as obsworker1 or obsworker2 etc
### Container host name
export HOSTNAME="OBSWorker" # If you are running multiple containers in same system then name this as OBSWorker1 or OBSWorker2 etc
### Add a custom host-to-IP mapping (host:ip).
export ADD_HOSTS="<obsserver hostname>:<ip>"

OBS worker configuration

$ vi $(pwd)/root/etc/sysconfig/obs-server
# Default setting : 4 instances are created, and 1 job (cpu) is assinged to each instance.
# You can change OBS worker setting (optimization based on your server environment)
# (refer to https://wiki.tizen.org/wiki/OBS_2.4_All-in-One_Server)
###Set Number of all instances which is used by worker
# OBS_WORKER_INSTANCES=(Max Port No. - Min Port No.+1)
# ex) if you use "export PORTS="60000-60007, then OBS_WORKER_INSTANCES=(60007-60000 +1) = 8
OBS_WORKER_INSTANCES="4"
# OBS_WORKER_JOBS : number of cpus which is used by each instance
# Note : (OBS_WORKER_INSTANCES * OBS_WORKER_JOBS ) must not exceed total number of host cpus.
# ex) total number of host cpus = 32 core, and OBS_WORKER_INSTANCES=12
# if OBS_WORKER_JOBS=2, it's ok (OBS_WORKER_INSTANCES * OBS_WORKER_JOBS =24, which is lower than 32)
# if OBS_WORKER_JOBS=3, woker will not work. (OBS_WORKER_INSTANCES * OBS_WORKER_JOBS =36, which is higher than 32)
OBS_WORKER_JOBS = 4
# important ( worker1,worker2 must be different port value.)
# ex) worker1 server = "60000" then worker2 server = "60020"
OBS_WORKER_PORTBASE="60000"
# The hostname or the IP address of the OBS server
OBS_SRC_SERVER="<OBSServer ip>:5352"
# The hostname or the IP address of the OBS server
OBS_REPO_SERVERS="<OBSServer ip>:5252"
...

To run multiple containers/obs workers in same machine please follow the below steps

1) Copy the OBS worker docker image to another directory

2) Follow the instructions given in Setup section

3) Change the configuration

Start/Stop OBS worker

Load an image from a tar archive.

$ sudo ./dobsworker.sh load

List docker images

$ sudo docker images
tizendocker:443/obsworker 2.4.0.3

If you use a firewall on host OS, you have to allow a obsworker port number.

Example

I'll explain how to set the OBS Worker on multiple servers(A,B,C Server).
If hostname of OBS Server is "tizendocker" and IP is "10.0.0.1", add a ADD_HOSTS="tizendocker:10.0.0.1" in the config.conf of the OBS Worker.

OBS_Server: config.conf

export HOSTNAME="tizendocker"

If you want to increase a value of OBS_WORKER_INSTANCES. Please increase a PORTS value of config.conf.
OBS_WORKER_PORTBASE value must use a different PORT value.# important ( worker1,worker2 must be different PORT value.)