taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

commit 0fa4cd48aed45b097aea3004b9bf00919b278778
parent 103d02d10f4e381b77df291235f0a3c5a59ac61a
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Wed, 17 Apr 2019 18:52:56 +0200

BB to check old demo

Diffstat:
Abuildbot/demo-checker-master.cfg | 178+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Abuildbot/demo-oldchecks.sh | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mbuildbot/master.cfg | 1+
3 files changed, 282 insertions(+), 0 deletions(-)

diff --git a/buildbot/demo-checker-master.cfg b/buildbot/demo-checker-master.cfg @@ -0,0 +1,178 @@ +import re +from buildbot.steps.source.git import Git +from buildbot.steps.shell import ShellCommand +from buildbot.plugins import (reporters, + worker, + changes, + schedulers, + util) + +# This is a sample buildmaster config file. It must be installed as +# 'master.cfg' in your buildmaster's base directory. + +# This is the dictionary that the buildmaster pays attention to. +# We also use a shorter alias to save typing. +c = BuildmasterConfig = {} + +# Silence warning and allow very basic phoning home. +c["buildbotNetUsageData"] = "basic" + +####### WORKERS + +# The 'workers' list defines the set of recognized workers. Each +# element is a Worker object, specifying a unique worker name and +# password. The same worker name and password must be configured +# on the worker. +c["workers"] = [ + worker.Worker("demo-checker", "demo-pass")] + +# '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. 'port' must match the value configured into +# the workers (with their --master option) +c["protocols"] = { + "pb": { + "port": "tcp:9989:interface=127.0.0.1"}} + +####### CHANGESOURCES + +# the 'change_source' setting tells the buildmaster how it should +# find out about source code changes. + +# NOTE: BB is bound to localhost +ALLCS = changes.PBChangeSource(user="allcs", passwd="allcs") + +c["change_source"] = [ALLCS] + +####### SCHEDULERS + +# Configure the Schedulers, which decide how to react to incoming +# changes. + +DEMO_SERVICES_CHECKER_SCHEDULER = schedulers.Periodic( + name="demo-services-checker-scheduler", + periodicBuildTimer=60*30, # 1/2 hour + builderNames=["demo-services-checker-builder"]) + + +# Provide "force" button in the web UI. To be removed in the +# future ? +FORCE_SCHEDULER = schedulers.ForceScheduler( + name="force-scheduler", + builderNames=[ + "demo-check-builder"]) + +c["schedulers"] = [ + DEMO_SERVICES_CHECKER_SCHEDULER, + FORCE_SCHEDULER] + +####### BUILDERS + +# The 'builders' list defines the Builders, which tell Buildbot +# how to perform a build: what steps, and which workers can execute +# them. Note that any particular build will only take place on +# one worker. + +def git_step(repo): + return Git(repourl=repo, + mode="full", + method="fresh", + logEnviron=False, + alwaysUseLatest=True, + haltOnFailure=True, + branch="master") + +DEMO_SERVICES_CHECKER_FACTORY = util.BuildFactory() +DEMO_SERVICES_CHECKER_FACTORY.addStep(ShellCommand( + name="demo services checker", + description="Checking demo services are online", + descriptionDone="Demo services are online!.", + # a symlink to a nonupdated deployment checkout. + command=["$HOME/demo-oldchecks.sh"], + workdir="build/buildbot", + haltOnFailure=True) + +DEMO_SERVICES_CHECKER_BUILDER = util.BuilderConfig( + name="demo-services-checker-builder", + workernames="demo-worker", + factory=DEMO_SERVICES_CHECKER_FACTORY) + +c["builders"] = [ + DEMO_SERVICES_CHECKER_BUILDER] + +####### BUILDBOT SERVICES + +# 'services' is a list of BuildbotService items like reporter +# targets. The status of each build will be pushed to these +# targets. buildbot/reporters/*.py has a variety to choose from, +# like IRC bots. + +EMAIL = reporters.MailNotifier( +fromaddr="testbuild@taler.net", +sendToInterestedUsers=False, +# notify from pass to fail, and viceversa. +mode=("change"), +builders=("demo-services-checker-builder"), + extraRecipients=["demo-feedback@taler.net"], + subject="Demo down.") + +c["services"] = [IRC, EMAIL] + +####### PROJECT IDENTITY + +c["title"] = "Taler" +c["titleURL"] = "https://taler.net" + +# We use nginx to expose the BB under this URL. +c["buildbotURL"] = "https://buildbot.taler.net/" + +from taler_bb_userpass_db import USER_PASSWORD_DB + +BUILDER_LIST = ["demo-services-checker-builder"] + +authz = util.Authz( + allowRules=[ + util.ForceBuildEndpointMatcher( + role="admins", + builder=b) for b in BUILDER_LIST] + + [util.StopBuildEndpointMatcher( + role="admins", + builder=b) for b in BUILDER_LIST] + + [util.RebuildBuildEndpointMatcher( + role="admins", + builder=b) for b in BUILDER_LIST] + + [util.ForceBuildEndpointMatcher( + role="norole", + builder=b) for b in BUILDER_LIST] + + [util.StopBuildEndpointMatcher( + role="norole", + builder=b) for b in BUILDER_LIST] + + [util.RebuildBuildEndpointMatcher( + role="norole", + builder=b) for b in BUILDER_LIST], + roleMatchers=[ + util.RolesFromUsername(roles=["admins"], + usernames=["marcello", + "florian", + "christian"])]) + +# minimalistic config to activate new web UI +c["www"] = { + "port": 8010, + "plugins" : { + "waterfall_view": {}, + "console_view":{}}, + "allowed_origins": ["https://*.taler.net"], + "avatar_methods": [], + "auth": util.UserPasswordAuth(USER_PASSWORD_DB), + "authz": authz} + +####### DB URL + +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" : "sqlite:///state.sqlite", +} diff --git a/buildbot/demo-oldchecks.sh b/buildbot/demo-oldchecks.sh @@ -0,0 +1,103 @@ +#!/bin/bash + +error_fmt="%s (http status code: %s)/(curl exit code: %s - %s)\n" +error_stringify () +{ + case $1 in + 28) echo "connection timed out" ;; + 7) echo "failed to connect to host" ;; + 0) echo "not a error, curl went fine" ;; + *) echo "unknown, see curl man page" ;; + esac +} + +DOMAIN="taler.net" +DEPLOYMENT="demo" +URL="https://exchange.${DEPLOYMENT}.${DOMAIN}/" +http_status_code=$(curl \ + -s "$URL" -o /dev/null \ + -w "%{http_code}") +if ! test 200 = $http_status_code; then + printf "'%s' failed\n" $URL + printf "$error_fmt" \ + "Exchange (${URL}) down" \ + $http_status_code $? "$(error_stringify $?)" + exit 1 +fi + +URL="http://backend.${DEPLOYMENT}.${DOMAIN}/" +http_status_code=$(curl \ + -s $URL \ + --header "Authorization: ApiKey sandbox" \ + -o /dev/null \ + -w "%{http_code}") +if ! test 200 = $http_status_code; then + printf "'%s' failed\n" $URL + printf "$error_fmt" \ + "Merchant ${URL} down" \ + $http_status_code $? "$(error_stringify $?)" + exit 1 +fi + +DF="demo-feedback@taler.net" +URL="https://shop.${DEPLOYMENT}.${DOMAIN}/" +http_status_code=$(curl \ + -s $URL -o /dev/null \ + -w "%{http_code}") +if ! test 200 = $http_status_code; then + printf "%s failed" $URL + printf "$error_fmt" \ + "Blog (${URL}) down" \ + $http_status_code $? "$(error_stringify $?)" + exit 1 +fi + +URL="https://survey.${DEPLOYMENT}.${DOMAIN}/" +http_status_code=$(curl \ + -s $URL -o /dev/null \ + -w "%{http_code}") +if ! test 200 = $http_status_code; then + printf "%s failed" $URL + printf "$error_fmt" \ + "Survey (${URL}) is down" \ + $http_status_code $? "$(error_stringify $?)" + exit 1 +fi + +URL="https://donations.${DEPLOYMENT}.${DOMAIN}/" +http_status_code=$(curl \ + -s $URL -o /dev/null \ + -w "%{http_code}") +if ! test 200 = $http_status_code; then + printf "%s failed" $URL + printf "$error_fmt" \ + "Donations (${URL}) is down" \ + $http_status_code $? "$(error_stringify $?)" + exit 1 +fi + +URL="https://bank.${DEPLOYMENT}.${DOMAIN}/" +http_status_code=$(curl \ + -s $URL -o /dev/null \ + -w "%{http_code}") +if ! test 302 = $http_status_code; then + printf "%s failed" $URL + printf "$error_fmt" \ + "Bank (${URL}) is down" \ + $http_status_code $? "$(error_stringify $?)" + exit 1 +fi + +URL="https://${DEPLOYMENT}.${DOMAIN}/en/index.html" +http_status_code=$(curl \ + -s $URL -o /dev/null \ + -w "%{http_code}") +if ! test 200 = $http_status_code; then + printf "%s failed" $URL + printf "$error_fmt" \ + "Landing (${URL}) is down." \ + $http_status_code $? "$(error_stringify $?)" + exit 1 +fi + +printf "All services correctly restarted!\n" diff --git a/buildbot/master.cfg b/buildbot/master.cfg @@ -528,6 +528,7 @@ EMAIL = reporters.MailNotifier( # notify from pass to fail, and viceversa. mode=("change"), builders=( + "lcov-builder", "testswitcher-builder", "doc-builder", "wallet-builder",