github.com/letsencrypt/boulder@v0.20251208.0/test/vtcomboserver/run.sh (about)

     1  #!/bin/bash
     2  
     3  # Much of the below is adapted from upstream Vitess's vttestserver run.sh
     4  # but instead of using vttestserver, we use vtcombo directly:
     5  # https://github.com/vitessio/vitess/blob/v22.0.1/docker/vttestserver/run.sh
     6  
     7  # Copyright 2021 The Vitess Authors.
     8  #
     9  # Licensed under the Apache License, Version 2.0 (the "License");
    10  # you may not use this file except in compliance with the License.
    11  # You may obtain a copy of the License at
    12  #
    13  #     http://www.apache.org/licenses/LICENSE-2.0
    14  #
    15  # Unless required by applicable law or agreed to in writing, software
    16  # distributed under the License is distributed on an "AS IS" BASIS,
    17  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    18  # See the License for the specific language governing permissions and
    19  # limitations under the License.
    20  
    21  # Setup the Vschema Folder
    22  /vt/setup_vschema_folder.sh "$KEYSPACES" "$NUM_SHARDS"
    23  
    24  # Set the maximum connections in the cnf file
    25  # use 1000 as the default if it is unspecified
    26  if [[ -z $MYSQL_MAX_CONNECTIONS ]]; then
    27    MYSQL_MAX_CONNECTIONS=1000
    28  fi
    29  echo "max_connections = $MYSQL_MAX_CONNECTIONS" >> /vt/config/mycnf/test-suite.cnf
    30  
    31  # Delete socket files before running mysqlctld if exists.
    32  # This is the primary reason for unhealthy state on restart.
    33  # https://github.com/vitessio/vitess/pull/5115/files
    34  rm -vf "$VTDATAROOT"/"$tablet_dir"/{mysql.sock,mysql.sock.lock}
    35  
    36  # Kick off script to install trigger we use to simulate 
    37  # errors in our integration tests, in the background.
    38  /vt/install_trigger.sh &
    39  
    40  # Create Vitess JSON topo, start vtcombo and mysql. For more details see:
    41  #   - https://vitess.io/docs/22.0/reference/programs/vtcombo
    42  #   - https://github.com/vitessio/vitess/blob/v22.0.1/go/vt/vttest/vtprocess.go
    43  #   - https://github.com/vitessio/vitess/blob/v22.0.1/proto/vttest.proto
    44  /vt/bin/vtcombo \
    45    --port "${PORT:-33574}" \
    46    --bind-address "${VTCOMBO_BIND_HOST:-0.0.0.0}" \
    47    --mysql_server_bind_address "${MYSQL_SERVER_BIND_ADDRESS:-0.0.0.0}" \
    48    --mysql_server_port "${MYSQL_SERVER_PORT:-33577}" \
    49    --mysql_auth_server_impl "none" \
    50    --mysql_server_version "${MYSQL_SERVER_VERSION:-8.0.40-Vitess}" \
    51    --db_charset "${CHARSET:-utf8mb4}" \
    52    --foreign_key_mode "${FOREIGN_KEY_MODE:-allow}" \
    53    --enable_online_ddl \
    54    --enable_direct_ddl \
    55    --planner-version "${PLANNER_VERSION:-gen4}" \
    56    --vschema_ddl_authorized_users "${VSCHEMA_DDL_AUTH_USERS:-%}" \
    57    --tablet_refresh_interval "${TABLET_REFRESH_INTERVAL:-10s}" \
    58    --schema_dir "/vt/schema" \
    59    --queryserver-config-max-result-size "${QUERY_MAX_RESULT_SIZE:-1000000}" \
    60    --queryserver-config-warn-result-size "${QUERY_WARN_RESULT_SIZE:-1000000}" \
    61    --normalize_queries \
    62    --queryserver-config-pool-size 64 \
    63    --queryserver-config-stream-pool-size 200 \
    64    --queryserver-config-transaction-cap 80 \
    65    --queryserver-config-query-timeout 300s \
    66    --queryserver-config-schema-reload-time 60s \
    67    --queryserver-config-txpool-timeout 300s \
    68    --json_topo "$(printf '{"cells":["test"],"keyspaces":[%s]}' \
    69      "$(IFS=, read -ra ks <<< "${KEYSPACES}"; \
    70         for i in "${!ks[@]}"; do \
    71           printf '%s{"name":"%s","shards":[{"name":"0"}]}' \
    72             "$([ $i -gt 0 ] && echo ,)" "${ks[$i]}"; \
    73         done)")" \
    74    --start_mysql