Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into dependabot/pip/ansibl…
Browse files Browse the repository at this point in the history
…e-7.0.0

Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Oct 23, 2023
2 parents 349ff43 + 1fb1341 commit 818184d
Show file tree
Hide file tree
Showing 183 changed files with 10,941 additions and 49,563 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.7.9'
python-version: '3.10.9'

- name: Update pip
run: |
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v4
with:
go-version: 1.19.4
go-version: 1.21.3

- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
Expand All @@ -24,11 +24,10 @@ jobs:
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
export PATH=/usr/local/go/bin:$PATH
cd $HOME/arewefastyet
git reset --hard FETCH_HEAD
git clean -fd
git fetch origin main
git checkout FETCH_HEAD
go build ./go/main.go
./supervisor/update.sh
docker compose -f docker-compose.prod.yml build
docker compose -f docker-compose.prod.yml up -d
6 changes: 3 additions & 3 deletions .github/workflows/golang_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
name: Build CLI binary
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.19.4
go-version: 1.21.3

- name: Build
run: make
8 changes: 4 additions & 4 deletions .github/workflows/golang_lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ jobs:
name: Lint all go files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.19.4
go-version: 1.21.3

- name: Install golangci-lint
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.49.0
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.51.2

- name: Clean Env
run: $(go env GOPATH)/bin/golangci-lint cache clean
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/golang_tidy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
name: Check go mod tidy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v4
with:
go-version: 1.19.4
go-version: 1.21.3

# https://github.com/vitessio/vitess/blob/b5177cd4d09f661350137ef46de2bd3e27949d2e/.github/workflows/gomod-tidy.yml#L17-L28
- name: Run go mod tidy
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/golang_unit_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
name: Execute all the unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.19.4
go-version: 1.21.3

- name: Test
run: make test
6 changes: 3 additions & 3 deletions .github/workflows/verify_cli_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
name: Verify CLI Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v4
with:
go-version: 1.19.4
go-version: 1.21.3

- name: Run gen doc
run: |
Expand Down
29 changes: 28 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,31 @@ override.tf.json
*_override.tf.json
arewefastyetcli

config/**/secrets.yaml
config/**/secrets.yaml

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.env
65 changes: 65 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright 2023 The Vitess Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.21.1-bookworm AS build-stage

WORKDIR /build

COPY go.mod go.sum ./

RUN go mod download

COPY . .

# Build arewefastyet
RUN CGO_ENABLED=0 GOOS=linux go build -o /arewefastyetcli ./go/main.go

FROM debian:bookworm AS run-stage

# Install Git, Golang, and Python
RUN apt-get update && apt-get install -y \
git \
python3 \
python3-pip \
python3-venv \
wget \
gnutls-bin

# Set up Python virtual environment
RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"

# Upgrade pip and install requirements
RUN pip3 install --upgrade pip
COPY requirements.txt .
RUN pip3 install -r requirements.txt

# Install ansible add-ons
RUN ansible-galaxy install cloudalchemy.node_exporter && ansible-galaxy install cloudalchemy.prometheus

# Copy the source code to the working directory
COPY --from=build-stage /arewefastyetcli /arewefastyetcli

EXPOSE 8080

# Needed for Ansible to execute sub-processes
ENV OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

# Make sure all directories are created
RUN mkdir -p /config /exec

# Configuration files MUST be attached to the container using a volume.
# The configuration files are not mounted on the Docker image for obvious
# security reasons.
CMD ["/arewefastyetcli", "api", "--config", "/config/config.yaml", "--secrets", "/config/secrets.yaml"]
38 changes: 38 additions & 0 deletions Dockerfile.ghapp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2023 The Vitess Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.21.1-bookworm AS build-stage

WORKDIR /build

COPY go.mod go.sum ./

RUN go mod download

COPY . .

# Build arewefastyet
RUN CGO_ENABLED=0 GOOS=linux go build -o /arewefastyetcli ./go/main.go

FROM debian:bookworm AS run-stage

# Copy the source code to the working directory
COPY --from=build-stage /arewefastyetcli /arewefastyetcli

EXPOSE 8181

# Configuration files MUST be attached to the container using a volume.
# The configuration files are not mounted on the Docker image for obvious
# security reasons.
CMD ["/arewefastyetcli", "ghapp", "--config", "/config/config.yaml", "--secrets", "/config/secrets.yaml"]
43 changes: 34 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
# [AreWeFastYet](https://benchmark.vitess.io)
Uses sysbench to run a benchmark on vitess.
The following codebase:
1. Creates a VPS
2. Runs the ansibles on the VPS
3. reads results from the VPS and stores in the database
4. Kills the VPS
# [Arewefastyet](https://benchmark.vitess.io)
## Background

## [Docs](docs/README.md)
With the codebase of Vitess becoming larger and complex changes getting merged, we need to ensure our changes are not degrading the performance of Vitess.

## Benchmarking Tool

To solve the aforementioned issue, we use a tool named arewefastyet that automatically tests the performance of Vitess. The performance are measured through a set of benchmarks divided into two categories: `micro` and `macro`, the former focuses on unit-level functions, and the latter targets system-wide performance changes.

The GitHub repository where lies all of arewefastyet's code can be found [here: vitessio/arewefastyet](https://github.com/vitessio/arewefastyet).

## CRON Schedule

Our benchmarks run frequently based on three different CRON schedules that are defined in [this file](https://github.com/vitessio/arewefastyet/blob/main/config/prod/config.yaml) under the `web-cron-*` keys.

### Pull Request needing benchmarks

When a pull request affect the performance of Vitess, one might wish to benchmark it before merging it. This can be done by setting the `Benchmark me` label to your pull request.
The corresponding CRON schedule will be used to start benchmarking the head commit of your pull request and to compare against the pull request's base.

## Website

The performances of Vitess can be observed throughout different releases, git SHAs, and nightly builds on arewefastyet's website at [https://benchmark.vitess.io](https://benchmark.vitess.io).

The website lets us:

* See previous benchmarks.
* Search results for a specific git SHA.
* Compare two results for two git SHAs.
* See micro and macro benchmarks results throughout different releases.
* Compare performance between VTGate's v3 planner and Gen4 planner.

## Read more

Read more in our [docs](docs/README.md) section.

## Architecture

![arewefastyet architecture](./docs/architecture/arewefastyet_architecture.png)

### SQL Schema
## SQL Schema
![arewefastyet schema](./docs/architecture/sql/arewefastyet_schema.png)
6 changes: 0 additions & 6 deletions ansible/create_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,8 @@
force: true

- name: Apply VSchema
when: vitess_version_name == 'latest'
shell: |
vtctlclient --server {{ groups['vtctld'][0] }}:15999 ApplyVSchema -- --vschema="$(cat /tmp/vschema_sysbench.json)" main
- name: Apply VSchema
when: vitess_version_name != 'latest'
shell: |
vtctlclient -server {{ groups['vtctld'][0] }}:15999 ApplyVSchema -vschema="$(cat /tmp/vschema_sysbench.json)" main
- name: Print go version
debug: msg="VSchema is applied."
2 changes: 1 addition & 1 deletion ansible/macrobench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
gateway_targets: "{% set targets = [] -%}{% for host in groups['vtgate'] -%}{% for gateway in hostvars[host]['gateways'] -%}{{ targets.append( hostvars[host]['ansible_default_ipv4']['address']+':'+ (gateway.port | default(15001) | string )) }}{% endfor -%}{% endfor -%}{{ targets }}"
vtctld_targets: "{% set targets = [] -%}{% for host in groups['vtctld'] -%}{{ targets.append( hostvars[host]['ansible_default_ipv4']['address']+':'+ (vtctld_port | default(15000) | string )) }}{% endfor -%}{{ targets }}"
node_targets: "{% set targets= [] -%}{% for host in groups['all'] -%}{{ targets.append( hostvars[host]['ansible_default_ipv4']['address']+':9100' ) }}{% endfor -%}{{ targets }}"
prometheus_skip_install: true
prometheus_skip_install: false
prometheus_targets:
tablets:
- targets: '{{ tablet_targets }}'
Expand Down
23 changes: 23 additions & 0 deletions ansible/roles/host/tasks/clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2023 The Vitess Authors.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
- name: Clean host
become: yes
become_user: root
block:
- name: Remove tmp directories
shell: |
rm -Rf /tmp/
mkdir /tmp
chmod 1777 /tmp
rm -Rf /root/.ansible/tmp/*
changed_when: false
8 changes: 7 additions & 1 deletion ansible/roles/vitess_build/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@

---

golang_gover: '1.19.4'
golang_gover: '1.21.3'
golang_hash_linux_amd64:
'1.18.7': 'sha256:6c967efc22152ce3124fc35cdf50fc686870120c5fd2107234d05d450a6105d8'
'1.19.3': 'sha256:74b9640724fd4e6bb0ed2a1bc44ae813a03f1e72a4c76253e2d5c015494430ba'
'1.19.4': 'sha256:c9c08f783325c4cf840a94333159cc937f05f75d36a8b307951d5bd959cf2ab8'
'1.20.1': 'sha256:000a5b1fca4f75895f78befeb2eecf10bfff3c428597f3f1e69133b63b911b02'
'1.20.2': 'sha256:4eaea32f59cde4dc635fbc42161031d13e1c780b87097f4b4234cfce671f1768'
'1.20.3': 'sha256:979694c2c25c735755bf26f4f45e19e64e4811d661dd07b8c010f7a8e18adfca'
'1.20.4': 'sha256:698ef3243972a51ddb4028e4a1ac63dc6d60821bf18e59a807e051fee0a385bd'
'1.21.1': 'sha256:b3075ae1ce5dab85f89bc7905d1632de23ca196bd8336afd93fa97434cfa55ae'
'1.21.3': 'sha256:1241381b2843fae5a9707eec1f8fb2ef94d827990582c7c7c32f5bdfbfd420c8'

vitess_git_repo: "https://github.com/vitessio/vitess.git"
vitess_git_version: "main"
Expand Down
Loading

0 comments on commit 818184d

Please sign in to comment.