Run statusbot from eavesdrop01.opendev.org

This installs statusbot on eavesdrop01.opendev.org.

Otherwise it's just config translation and bringing up the daemon.

Change-Id: I246b2723372594e65bcd1ba90215d6831d4c0c72
This commit is contained in:
Ian Wienand 2021-06-08 15:54:00 +10:00
parent 8a1f6d9764
commit 23fac31c92
11 changed files with 198 additions and 2 deletions

View File

@ -11,6 +11,8 @@ if [ ! -d .zuul-siblings/opendev.org/opendev/meetbot ]; then
fi
pushd .zuul-siblings/opendev.org/opendev
ln -sf ../../../meetbot meetbot
popd
fi
docker build . -f Dockerfile --build-arg "ZUUL_SIBLINGS=opendev.org/opendev/meetbot"
docker build . -f Dockerfile --build-arg \
ZUUL_SIBLINGS="opendev.org/opendev/meetbot"

View File

@ -0,0 +1,4 @@
Deploy statusbot
.. note:: This should be turned into a Limnoria plugin. Until this
is done, we run it as a separate daemon.

View File

@ -0,0 +1,19 @@
statusbot_nick: opendevstatus
statusbot_pass: ''
statusbot_server: 'irc.oftc.net'
statusbot_auth_nicks:
- ianw
statusbot_channels:
- opendev-sandbox
statusbot_wiki_url: 'https://wiki.openstack.org/w/api.php'
# https://wiki.openstack.org/wiki/Infrastructure_Status
statusbot_wiki_pageid: '1781'
statusbot_wiki_successpageid: '7717'
statusbot_wiki_successpageurl: 'https://wiki.openstack.org/wiki/Successes'
statusbot_wiki_thankspageid: '37700'
statusbot_wiki_thankspageurl: 'https://wiki.openstack.org/wiki/Thanks'
statusbot_irclogs_url : 'http://eavesdrop.openstack.org/irclogs/%(chan)s/%(chan)s.%(date)s.log.html'
statusbot_twitter: True

View File

@ -0,0 +1,18 @@
# Version 2 is the latest that is supported by docker-compose in
# Ubuntu Xenial.
version: '2'
services:
statusbot:
image: docker.io/opendevorg/statusbot:latest
network_mode: host
restart: always
logging:
driver: syslog
options:
tag: "docker-statusbot"
volumes:
# This contains the main config, channel config, and ssh key
- /etc/statusbot:/etc/statusbot
- /var/lib/statusbot:/var/lib/statusbot
- /var/log/statusbot:/var/log/statusbot

View File

@ -0,0 +1,44 @@
[loggers]
keys=root,statusbot,irc
[handlers]
keys=console,debug,normal
[formatters]
keys=simple
[logger_root]
level=WARNING
handlers=console
[logger_statusbot]
level=DEBUG
handlers=debug,normal
qualname=statusbot
[logger_irc]
level=DEBUG
handlers=debug,normal
qualname=irc
[handler_console]
level=WARNING
class=StreamHandler
formatter=simple
args=(sys.stdout,)
[handler_debug]
level=DEBUG
class=logging.handlers.TimedRotatingFileHandler
formatter=simple
args=('/var/log/statusbot/statusbot_debug.log', 'midnight', 1, 30,)
[handler_normal]
level=INFO
class=logging.handlers.TimedRotatingFileHandler
formatter=simple
args=('/var/log/statusbot/statusbot.log', 'midnight', 1, 30,)
[formatter_simple]
format=%(asctime)s %(levelname)s %(name)s: %(message)s
datefmt=

View File

@ -0,0 +1,52 @@
- name: Ensure statusbot directories
file:
state: directory
path: '{{ item }}'
owner: root
group: root
mode: 0755
loop:
- /etc/statusbot
- /etc/statusbot-docker
- /var/log/statusbot
- /var/lib/statusbot
- /var/lib/statusbot/www
- name: Put statusbot config in place
template:
src: statusbot.config.j2
dest: /etc/statusbot/statusbot.config
owner: root
group: root
mode: 0600
register: statusbot_config_copied
- name: Put statusbot logging config in place
copy:
src: logging.config
dest: /etc/statusbot/logging.config
owner: root
group: root
mode: 0644
- name: Put docker-compose file in place
copy:
src: docker-compose.yaml
dest: /etc/statusbot-docker/docker-compose.yaml
owner: root
group: root
mode: 0644
- name: Run docker-compose pull
shell:
cmd: docker-compose pull
chdir: /etc/statusbot-docker/
- name: Run docker-compose up
shell:
cmd: "docker-compose up -d {{ statusbot_config_copied is changed | ternary('--force-recreate', '') }}"
chdir: /etc/statusbot-docker/
- name: Run docker prune to cleanup unneeded images
shell:
cmd: docker image prune -f

View File

@ -0,0 +1,46 @@
[ircbot]
nick={{ statusbot_nick }}
pass={{ statusbot_nick_password }}
server={{ statusbot_server }}
port=6697
channels={{ statusbot_channels | join(',') }}
nicks={{ statusbot_auth_nicks | join(',') }}
lockfile=/var/run/statusbot/statusbot.pid
log_config=/etc/statusbot/logging.config
[wiki]
username={{ statusbot_wiki_user }}
password={{ statusbot_wiki_password }}
url={{ statusbot_wiki_url }}
pageid={{ statusbot_wiki_pageid }}
{% if statusbot_wiki_successpageid %}
successpageid={{ statusbot_wiki_successpageid }}
{% endif %}
{% if statusbot_wiki_successpageurl %}
successpageurl={{ statusbot_wiki_successpageurl }}
{% endif %}
{% if statusbot_wiki_thankspageid %}
thankspageid={{ statusbot_wiki_thankspageid }}
{% endif %}
{% if statusbot_wiki_thankspageurl %}
thankspageurl={{ statusbot_wiki_thankspageurl }}
{% endif %}
{% if statusbot_irclogs_url %}
[irclogs]
url={{ statusbot_irclogs_url }}
{% endif %}
[alertfile]
dir=/var/lib/statusbot/www
{% if statusbot_twitter %}
[twitter]
consumer_key={{ statusbot_twitter_key }}
consumer_secret={{ statusbot_twitter_secret }}
access_token_key={{ statusbot_twitter_token_key }}
access_token_secret={{ statusbot_twitter_token_secret }}
{% endif %}

View File

@ -7,4 +7,5 @@
- sync-project-config
- accessbot
- gerritbot
- statusbot
- limnoria

View File

@ -1,5 +1,6 @@
openstack_meetbot_password: password
statusbot_nick_password: password
statusbot_wiki_user: username
statusbot_wiki_password: password
statusbot_twitter_key: twitter_key
statusbot_twitter_secret: twitter_secret

View File

@ -36,3 +36,9 @@ def test_gerritbot_running(host):
cmd = host.run("docker ps -a")
assert 'gerritbot-docker_gerritbot_1' in cmd.stdout
assert 'Up ' in cmd.stdout
def test_statusbot_running(host):
# Check that the container hasn't stopped
cmd = host.run("docker ps -a")
assert 'statusbot-docker_statusbot_1' in cmd.stdout
assert 'Up ' in cmd.stdout

View File

@ -124,12 +124,12 @@
description: |
Run the playbook for an eavesdrop server.
required-projects:
- opendev/ansible-role-puppet
- opendev/system-config
- openstack/project-config
requires:
- accessbot-container-image
- gerritbot-container-image
- statusbot-container-image
- ircbot-container-image
nodeset:
nodes:
@ -148,6 +148,8 @@
'/var/log/apache2': logs
'/var/log/acme.sh': logs
'/etc/apache2': logs
'/var/log/statusbot': logs
'/etc/statusbot': logs
files:
- playbooks/service-eavesdrop.yaml
- playbooks/run-accessbot.yaml
@ -156,6 +158,7 @@
- playbooks/roles/accessbot
- playbooks/roles/limnoria
- playbooks/roles/logrotate
- playbooks/roles/statusbot
- playbooks/zuul/templates/group_vars/eavesdrop.yaml.j2
- docker/accessbot/
- testinfra/test_eavesdrop.py