initial commit

This commit is contained in:
Pierre Tardy 2016-10-05 15:47:14 +02:00
parent 4109d3e3ee
commit 1069691b01
No known key found for this signature in database
GPG Key ID: CE916B1801820C0A
6 changed files with 145 additions and 6 deletions

View File

@ -18,9 +18,17 @@ c = BuildmasterConfig = {}
# a Worker object, specifying a unique worker name and password. The same
# worker name and password must be configured on the worker.
# here we configure a localworker, which will run in the same process as the master
c['workers'] = [worker.LocalWorker("example-localworker")]
c['workers'] = [worker.Worker("example-worker", 'pass')]
if 'BUILDBOT_MQ_URL' in os.environ:
c['mq'] = {
'type' : 'wamp',
'router_url': os.environ['BUILDBOT_MQ_URL'],
'realm': os.environ.get('BUILDBOT_MQ_REALM', 'buildbot').decode('utf-8'),
'debug' : 'BUILDBOT_MQ_DEBUG' in os.environ,
'debug_websockets' : 'BUILDBOT_MQ_DEBUG' in os.environ,
'debug_lowlevel' : 'BUILDBOT_MQ_DEBUG' in os.environ,
}
# 'protocols' contains information about protocols which master will use for
# communicating with workers. You must define at least 'port' option that workers
# could connect to your master with this protocol.
@ -62,7 +70,7 @@ c['schedulers'].append(schedulers.ForceScheduler(
factory = util.BuildFactory()
# check out the source
factory.addStep(steps.Git(repourl='git://github.com/buildbot/pyflakes.git', mode='incremental'))
factory.addStep(steps.Git(repourl='http://github.com/buildbot/pyflakes.git', mode='incremental'))
# run the tests (note that this will require that 'trial' is installed)
factory.addStep(steps.ShellCommand(command=["trial", "pyflakes"]))
@ -89,8 +97,8 @@ c['title'] = "Pyflakes"
c['titleURL'] = "https://launchpad.net/pyflakes"
# the 'buildbotURL' string should point to the location where the buildbot's
# internal web server is visible. This typically uses the port number set in
# the 'www' entry below, but with an externally-visible host name which the
# internal web server is visible. This typically uses the port number set in
# the 'www' entry below, but with an externally-visible host name which the
# buildbot cannot figure out without some help.
c['buildbotURL'] = os.environ.get("BUILDBOT_WEB_URL", "http://localhost:8010/")
@ -104,5 +112,5 @@ c['www'] = dict(port=os.environ.get("BUILDBOT_WEB_PORT", 8010),
c['db'] = {
# This specifies what database buildbot uses to store its state. You can leave
# this at its default for all but the largest installations.
'db_url' : os.environ.get("BUILDBOT_DB_URL", "sqlite://"),
'db_url' : os.environ.get("BUILDBOT_DB_URL", "sqlite://").format(**os.environ),
}

27
multimaster/README.md Normal file
View File

@ -0,0 +1,27 @@
This docker-compose environment show how to setup a buildbot in multimaster mode with docker and ha-proxy
The network schema is as follow:
[ web users]
| |
------------------------
[workers] | /
\| |/
[ HAPROXY ]
/ \
/ \
[master1]..[masterN]
| \ / |
| \ / |
| /\ |
[ postgre] [crossbar]
The same haproxy serves as load balancing for both web and worker protocols
You can run this by using for example 4 masters
docker-compose up -d
docker-compose scale buildbot=4

6
multimaster/db.env Normal file
View File

@ -0,0 +1,6 @@
# database parameters are shared between containers
POSTGRES_PASSWORD=change_me
POSTGRES_USER=buildbot
POSTGRES_DB=buildbot
# in master.cfg, this variable is str.format()ed with the environment variables
BUILDBOT_DB_URL=postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@db/{POSTGRES_DB}

View File

@ -0,0 +1,58 @@
version: '2'
services:
lb:
image: dockercloud/haproxy
links:
- buildbot
volumes:
- /var/run/docker.sock:/var/run/docker.sock
expose:
- 8080
- 9989
ports:
- 8080:8080
- 9989:9989 # for external workers
buildbot:
image: buildbot/buildbot-master:latest
env_file: db.env
environment:
- BUILDBOT_CONFIG_DIR=config
- BUILDBOT_CONFIG_URL=https://github.com/buildbot/buildbot-docker-example-config/archive/master.tar.gz
- BUILDBOT_WORKER_PORT=9989
- BUILDBOT_WEB_URL=http://localhost:8080/
- BUILDBOT_WEB_PORT=8080
- BUILDBOT_MQ_URL=ws://mq:8080/ws
- BUILDBOT_MQ_DEBUG=true
- BUILDBOT_MQ_REALM=realm1
- TCP_PORTS=8080,9989
links:
- db
expose:
- 8080
- 9989
db:
image: "postgres:9.4"
env_file: db.env
expose:
- 5432
mq:
image: "crossbario/crossbar"
env_file: db.env
expose:
- 8080
worker:
image: "buildbot/buildbot-worker:master"
environment:
BUILDMASTER: lb
BUILDMASTER_PORT: 9989
WORKERNAME: example-worker
WORKERPASS: pass
WORKER_ENVIRONMENT_BLACKLIST: DOCKER_BUILDBOT* BUILDBOT_ENV_* BUILDBOT_1* WORKER_ENVIRONMENT_BLACKLIST
links:
- lb

6
simple/db.env Normal file
View File

@ -0,0 +1,6 @@
# database parameters are shared between containers
POSTGRES_PASSWORD=change_me
POSTGRES_USER=buildbot
POSTGRES_DB=buildbot
# in master.cfg, this variable is str.format()ed with the environment variables
BUILDBOT_DB_URL=postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@db/{POSTGRES_DB}

34
simple/docker-compose.yml Normal file
View File

@ -0,0 +1,34 @@
version: '2'
services:
buildbot:
image: buildbot/buildbot-master:latest
env_file: db.env
environment:
- BUILDBOT_CONFIG_DIR=config
- BUILDBOT_CONFIG_URL=https://github.com/buildbot/buildbot-docker-example-config/archive/master.tar.gz
- BUILDBOT_WORKER_PORT=9989
- BUILDBOT_WEB_URL=http://localhost:8080/
- BUILDBOT_WEB_PORT=8080
links:
- db
depends_on:
- db
ports:
- "8080:8080"
db:
env_file: db.env
image: "postgres:9.4"
expose:
- 5432
worker:
image: "buildbot/buildbot-worker:master"
environment:
BUILDMASTER: buildbot
BUILDMASTER_PORT: 9989
WORKERNAME: example-worker
WORKERPASS: pass
WORKER_ENVIRONMENT_BLACKLIST: DOCKER_BUILDBOT* BUILDBOT_ENV_* BUILDBOT_1* WORKER_ENVIRONMENT_BLACKLIST
links:
- buildbot