diff --git a/Makefile b/Makefile index c78f12d2b56..eff9f7cf003 100644 --- a/Makefile +++ b/Makefile @@ -331,9 +331,6 @@ docker_local: docker_run_local: ./docker/local/run.sh -docker_mini: - ${call build_docker_image,docker/mini/Dockerfile,vitess/mini} - DOCKER_VTTESTSERVER_SUFFIX = mysql57 mysql80 DOCKER_VTTESTSERVER_TARGETS = $(addprefix docker_vttestserver_,$(DOCKER_VTTESTSERVER_SUFFIX)) $(DOCKER_VTTESTSERVER_TARGETS): docker_vttestserver_%: diff --git a/docker/k8s/Dockerfile b/docker/k8s/Dockerfile deleted file mode 100644 index 30ff33952bc..00000000000 --- a/docker/k8s/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2019 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. - -ARG VT_BASE_VER=latest -ARG DEBIAN_VER=stable-slim - -FROM vitess/base:${VT_BASE_VER} AS base - -FROM debian:${DEBIAN_VER} - -# TODO: remove when https://github.com/vitessio/vitess/issues/3553 is fixed -RUN apt-get update && \ - apt-get upgrade -qq && \ - apt-get install default-mysql-client -qq --no-install-recommends && \ - apt-get autoremove && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -# Set up Vitess environment (just enough to run pre-built Go binaries) -ENV VTROOT /vt/src/vitess.io/vitess -ENV VTDATAROOT /vtdataroot - -# Prepare directory structure. -RUN mkdir -p /vt && \ - mkdir -p /vt/bin && \ - mkdir -p /vt/config && \ - mkdir -p /vt/web && \ - mkdir -p /vtdataroot/tabletdata - -# Copy CA certs for https calls -COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt - -# Copy binaries -COPY --from=base /vt/bin/mysqlctld /vt/bin/ -COPY --from=base /vt/bin/mysqlctl /vt/bin/ -COPY --from=base /vt/bin/vtctld /vt/bin/ -COPY --from=base /vt/bin/vtctl /vt/bin/ -COPY --from=base /vt/bin/vtctlclient /vt/bin/ -COPY --from=base /vt/bin/vtgate /vt/bin/ -COPY --from=base /vt/bin/vttablet /vt/bin/ -COPY --from=base /vt/bin/vtbackup /vt/bin/ -COPY --from=base /vt/bin/vtadmin /vt/bin/ - -# copy web admin files -COPY --from=base $VTROOT/web /vt/web/ - -# copy vitess config -COPY --from=base $VTROOT/config/init_db.sql /vt/config/ - -# my.cnf include files -COPY --from=base $VTROOT/config/mycnf /vt/config/mycnf - -# add vitess user and add permissions -RUN groupadd -r --gid 2000 vitess && useradd -r -g vitess --uid 1000 vitess && \ - chown -R vitess:vitess /vt; diff --git a/docker/k8s/logrotate/Dockerfile b/docker/k8s/logrotate/Dockerfile deleted file mode 100644 index a6054b78a26..00000000000 --- a/docker/k8s/logrotate/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2019 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. - -ARG DEBIAN_VER=stable-slim - -FROM debian:${DEBIAN_VER} - -COPY logrotate.conf /vt/logrotate.conf - -COPY rotate.sh /vt/rotate.sh - -RUN mkdir -p /vt && \ - apt-get update && \ - apt-get upgrade -qq && \ - apt-get install logrotate -qq --no-install-recommends && \ - apt-get autoremove -qq && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* && \ - groupadd -r --gid 2000 vitess && \ - useradd -r -g vitess --uid 1000 vitess && \ - chown -R vitess:vitess /vt && \ - chmod +x /vt/rotate.sh - -ENTRYPOINT [ "/vt/rotate.sh" ] diff --git a/docker/k8s/logrotate/logrotate.conf b/docker/k8s/logrotate/logrotate.conf deleted file mode 100644 index 7f39d6d337a..00000000000 --- a/docker/k8s/logrotate/logrotate.conf +++ /dev/null @@ -1,13 +0,0 @@ -/vtdataroot/tabletdata/*.log { - create 660 vitess vitess - daily - size 100M - rotate 1 - missingok - nocompress - notifempty - sharedscripts - postrotate - /usr/bin/mysql --socket=/vtdataroot/tabletdata/mysql.sock -uroot -e 'select @@global.long_query_time into @lqt_save; set global long_query_time=2000; select sleep(2); FLUSH LOGS; select sleep(2); set global long_query_time=@lqt_save;' - endscript -} diff --git a/docker/k8s/logrotate/rotate.sh b/docker/k8s/logrotate/rotate.sh deleted file mode 100644 index bbce1c3dd1e..00000000000 --- a/docker/k8s/logrotate/rotate.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# Copyright 2019 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. - -set -ex - -# SIGTERM-handler -term_handler() { - exit; -} - -# setup handlers -# on callback, kill the last background process, which is `tail -f /dev/null` and execute the specified handler -trap 'kill ${!}; term_handler' SIGINT SIGTERM SIGHUP - -# wait forever -while true -do - /usr/sbin/logrotate -s /vt/logrotate.status /vt/logrotate.conf - # run once an hour - sleep 3600 & wait ${!} -done \ No newline at end of file diff --git a/docker/k8s/logtail/Dockerfile b/docker/k8s/logtail/Dockerfile deleted file mode 100644 index b64fe5b3b6f..00000000000 --- a/docker/k8s/logtail/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2019 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. - -ARG DEBIAN_VER=stable-slim - -FROM debian:${DEBIAN_VER} - -ENV TAIL_FILEPATH /dev/null - -COPY tail.sh /vt/tail.sh - -RUN mkdir -p /vt && \ - apt-get update && \ - apt-get upgrade -qq && \ - apt-get install default-mysql-client -qq --no-install-recommends && \ - apt-get autoremove -qq && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* && \ - groupadd -r --gid 2000 vitess && \ - useradd -r -g vitess --uid 1000 vitess && \ - chown -R vitess:vitess /vt && \ - chmod +x /vt/tail.sh - -ENTRYPOINT [ "/vt/tail.sh" ] diff --git a/docker/k8s/logtail/tail.sh b/docker/k8s/logtail/tail.sh deleted file mode 100644 index 1ff75b6556b..00000000000 --- a/docker/k8s/logtail/tail.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# Copyright 2019 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. - -set -ex - -# SIGTERM-handler -term_handler() { - # block shutting down log tailers until mysql shuts down first - until [ "$MYSQL_GONE" ]; do - sleep 5 - - # poll every 5 seconds to see if mysql is still running - if ! mysqladmin ping -uroot --socket=/vtdataroot/tabletdata/mysql.sock; then - MYSQL_GONE=true - fi - done - - exit; -} - -# setup handlers -# on callback, kill the last background process and execute the specified handler -trap 'kill ${!}; term_handler' SIGINT SIGTERM SIGHUP - -# wait forever -while true -do - tail -n+1 -F "$TAIL_FILEPATH" & wait ${!} -done \ No newline at end of file diff --git a/docker/k8s/mysqlctl/Dockerfile b/docker/k8s/mysqlctl/Dockerfile deleted file mode 100644 index 6c449552354..00000000000 --- a/docker/k8s/mysqlctl/Dockerfile +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2019 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. - -ARG VT_BASE_VER=latest -ARG DEBIAN_VER=stable-slim - -FROM vitess/k8s:${VT_BASE_VER} AS k8s - -FROM debian:${DEBIAN_VER} - -# Set up Vitess environment (just enough to run pre-built Go binaries) -ENV VTROOT /vt -ENV VTDATAROOT /vtdataroot - -# Prepare directory structure. -RUN mkdir -p /vt/bin && \ - mkdir -p /vt/config && mkdir -p /vtdataroot - -# Copy binaries -COPY --from=k8s /vt/bin/mysqlctl /vt/bin/ - -# Copy certs to allow https calls -COPY --from=k8s /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt - -# copy vitess config -COPY --from=k8s /vt/config /vt/config - -# add vitess user/group and add permissions -RUN groupadd -r --gid 2000 vitess && \ - useradd -r -g vitess --uid 1000 vitess && \ - chown -R vitess:vitess /vt && \ - chown -R vitess:vitess /vtdataroot diff --git a/docker/k8s/mysqlctld/Dockerfile b/docker/k8s/mysqlctld/Dockerfile deleted file mode 100644 index 6fdb30f012a..00000000000 --- a/docker/k8s/mysqlctld/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2019 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. - -ARG VT_BASE_VER=latest -ARG DEBIAN_VER=stable-slim - -FROM vitess/k8s:${VT_BASE_VER} AS k8s - -FROM debian:${DEBIAN_VER} - -RUN apt-get update && \ - apt-get upgrade -qq && \ - apt-get install busybox -qq --no-install-recommends && \ - apt-get autoremove && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -# Set up Vitess environment (just enough to run pre-built Go binaries) -ENV VTROOT /vt -ENV VTDATAROOT /vtdataroot - -# Prepare directory structure. -RUN mkdir -p /vt/bin && \ - mkdir -p /vt/config && mkdir -p /vtdataroot - -# Copy binaries -COPY --from=k8s /vt/bin/mysqlctld /vt/bin/ - -# Copy certs to allow https calls -COPY --from=k8s /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt - -# copy vitess config -COPY --from=k8s /vt/config /vt/config - -# add vitess user/group and add permissions -RUN groupadd -r --gid 2000 vitess && \ - useradd -r -g vitess --uid 1000 vitess && \ - chown -R vitess:vitess /vt && \ - chown -R vitess:vitess /vtdataroot diff --git a/docker/k8s/vtadmin/Dockerfile b/docker/k8s/vtadmin/Dockerfile deleted file mode 100644 index 837ac8a525a..00000000000 --- a/docker/k8s/vtadmin/Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright 2022 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. - -ARG VT_BASE_VER=latest -ARG DEBIAN_VER=bullseye-slim - -FROM vitess/k8s:${VT_BASE_VER} AS k8s - -FROM node:16-${DEBIAN_VER} as node - -# Prepare directory structure. -RUN mkdir -p /vt/web - -# copy web admin files -COPY --from=k8s /vt/web/vtadmin /vt/web/vtadmin - -# install/build/clean web dependencies -RUN npm --prefix /vt/web/vtadmin ci && \ - npm run --prefix /vt/web/vtadmin build - -FROM nginxinc/nginx-unprivileged:1.22 AS nginx - -ENV VTADMIN_WEB_PORT=14201 - -# Set up Vitess environment (just enough to run pre-built Go binaries) -ENV VTROOT /vt - -# Copy binaries -COPY --from=k8s /vt/bin/vtadmin /vt/bin/ - -# Copy certs to allow https calls -COPY --from=k8s /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt - -COPY --chown=nginx --from=node /vt/web/vtadmin/build /var/www/ -COPY --chown=nginx default.conf /etc/nginx/templates/default.conf.template - -# command to run nginx is in the base image -# https://github.com/nginxinc/docker-nginx-unprivileged/blob/main/stable/alpine/Dockerfile#L150 diff --git a/docker/k8s/vtadmin/default.conf b/docker/k8s/vtadmin/default.conf deleted file mode 100644 index 25584e86a3b..00000000000 --- a/docker/k8s/vtadmin/default.conf +++ /dev/null @@ -1,39 +0,0 @@ -server { - gzip on; - gzip_min_length 256; - gzip_http_version 1.1; - gzip_types - application/atom+xml - application/geo+json - application/javascript - application/x-javascript - application/json - application/ld+json - application/manifest+json - application/rdf+xml - application/rss+xml - application/xhtml+xml - application/xml - font/eot - font/otf - font/ttf - image/svg+xml - text/css - text/javascript - text/plain - text/xml; - listen ${VTADMIN_WEB_PORT}; - root /var/www; - location ~ config\.js { - expires off; - add_header Cache-Control no-store; - } - location ~* \.(css|js)$ { - expires max; - add_header Cache-Control public; - } - location / { - client_max_body_size 50M; - try_files $uri /index.html; - } -} diff --git a/docker/k8s/vtbackup/Dockerfile b/docker/k8s/vtbackup/Dockerfile deleted file mode 100644 index 4a8b3be9d52..00000000000 --- a/docker/k8s/vtbackup/Dockerfile +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2019 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. - -ARG VT_BASE_VER=latest -ARG DEBIAN_VER=stable-slim - - -FROM vitess/k8s:${VT_BASE_VER} AS k8s - -FROM debian:${DEBIAN_VER} - -# Set up Vitess environment (just enough to run pre-built Go binaries) -ENV VTROOT /vt -ENV VTDATAROOT /vtdataroot - -# Prepare directory structure. -RUN mkdir -p /vt/bin && mkdir -p /vtdataroot - -# Copy binaries -COPY --from=k8s /vt/bin/vtbackup /vt/bin/ - -# Copy certs to allow https calls -COPY --from=k8s /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt - -# Copy vitess config -COPY --from=k8s /vt/config /vt/config - -# add vitess user/group and add permissions -RUN groupadd -r --gid 2000 vitess && \ - useradd -r -g vitess --uid 1000 vitess && \ - chown -R vitess:vitess /vt && \ - chown -R vitess:vitess /vtdataroot diff --git a/docker/k8s/vtctl/Dockerfile b/docker/k8s/vtctl/Dockerfile deleted file mode 100644 index cce3b6dc63c..00000000000 --- a/docker/k8s/vtctl/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2019 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. - -ARG VT_BASE_VER=latest -ARG DEBIAN_VER=stable-slim - -FROM vitess/k8s:${VT_BASE_VER} AS k8s - -FROM debian:${DEBIAN_VER} - -# Set up Vitess environment (just enough to run pre-built Go binaries) -ENV VTROOT /vt - -# Prepare directory structure. -RUN mkdir -p /vt/bin && mkdir -p /vtdataroot - -# Copy certs to allow https calls -COPY --from=k8s /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt - -# Copy binaries -COPY --from=k8s /vt/bin/vtctl /vt/bin/ - -# add vitess user/group and add permissions -RUN groupadd -r --gid 2000 vitess && \ - useradd -r -g vitess --uid 1000 vitess && \ - chown -R vitess:vitess /vt && \ - chown -R vitess:vitess /vtdataroot diff --git a/docker/k8s/vtctlclient/Dockerfile b/docker/k8s/vtctlclient/Dockerfile deleted file mode 100644 index 17eab700eb4..00000000000 --- a/docker/k8s/vtctlclient/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2019 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. - -ARG VT_BASE_VER=latest -ARG DEBIAN_VER=stable-slim - -FROM vitess/k8s:${VT_BASE_VER} AS k8s - -FROM debian:${DEBIAN_VER} - -RUN apt-get update && \ - apt-get upgrade -qq && \ - apt-get install jq curl -qq --no-install-recommends && \ - apt-get autoremove && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -COPY --from=k8s /vt/bin/vtctlclient /usr/bin/ - -# add vitess user/group and add permissions -RUN groupadd -r --gid 2000 vitess && \ - useradd -r -g vitess --uid 1000 vitess - -CMD ["/usr/bin/vtctlclient"] diff --git a/docker/k8s/vtctld/Dockerfile b/docker/k8s/vtctld/Dockerfile deleted file mode 100644 index 5daaf929486..00000000000 --- a/docker/k8s/vtctld/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2019 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. - -ARG VT_BASE_VER=latest -ARG DEBIAN_VER=stable-slim - -FROM vitess/k8s:${VT_BASE_VER} AS k8s - -FROM debian:${DEBIAN_VER} - -# Set up Vitess environment (just enough to run pre-built Go binaries) -ENV VTROOT /vt - -# Prepare directory structure. -RUN mkdir -p /vt/bin && \ - mkdir -p /vt/web && mkdir -p /vtdataroot - -# Copy binaries -COPY --from=k8s /vt/bin/vtctld /vt/bin/ - -# Copy certs to allow https calls -COPY --from=k8s /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt - -# copy web admin files -COPY --from=k8s /vt/web /vt/web - -# add vitess user/group and add permissions -RUN groupadd -r --gid 2000 vitess && \ - useradd -r -g vitess --uid 1000 vitess && \ - chown -R vitess:vitess /vt && \ - chown -R vitess:vitess /vtdataroot diff --git a/docker/k8s/vtexplain/Dockerfile b/docker/k8s/vtexplain/Dockerfile deleted file mode 100644 index fb2f375d41c..00000000000 --- a/docker/k8s/vtexplain/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2019 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. - -ARG VT_BASE_VER=latest -ARG DEBIAN_VER=stable-slim - -FROM vitess/base:${VT_BASE_VER} AS base - -FROM debian:${DEBIAN_VER} - -# Set up Vitess environment (just enough to run pre-built Go binaries) -ENV VTROOT /vt - -# Prepare directory structure. -RUN mkdir -p /vt/bin && mkdir -p /vtdataroot - -# Copy binaries -COPY --from=base /vt/bin/vtexplain /vt/bin/ - -# add vitess user/group and add permissions -RUN groupadd -r --gid 2000 vitess && \ - useradd -r -g vitess --uid 1000 vitess && \ - chown -R vitess:vitess /vt && \ - chown -R vitess:vitess /vtdataroot diff --git a/docker/k8s/vtgate/Dockerfile b/docker/k8s/vtgate/Dockerfile deleted file mode 100644 index 3829227e2fa..00000000000 --- a/docker/k8s/vtgate/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2019 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. - -ARG VT_BASE_VER=latest -ARG DEBIAN_VER=stable-slim - -FROM vitess/k8s:${VT_BASE_VER} AS k8s - -FROM debian:${DEBIAN_VER} - -# Set up Vitess environment (just enough to run pre-built Go binaries) -ENV VTROOT /vt - -# Prepare directory structure. -RUN mkdir -p /vt/bin && mkdir -p /vtdataroot - -# Copy certs to allow https calls -COPY --from=k8s /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt - -# Copy binaries -COPY --from=k8s /vt/bin/vtgate /vt/bin/ - -# add vitess user/group and add permissions -RUN groupadd -r --gid 2000 vitess && \ - useradd -r -g vitess --uid 1000 vitess && \ - chown -R vitess:vitess /vt && \ - chown -R vitess:vitess /vtdataroot diff --git a/docker/k8s/vttablet/Dockerfile b/docker/k8s/vttablet/Dockerfile deleted file mode 100644 index 95453a69771..00000000000 --- a/docker/k8s/vttablet/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2019 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. - -ARG VT_BASE_VER=latest -ARG DEBIAN_VER=stable-slim - -FROM vitess/k8s:${VT_BASE_VER} AS k8s - -FROM debian:${DEBIAN_VER} - -# TODO: remove when https://github.com/vitessio/vitess/issues/3553 is fixed -RUN apt-get update && \ - apt-get upgrade -qq && \ - apt-get install wget default-mysql-client jq curl -qq --no-install-recommends && \ - apt-get autoremove && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -# Set up Vitess environment (just enough to run pre-built Go binaries) -ENV VTROOT /vt -ENV VTDATAROOT /vtdataroot - -# Prepare directory structure. -RUN mkdir -p /vt/bin && mkdir -p /vtdataroot - -# Copy binaries -COPY --from=k8s /vt/bin/vttablet /vt/bin/ -COPY --from=k8s /vt/bin/vtctlclient /vt/bin/ - -# Copy certs to allow https calls -COPY --from=k8s /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt - -# add vitess user/group and add permissions -RUN groupadd -r --gid 2000 vitess && \ - useradd -r -g vitess --uid 1000 vitess && \ - chown -R vitess:vitess /vt && \ - chown -R vitess:vitess /vtdataroot diff --git a/docker/mini/Dockerfile b/docker/mini/Dockerfile deleted file mode 100644 index f9c14932eb0..00000000000 --- a/docker/mini/Dockerfile +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright 2019 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. - -# NOTE: We have to build the Vitess binaries from scratch instead of sharing -# a base image because Docker Hub dropped the feature we relied upon to -# ensure images contain the right binaries. - -# Use a temporary layer for the build stage. -FROM vitess/base AS base - -FROM vitess/lite - -USER root - -RUN apt-get update -RUN apt-get install -y sudo curl vim python3 jq sqlite3 -RUN ln -s /usr/bin/python3 /usr/bin/python - -# Install minivitess dependencies -COPY docker/mini/install_mini_dependencies.sh /vt/dist/install_mini_dependencies.sh -RUN /vt/dist/install_mini_dependencies.sh - -COPY docker/mini/orchestrator-vitess-mini.conf.json /etc/orchestrator.conf.json -RUN chown vitess:vitess /etc/orchestrator.conf.json - -COPY docker/mini/docker-entry /vt/dist/docker/mini/docker-entry -COPY examples/common/scripts /vt/dist/scripts -COPY examples/common/env.sh /vt/dist/scripts/env.sh -COPY examples/common/lib/utils.sh /vt/dist/scripts/lib/utils.sh -COPY docker/mini/vtctld-mini-up.sh /vt/dist/scripts/vtctld-mini-up.sh -COPY docker/mini/vttablet-mini-up.sh /vt/dist/scripts/vttablet-mini-up.sh -COPY docker/mini/orchestrator-up.sh /vt/dist/scripts/orchestrator-up.sh -RUN echo "hostname=127.0.0.1" >> /vt/dist/scripts/env.sh -RUN cat /vt/dist/scripts/env.sh | egrep "^alias" >> /etc/bash.bashrc - -COPY --from=base /vt/bin/vtctl /vt/bin/ -COPY --from=base /vt/bin/mysqlctl /vt/bin/ - -# Set up Vitess environment (just enough to run pre-built Go binaries) -ENV VTROOT /vt/src/vitess.io/vitess -ENV VTDATAROOT /vt/vtdataroot -ENV PATH $VTROOT/bin:$PATH -ENV PATH="/vt/bin:${PATH}" -ENV PATH="/var/opt/etcd:${PATH}" -ENV TOPO="etcd" - -# Create mount point for actual data (e.g. MySQL data dir) -VOLUME /vt/vtdataroot -USER vitess -EXPOSE 15000-15200 16000-16200 -CMD /vt/dist/docker/mini/docker-entry && /bin/bash diff --git a/docker/mini/docker-entry b/docker/mini/docker-entry deleted file mode 100755 index 715b2128556..00000000000 --- a/docker/mini/docker-entry +++ /dev/null @@ -1,132 +0,0 @@ -#!/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 probes for an existing MySQL topologies and sets up a mini vitess setup matching that topology. -# - -echo_sleep() { - local SECONDS="$1" - for i in $(seq 1 $SECONDS) ; do - echo -n "." - sleep 1 - done - echo -} - -echo_header() { - local HEADER="$1" - echo "" - echo "# $HEADER" -} - -SCRIPTS_PATH="/vt/dist/scripts" -export CELL=${CELL:-zone1} -export $TOPOLOGY_USER -export $TOPOLOGY_PASSWORD - - -cat <<- "EOF" -============================================= - -| \/ (_)_ __ (_) \ / (_) |_ ___ ___ ___ -| |\/| | | '_ \| |\ \ / /| | __/ _ \/ __/ __| -| | | | | | | | | \ V / | | || __/\__ \__ \ -|_| |_|_|_| |_|_| \_/ |_|\__\___||___/___/ - -============================================= -EOF - -if [ -z "$MYSQL_SCHEMA" ] ; then - echo "Expected MYSQL_SCHEMA environment variable" - exit 1 -fi -if [ -z "$TOPOLOGY_SERVER" ] ; then - echo "TOPOLOGY_SERVER environment variable not found. You must specify a MySQL server within your topology." - echo "This mini-vitess setup will attempt to discover your topology using that server and will bootstrap to match your topology" - exit 1 -fi -if [ -z "$TOPOLOGY_USER" ] ; then - echo "TOPOLOGY_USER environment variable not found. You must specify a MySQL username accessible to vitess." - exit 1 -fi -if [ -z "$TOPOLOGY_PASSWORD" ] ; then - echo "TOPOLOGY_PASSWORD environment variable not found. You must specify a MySQL password accessible to vitess." - exit 1 -fi - -echo "MiniVitess is starting up..." -echo "- Given MySQL topology server: $TOPOLOGY_SERVER" -echo "- Given MySQL schema: $MYSQL_SCHEMA" - -cd $SCRIPTS_PATH - -source ./env.sh - -echo_header "orchestrator" -./orchestrator-up.sh -echo "- orchestrator will meanwhile probe and map your MySQL replication topology" - -echo_header "etcd" -./etcd-up.sh - -echo_header "vtctld" -./vtctld-mini-up.sh - -echo_header "Waiting for topology to be detected and analyzed" -echo_sleep 15 - -echo_header "orchestrator has detected the following MySQL servers:" -orchestrator-client -c all-instances - -echo_header "Bootstrapping vttablets for the above instances..." - -BASE_TABLET_UID=100 -for i in $(orchestrator-client -c all-instances) ; do - read -r mysql_host mysql_port <<<$(echo $i | tr ':' ' ') - - is_primary="" - if [ "$i" == "$(orchestrator-client -c which-cluster-master -i "$i")" ] ; then - is_primary="true" - fi - - KEYSPACE=$MYSQL_SCHEMA TABLET_UID=$BASE_TABLET_UID ./vttablet-mini-up.sh "$mysql_host" "$mysql_port" "$is_primary" - BASE_TABLET_UID=$((BASE_TABLET_UID + 1)) -done - -echo_header "vtgate" -./vtgate-up.sh - -echo_header "Setup complete" - -echo_header "Your topology is:" -orchestrator-client -c topology-tabulated -i ${TOPOLOGY_SERVER} | tr '|' ' ' - -echo_header "vtgate is listening for MySQL connection on port 15306" - -echo_header "On this container, try running any of the following commands:" -echo " mysql ${MYSQL_SCHEMA} -e 'show tables'" -echo " mysql ${MYSQL_SCHEMA}@primary -e 'select @@hostname, @@port'" -echo " mysql ${MYSQL_SCHEMA}@replica -e 'select @@hostname, @@port'" - -echo_header "Outside this container, try running any of the following commands:" -echo " mysql -h $(hostname) --port=15306 ${MYSQL_SCHEMA} -e 'show tables'" -echo " mysql -h $(hostname) --port=15306 ${MYSQL_SCHEMA}@primary -e 'select @@hostname, @@port'" -echo " mysql -h $(hostname) --port=15306 ${MYSQL_SCHEMA}@replica -e 'select @@hostname, @@port'" - -echo_header "Ready" - -echo "" - diff --git a/docker/mini/install_mini_dependencies.sh b/docker/mini/install_mini_dependencies.sh deleted file mode 100755 index 03a97cc0962..00000000000 --- a/docker/mini/install_mini_dependencies.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# This is a script that gets run as part of the Dockerfile build -# to install dependencies for the vitess/mini image. -# -# Usage: install_mini_dependencies.sh - -set -euo pipefail - -# Install etcd -ETCD_VER=v3.4.9 -DOWNLOAD_URL=https://storage.googleapis.com/etcd - -curl -k -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -mkdir -p /var/opt/etcd -sudo tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /var/opt/etcd --strip-components=1 -rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz - -mkdir -p /var/run/etcd && chown -R vitess:vitess /var/run/etcd - -# Install orchestrator -curl -k -L https://github.com/openark/orchestrator/releases/download/v3.2.2/orchestrator_3.2.2_amd64.deb -o /tmp/orchestrator.deb -dpkg -i /tmp/orchestrator.deb -rm -f /tmp/orchestrator.deb -cp /usr/local/orchestrator/resources/bin/orchestrator-client /usr/bin - -# Clean up files we won't need in the final image. -rm -rf /var/lib/apt/lists/* diff --git a/docker/mini/run.sh b/docker/mini/run.sh deleted file mode 100755 index 860df0bab3a..00000000000 --- a/docker/mini/run.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# -# Run a MiniVitess docker image, with details and credentials for a MySQL replication topology -# - -TOPOLOGY_SERVER="" -MYSQL_SCHEMA="" -TOPOLOGY_USER="" -TOPOLOGY_PASSWORD="" - -help() { -cat <<- "EOF" -Usage: - docker/mini/run.sh - -Mandatory options: - -s : in hostname[:port] format; a single MySQL server in your replication - topology from which MiniVitess will discover your entire topology - -d : database/schema name on your MySQL server. A single schema is supported. - -u : MySQL username with enough privileges for Vitess to run DML, and for - orchestrator to probe replication - -p : password for given user -EOF - exit 1 -} - -error_help() { - local message="$1" - echo "ERROR: $message" - help -} - -while getopts "s:d:u:p:h" OPTION -do - case $OPTION in - h) help ;; - s) TOPOLOGY_SERVER="$OPTARG" ;; - d) MYSQL_SCHEMA="$OPTARG" ;; - u) TOPOLOGY_USER="$OPTARG" ;; - p) TOPOLOGY_PASSWORD="$OPTARG" ;; - *) help ;; - esac -done - -if [ -z "$TOPOLOGY_SERVER" ] ; then - error_help "Expected topology server" -fi -if [ -z "$MYSQL_SCHEMA" ] ; then - error_help "Expected MySQL schema/database name" -fi -if [ -z "$TOPOLOGY_USER" ] ; then - error_help "Expected MySQL user" -fi -if [ -z "$TOPOLOGY_PASSWORD" ] ; then - error_help "Expected MySQL password" -fi - -docker run --rm -it -p 3000:3000 -p 15000:15000 -p 15001:15001 -e "TOPOLOGY_SERVER=$TOPOLOGY_SERVER" -e "TOPOLOGY_USER=$TOPOLOGY_USER" -e "TOPOLOGY_PASSWORD=$TOPOLOGY_PASSWORD" -e "MYSQL_SCHEMA=$MYSQL_SCHEMA" --network=host vitess/mini:latest diff --git a/docker/mini/vtctld-mini-up.sh b/docker/mini/vtctld-mini-up.sh deleted file mode 100755 index 641763ab016..00000000000 --- a/docker/mini/vtctld-mini-up.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# Copyright 2019 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 is an example script that starts vtctld. - -source ./env.sh - -cell=${CELL:-'test'} -grpc_port=15999 - -echo "- Starting vtctld..." -# shellcheck disable=SC2086 -vtctld \ - $TOPOLOGY_FLAGS \ - --disable_active_reparents \ - -cell $cell \ - -service_map 'grpc-vtctl' \ - -backup_storage_implementation file \ - -file_backup_storage_root $VTDATAROOT/backups \ - -log_dir $VTDATAROOT/tmp \ - -port $vtctld_web_port \ - -grpc_port $grpc_port \ - -pid_file $VTDATAROOT/tmp/vtctld.pid \ - > $VTDATAROOT/tmp/vtctld.out 2>&1 & -echo "+ started" diff --git a/docker/mini/vttablet-mini-up.sh b/docker/mini/vttablet-mini-up.sh deleted file mode 100755 index 4cc86156076..00000000000 --- a/docker/mini/vttablet-mini-up.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash - -# Copyright 2019 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. - -mysql_host="$1" -mysql_port="$2" -is_primary="$3" - -source ./env.sh - -cell=${CELL:-'test'} -keyspace=${KEYSPACE:-'test_keyspace'} -shard=${SHARD:-'0'} -uid=$TABLET_UID -port=$[15000 + $TABLET_UID] -grpc_port=$[16000 + $uid] -printf -v alias '%s-%010d' $cell $uid -printf -v tablet_dir 'vt_%010d' $uid -tablet_hostname="$mysql_host" -printf -v tablet_logfile 'vttablet_%010d_querylog.txt' $uid - -mkdir -p "$VTDATAROOT/$tablet_dir" - -tablet_type=replica - -echo "> Starting vttablet for server $mysql_host:$mysql_port" -echo " - Tablet alias is $alias" -echo " - Tablet listens on http://$hostname:$port" -# shellcheck disable=SC2086 -vttablet \ - $TOPOLOGY_FLAGS \ - -log_dir $VTDATAROOT/tmp \ - -log_queries_to_file $VTDATAROOT/tmp/$tablet_logfile \ - -tablet-path $alias \ - -tablet_hostname "$hostname" \ - -init_db_name_override "$keyspace" \ - -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 \ - -port $port \ - -grpc_port $grpc_port \ - -db_host $mysql_host \ - -db_port $mysql_port \ - -db_app_user $TOPOLOGY_USER \ - -db_app_password $TOPOLOGY_PASSWORD \ - -db_dba_user $TOPOLOGY_USER \ - -db_dba_password $TOPOLOGY_PASSWORD \ - -mycnf_mysql_port $mysql_port \ - -service_map 'grpc-queryservice,grpc-tabletmanager,grpc-updatestream' \ - -pid_file $VTDATAROOT/$tablet_dir/vttablet.pid \ - -vtctld_addr http://$hostname:$vtctld_web_port/ \ - > $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" >/dev/null 2>&1 || fail "tablet could not be started!" - -echo " + vttablet started" - -if [ "$is_primary" == "true" ] ; then - echo " > Setting this tablet as primary" - vtctlclient TabletExternallyReparented "$alias" && - echo " + done" -fi