-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1665 from ceph/wip-ksirivad-docker-compose-script
Added dockerfile + docker-compose script dev setup
- Loading branch information
Showing
5 changed files
with
277 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM ubuntu:latest | ||
ENV DEBIAN_FRONTEND=nonintercative | ||
COPY . /teuthology | ||
COPY .teuthology.yaml ./root | ||
WORKDIR /teuthology | ||
RUN chmod +x /teuthology/bootstrap | ||
RUN apt-get update && apt-get install -y \ | ||
git qemu-utils python3-dev libssl-dev ipmitool \ | ||
python3-pip python3-virtualenv vim \ | ||
libev-dev libvirt-dev libffi-dev \ | ||
libyaml-dev lsb-release && apt-get \ | ||
clean all | ||
RUN mkdir ../archive_dir | ||
RUN mkdir log | ||
CMD ./bootstrap && ./virtualenv/bin/teuthology-suite \ | ||
-v --ceph-repo https://github.com/ceph/ceph.git \ | ||
--suite-repo https://github.com/ceph/ceph.git \ | ||
-c master -m smithi --subset 9000/100000 --limit 1 \ | ||
--suite dummy \ | ||
--suite-branch master -p 75 --force-priority -n 100 \ | ||
&& tail -f /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
# Teuthology Development Environment Instruction | ||
|
||
The purpose of this guide is to help developers set | ||
up a development environment for Teuthology. We will be using | ||
Dockers to set up all the containers for | ||
Postgres, Paddles, Pulpito, Beanstalk, Teuthology. | ||
For now, this guide will rely on the sepia lab cluster | ||
for test nodes. | ||
|
||
# Add/Edit Teuthology config file | ||
|
||
First you need to add `.teuthology.yaml` | ||
to the same directory level as this | ||
README file. An easy way to do this is to | ||
ssh into teuthology.front.sepia.com and you will | ||
find the file in `/etc/teuthology.yaml`. Next, | ||
copy and paste the file to your local machine | ||
and edit (lock_server, results_server, results_ui_server, queue_host) to: | ||
|
||
```bash | ||
lock_server: http://paddles:8080 | ||
results_server: http://paddles:8080 | ||
results_ui_server: http://pulpito:8081/ | ||
queue_host: beanstalk | ||
``` | ||
|
||
Next, add these lines to your `.teuthology.yaml`: | ||
```bash | ||
teuthology_path: ./ | ||
archive_base: ../archive_dir | ||
reserve_machines: 0 | ||
``` | ||
|
||
# Installing and Running Docker | ||
|
||
For Docker installation see: | ||
https://docs.docker.com/get-docker/ | ||
|
||
Make sure you are connected to Sepia lab VPN | ||
before starting Docker, so that the containers | ||
will use the VPN network route when executing | ||
SSH commands. | ||
|
||
To start building images and running containers: | ||
```bash | ||
./start.sh | ||
``` | ||
|
||
Once you are finished you should have all 5 containers running | ||
and should be able to access them. The script will also 1 dummy | ||
job in the queue waiting to be executed by the teutholgy-dispatcher. | ||
|
||
# Adding id_rsa private key | ||
|
||
Add your `id_rsa` key that you use to | ||
ssh into teuthology.front.sepia.com to your running | ||
teuthology container. You can find the key in | ||
`~/.ssh/id_rsa` on your local machine. | ||
|
||
Enable read & write permissions: | ||
```bash | ||
chmod 600 ~/.ssh/id_rsa | ||
``` | ||
|
||
We need to disable key checking and known_host file creation\ | ||
by adding the follow line to `~/.ssh/config`: | ||
|
||
```bash | ||
Host * | ||
StrictHostKeyChecking no | ||
UserKnownHostsFile=/dev/null | ||
``` | ||
|
||
# Reserving a machine in Sepia | ||
|
||
ssh into teuthology.front.sepia.com, | ||
lock a random machine, mark it down and give it an | ||
appropriate description of why you are locking a machine. | ||
|
||
For example, to lock 1 random smithi machine use: | ||
```bash | ||
./virtualenv/bin/teuthology-lock --lock many 1 --machine-type smithi | ||
``` | ||
|
||
To update the status and description: | ||
```bash | ||
./virtualenv/bin/teuthology-lock --update --status down --desc teuthology-dev-testing smithi022 | ||
``` | ||
|
||
# Adding test-nodes to Paddles | ||
|
||
After reserving your machine, you can now add the machine | ||
into your paddles inventory by following these steps | ||
in your teuthology container: | ||
|
||
```bash | ||
cd ~/teuthology | ||
source ./virtualenv/bin/activate | ||
``` | ||
|
||
In `docs/_static/create_nodes.py` | ||
edit (paddles_url, machine_type, lab_domain, and machine_index_range). | ||
|
||
Here is what the file should look like when you are trying to add smithi022: | ||
```python | ||
11 from teuthology.lock.ops import update_inventory | ||
12 | ||
13 paddles_url = 'http://paddles:8080' | ||
14 | ||
15 machine_type = 'smithi' | ||
16 lab_domain = 'front.sepia.ceph.com' | ||
17 # Don't change the user. It won't work at this time. | ||
18 user = 'ubuntu' | ||
19 # We are populating 'typica003' -> 'typica192' | ||
20 machine_index_range = range(22, 23) | ||
21 | ||
22 log = logging.getLogger(sys.argv[0]) | ||
``` | ||
|
||
Run the command: | ||
```bash | ||
python docs/_static/create_nodes.py | ||
``` | ||
Output should look like this when successful: | ||
|
||
```bash | ||
$ python docs/_static/create_nodes.py | ||
INFO:docs/_static/create_nodes.py:Creating smithi022.front.sepia.ceph.com | ||
INFO:teuthology.orchestra.remote:Trying to reconnect to host | ||
INFO:teuthology.orchestra.run.smithi022.stdout:x86_64 | ||
INFO:teuthology.orchestra.run.smithi022.stdout:NAME="Ubuntu" | ||
INFO:teuthology.orchestra.run.smithi022.stdout:VERSION="18.04.5 LTS (Bionic Beaver)" | ||
INFO:teuthology.orchestra.run.smithi022.stdout:ID=ubuntu | ||
NFO:teuthology.orchestra.run.smithi022.stdout:ID_LIKE=debian | ||
INFO:teuthology.orchestra.run.smithi022.stdout:PRETTY_NAME="Ubuntu 18.04.5 LTS" | ||
INFO:teuthology.orchestra.run.smithi022.stdout:VERSION_ID="18.04" | ||
INFO:teuthology.orchestra.run.smithi022.stdout:HOME_URL="https://www.ubuntu.com/" | ||
INFO:teuthology.orchestra.run.smithi022.stdout:SUPPORT_URL="https://help.ubuntu.com/" | ||
INFO:teuthology.orchestra.run.smithi022.stdout:BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" | ||
INFO:teuthology.orchestra.run.smithi022.stdout:PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" | ||
INFO:teuthology.orchestra.run.smithi022.stdout:VERSION_CODENAME=bionic | ||
INFO:teuthology.orchestra.run.smithi022.stdout:UBUNTU_CODENAME=bionic | ||
INFO:teuthology.lock.ops:Updating smithi022.front.sepia.ceph.com on lock server | ||
INFO:teuthology.lock.ops:Creating new node smithi022.front.sepia.ceph.com on lock server | ||
``` | ||
If the test-node is locked after adding it to paddles you can run this command to unlock it: | ||
|
||
```bash | ||
./virtualenv/bin/teuthology-lock --unlock --owner initial@setup smithi022 | ||
``` | ||
|
||
# Run teuthology-dispatcher | ||
|
||
You can now test out your set up by running the dispatcher: | ||
|
||
```bash | ||
./virtualenv/bin/teuthology-dispatcher -v --archive-dir ../archive_dir --log-dir log --tube smithi | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
set -e | ||
export PGPASSWORD=$POSTGRES_PASSWORD; | ||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL | ||
CREATE USER $APP_DB_USER WITH PASSWORD '$APP_DB_PASS'; | ||
CREATE DATABASE $APP_DB_NAME; | ||
GRANT ALL PRIVILEGES ON DATABASE $APP_DB_NAME TO $APP_DB_USER; | ||
\connect $APP_DB_NAME $APP_DB_USER | ||
EOSQL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
version: '3.8' | ||
|
||
services: | ||
postgres: | ||
image: postgres:latest | ||
healthcheck: | ||
test: [ "CMD", "pg_isready", "-q", "-d", "paddles", "-U", "admin" ] | ||
timeout: 5s | ||
interval: 10s | ||
retries: 2 | ||
environment: | ||
- POSTGRES_USER=root | ||
- POSTGRES_PASSWORD=password | ||
- APP_DB_USER=admin | ||
- APP_DB_PASS=password | ||
- APP_DB_NAME=paddles | ||
volumes: | ||
- ./db:/docker-entrypoint-initdb.d/ | ||
ports: | ||
- 5432:5432 | ||
paddles: | ||
build: ./paddles | ||
environment: | ||
PADDLES_SERVER_HOST: 0.0.0.0 | ||
PADDLES_SQLALCHEMY_URL: postgresql+psycopg2://admin:password@postgres:5432/paddles | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
links: | ||
- postgres | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://0.0.0.0:8080"] | ||
timeout: 5s | ||
interval: 10s | ||
retries: 2 | ||
ports: | ||
- 8080:8080 | ||
pulpito: | ||
image: quay.io/ceph-infra/pulpito | ||
environment: | ||
PULPITO_PADDLES_ADDRESS: http://paddles:8080 | ||
depends_on: | ||
paddles: | ||
condition: service_healthy | ||
links: | ||
- paddles | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://0.0.0.0:8081"] | ||
timeout: 5s | ||
interval: 10s | ||
retries: 2 | ||
ports: | ||
- 8081:8081 | ||
beanstalk: | ||
build: ../../beanstalk/alpine | ||
depends_on: | ||
pulpito: | ||
condition: service_healthy | ||
ports: | ||
- "11300:11300" | ||
teuthology: | ||
build: ./teuthology | ||
depends_on: | ||
pulpito: | ||
condition: service_healthy | ||
links: | ||
- paddles | ||
- beanstalk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
# Clone paddles and teuthology | ||
|
||
git clone https://github.com/ceph/paddles.git | ||
cd paddles | ||
cd ../ | ||
git clone https://github.com/ceph/teuthology.git | ||
|
||
# Check for .teuthology.yaml file and copy it to teuthology | ||
if [ -f ".teuthology.yaml" ]; | ||
then | ||
cp .teuthology.yaml teuthology/. | ||
else | ||
echo ".teuthology.yaml doesn't exists" | ||
exit 1 | ||
fi | ||
|
||
# Copy Docker file into teuthology | ||
cp ./Dockerfile teuthology/. | ||
|
||
# docker-compose | ||
docker-compose up --build |