Teuthology 实验室设置说明

简介

我们最近为 Ceph 测试设置了一个新实验室,并决定记录下与 teuthology 最相关的设置过程。本文即为记录结果。

我们首先预留了两台测试机:一台作为“teuthology 节点”,另一台作为“paddles/pulpito 节点”。它们将用于编排自动化测试以及在我们的内网上存储和提供测试结果。

paddles/pulpito 节点

我们目前在同一个节点上运行 paddles 和 pulpito。我们有一个前端代理服务器,监听端口 80,根据所使用的主机名转发到相应的服务。您可以根据需要修改我们的 paddlespulpito 配置。

以 root 用户或具有 sudo 访问权限的其他用户身份执行以下操作

sudo apt-get install git python3-dev python3-virtualenv postgresql postgresql-contrib postgresql-server-dev-all supervisor
sudo -u postgres createuser paddles -P
sudo -u postgres createdb paddles

为 paddles 和 puplito 创建单独的用户。我们使用了 'paddles' 和 'pulpito'。

paddles

按照 https://github.com/ceph/paddles/blob/main/README.rst 中的说明操作

pulpito

按照 https://github.com/ceph/pulpito/blob/main/README.rst 中的说明操作

启动

回到“root 或 sudo”用户身份

sudo cp ~paddles/paddles/supervisord_paddles.conf /etc/supervisor/conf.d/paddles.conf
sudo supervisorctl reread && sudo supervisorctl update paddles && sudo supervisorctl start paddles
sudo cp ~pulpito/pulpito/supervisord_pulpito.conf /etc/supervisor/conf.d/pulpito.conf
sudo supervisorctl reread && sudo supervisorctl update pulpito && sudo supervisorctl start pulpito

测试节点

每个节点都需要有一个名为 'ubuntu' 的用户,并具有无密码的 sudo 访问权限。

还需要生成一个 ssh 密钥对,用于向所有测试节点提供无密码认证,并将公钥放在所有测试节点的 ~/.ssh/authorized_keys 中。

Teuthology 节点

创建 /etc/teuthology.yaml 文件,内容如下

lab_domain: example.com
lock_server: http://paddles.example.com:8080
results_server: http://paddles.example.com:8080
queue_host: localhost
queue_port: 11300
results_email: you@example.com
archive_base: /home/teuthworker/archive

以 root 用户或具有 sudo 访问权限的其他用户身份执行以下操作

创建两个额外的用户:一个用于简单地提交作业到队列,另一个用于从队列中取出并执行作业。我们分别使用了 'teuthology' 和 'teuthworker'。

给予这两个用户无密码的 sudo 访问权限。

将用于访问测试节点而创建的 ssh 密钥对复制到这些用户的 ~/.ssh 目录中。

安装这些软件包

sudo apt-get -y install git python-dev python-pip python-virtualenv libevent-dev python-libvirt beanstalkd

现在,设置您刚刚创建的两个用户

调度器

以 'teuthology' 用户身份执行以下操作

mkdir ~/src
git clone https://github.com/ceph/teuthology.git src/teuthology_main
pushd src/teuthology_main/
./bootstrap
popd

工作器

以 'teuthworker' 用户身份执行以下操作

mkdir ~/src
git clone https://github.com/ceph/teuthology.git src/teuthology_main
pushd src/teuthology_main/
./bootstrap
popd
mkdir ~/bin
wget -O ~/bin/worker_start https://raw.githubusercontent.com/ceph/teuthology/main/docs/_static/worker_start.sh
echo 'PATH="$HOME/src/teuthology_main/virtualenv/bin:$PATH"' >> ~/.profile
source ~/.profile
mkdir -p ~/archive/worker_logs
worker_start magna 1

提交节点

首先

wget https://raw.githubusercontent.com/ceph/teuthology/main/docs/_static/create_nodes.py

编辑 create_nodes.py 以生成您想要提交到 paddles 的机器主机名。

现在开始工作

python create_nodes.py
teuthology-lock --owner initial@setup --list-targets > /tmp/targets
teuthology --owner initial@setup /tmp/targets
teuthology-lock --owner initial@setup --unlock -t /tmp/targets

提供测试日志

pulpito 尝试提供测试日志的链接。开箱即用的情况下,这些链接是无效的,但很容易修复。

首先,在 teuthology 节点上安装您喜欢的 web 服务器。如果您使用 nginx,可以使用 我们的配置 作为模板。

一旦日志文件开始提供服务,编辑 paddles 的 config.py 并更新 job_log_href_templ 值。完成后重启 paddles。