Skip to content

Commit

Permalink
Merge pull request #6714 from planetscale/ss-oc5-operator
Browse files Browse the repository at this point in the history
orc: more changes
  • Loading branch information
sougou authored Sep 17, 2020
2 parents 10e42cb + 93d7efe commit ba71ee6
Show file tree
Hide file tree
Showing 35 changed files with 750 additions and 340 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ endif
install: build
# binaries
mkdir -p "$${PREFIX}/bin"
cp "$${VTROOT}/bin/"{mysqlctld,vtctld,vtctlclient,vtgate,vttablet,vtworker,vtbackup} "$${PREFIX}/bin/"
cp "$${VTROOT}/bin/"{mysqlctld,orchestrator,vtctld,vtctlclient,vtgate,vttablet,vtworker,vtbackup} "$${PREFIX}/bin/"

# install copies the files needed to run test Vitess using vtcombo into the given directory tree.
# Usage: make install PREFIX=/path/to/install/root
Expand Down
6 changes: 1 addition & 5 deletions config/orchestrator/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,5 @@
"MySQLTopologyPassword": "orc_client_user_password",
"MySQLReplicaUser": "vt_repl",
"MySQLReplicaPassword": "",
"BackendDB": "sqlite",
"SQLite3DataFile": "/home/sougou/dev/src/vitess.io/vitess/vtdataroot/orchestrator.sqlite3",
"RecoverMasterClusterFilters": ["*"],
"RecoveryPeriodBlockSeconds": 1,
"DelayMasterPromotionIfSQLThreadNotUpToDate": true
"RecoveryPeriodBlockSeconds": 5
}
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:mariadb103 AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -51,6 +48,7 @@ ENV MYSQL_FLAVOR MariaDB103

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.mariadb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:mariadb AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -51,6 +48,7 @@ ENV MYSQL_FLAVOR MariaDB

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.mariadb103
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:mariadb103 AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -51,6 +48,7 @@ ENV MYSQL_FLAVOR MariaDB103

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.mysql56
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:mysql56 AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -50,6 +47,7 @@ ENV PATH $VTROOT/bin:$PATH

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.mysql57
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:mysql57 AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -50,6 +47,7 @@ ENV PATH $VTROOT/bin:$PATH

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.mysql80
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:mysql80 AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -51,6 +48,7 @@ ENV MYSQL_FLAVOR MySQL80

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.percona
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:percona AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -50,6 +47,7 @@ ENV PATH $VTROOT/bin:$PATH

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.percona57
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:percona57 AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -50,6 +47,7 @@ ENV PATH $VTROOT/bin:$PATH

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.percona80
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:percona80 AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -51,6 +48,7 @@ ENV MYSQL_FLAVOR MySQL80

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.testing
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:mysql57 AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -50,6 +47,7 @@ ENV PATH $VTROOT/bin:$PATH

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

# Create mount point for actual data (e.g. MySQL data dir)
VOLUME /vt/vtdataroot
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.ubi7.mysql57
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:mysql57 AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -84,6 +81,7 @@ ENV PATH $VTROOT/bin:$PATH

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

RUN mkdir -p /licenses
COPY LICENSE /licenses
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.ubi7.mysql80
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:mysql80 AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -85,6 +82,7 @@ ENV MYSQL_FLAVOR MySQL80

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

RUN mkdir -p /licenses
COPY LICENSE /licenses
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.ubi7.percona57
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:percona57 AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -75,6 +72,7 @@ ENV PATH $VTROOT/bin:$PATH

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

RUN mkdir -p /licenses
COPY LICENSE /licenses
Expand Down
4 changes: 1 addition & 3 deletions docker/lite/Dockerfile.ubi7.percona80
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Use a temporary layer for the build stage.
FROM vitess/bootstrap:percona80 AS builder

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

Expand Down Expand Up @@ -80,6 +77,7 @@ ENV MYSQL_FLAVOR MySQL80

# Copy artifacts from builder layer.
COPY --from=builder --chown=vitess:vitess /vt/install /vt
COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/orchestrator /vt/web/orchestrator

RUN mkdir -p /licenses
COPY LICENSE /licenses
Expand Down
57 changes: 57 additions & 0 deletions examples/local/orc_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

# Copyright 2020 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.

# this script brings up zookeeper and all the vitess components
# required for a single shard deployment.

source ./env.sh

# start topo server
if [ "${TOPO}" = "zk2" ]; then
CELL=zone1 ./scripts/zk-up.sh
elif [ "${TOPO}" = "k8s" ]; then
CELL=zone1 ./scripts/k3s-up.sh
else
CELL=zone1 ./scripts/etcd-up.sh
fi

# start vtctld
CELL=zone1 ./scripts/vtctld-up.sh

vtctlclient AddCellInfo -root /vitess/zone2 -server_address "${ETCD_SERVER}" zone2

# start vttablets for keyspace commerce
for i in 100 101 102; do
CELL=zone1 TABLET_UID=$i ./scripts/mysqlctl-up.sh
CELL=zone1 KEYSPACE=commerce TABLET_UID=$i ./scripts/ovttablet-up.sh
done

for i in 110 111; do
CELL=zone2 TABLET_UID=$i ./scripts/mysqlctl-up.sh
CELL=zone2 KEYSPACE=commerce TABLET_UID=$i ./scripts/ovttablet-up.sh
done

# set one of the replicas to master
#vtctlclient InitShardMaster -force commerce/0 zone1-100

# create the schema
#vtctlclient ApplySchema -sql-file create_commerce_schema.sql commerce

# create the vschema
#vtctlclient ApplyVSchema -vschema_file vschema_commerce_initial.json commerce

# start vtgate
CELL=zone1 ./scripts/vtgate-up.sh
69 changes: 69 additions & 0 deletions examples/local/scripts/ovttablet-up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

# Copyright 2020 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.

source ./env.sh

cell=${CELL:-'test'}
keyspace=${KEYSPACE:-'test_keyspace'}
shard=${SHARD:-'0'}
uid=$TABLET_UID
mysql_port=$[17000 + $uid]
port=$[15000 + $uid]
grpc_port=$[16000 + $uid]
printf -v alias '%s-%010d' $cell $uid
printf -v tablet_dir 'vt_%010d' $uid
tablet_hostname=''
printf -v tablet_logfile 'vttablet_%010d_querylog.txt' $uid

tablet_type=replica
if [[ "${uid: -1}" -gt 1 ]]; then
tablet_type=rdonly
fi

echo "Starting vttablet for $alias..."
# shellcheck disable=SC2086
vttablet \
$TOPOLOGY_FLAGS \
-log_dir $VTDATAROOT/tmp \
-log_queries_to_file $VTDATAROOT/tmp/$tablet_logfile \
-tablet-path $alias \
-tablet_hostname "$tablet_hostname" \
-init_keyspace $keyspace \
-init_shard $shard \
-init_tablet_type $tablet_type \
-health_check_interval 5s \
-enable_replication_reporter \
-backup_storage_implementation file \
-file_backup_storage_root $VTDATAROOT/backups \
-restore_from_backup \
-port $port \
-grpc_port $grpc_port \
-service_map 'grpc-queryservice,grpc-tabletmanager,grpc-updatestream' \
-pid_file $VTDATAROOT/$tablet_dir/vttablet.pid \
-vtctld_addr http://$hostname:$vtctld_web_port/ \
-disable_active_reparents \
> $VTDATAROOT/$tablet_dir/vttablet.out 2>&1 &

# Block waiting for the tablet to be listening
# Not the same as healthy

for i in $(seq 0 300); do
curl -I "http://$hostname:$port/debug/status" >/dev/null 2>&1 && break
sleep 0.1
done

# check one last time
curl -I "http://$hostname:$port/debug/status" || fail "tablet could not be started!"
Loading

0 comments on commit ba71ee6

Please sign in to comment.