From cb190481863cdd4d90e8aae1e1b0f976a4a7f9c3 Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Wed, 4 Aug 2021 20:18:33 +0900 Subject: [PATCH] docker: use dist/common/supervisor script for docker supervisor scripts for Docker and supervisor scripts for offline installer are almost same, drop Docker one and share same code to deduplicate them. Closes #9143 Fixes #9194 --- dist/docker/debian/build_docker.sh | 13 +++++----- .../etc/supervisord.conf.d/scylla-jmx.conf | 2 +- ...xporter.conf => scylla-node-exporter.conf} | 4 +-- .../etc/supervisord.conf.d/scylla-server.conf | 4 +-- dist/docker/node-exporter-service.sh | 5 ---- dist/docker/node_exporter_install | 26 ------------------- dist/docker/scylla-jmx-service.sh | 5 ---- dist/docker/scylla-service.sh | 13 ---------- 8 files changed, 12 insertions(+), 60 deletions(-) rename dist/docker/etc/supervisord.conf.d/{node-exporter.conf => scylla-node-exporter.conf} (54%) delete mode 100755 dist/docker/node-exporter-service.sh delete mode 100755 dist/docker/node_exporter_install delete mode 100755 dist/docker/scylla-jmx-service.sh delete mode 100755 dist/docker/scylla-service.sh diff --git a/dist/docker/debian/build_docker.sh b/dist/docker/debian/build_docker.sh index 174b7164c7..b590a4f586 100755 --- a/dist/docker/debian/build_docker.sh +++ b/dist/docker/debian/build_docker.sh @@ -75,16 +75,12 @@ bconfig() { buildah config "$@" "$container"; } bcp "${packages[@]}" packages/ bcp dist/docker/etc etc/ -bcp dist/docker/scylla-service.sh /scylla-service.sh -bcp dist/docker/node-exporter-service.sh /node-exporter-service.sh bcp dist/docker/scylla-housekeeping-service.sh /scylla-housekeeping-service.sh -bcp dist/docker/scylla-jmx-service.sh /scylla-jmx-service.sh bcp dist/docker/sshd-service.sh /sshd-service.sh bcp dist/docker/scyllasetup.py /scyllasetup.py bcp dist/docker/commandlineparser.py /commandlineparser.py bcp dist/docker/docker-entrypoint.py /docker-entrypoint.py -bcp dist/docker/node_exporter_install /node_exporter_install bcp dist/docker/scylla_bashrc /scylla_bashrc @@ -93,16 +89,21 @@ run apt-get -y update run apt-get -y install dialog apt-utils run bash -ec "echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections" run bash -ec "rm -rf /etc/rsyslog.conf" -run apt-get -y install hostname supervisor openssh-server openssh-client openjdk-11-jre-headless python python-yaml curl rsyslog locales +run apt-get -y install hostname supervisor openssh-server openssh-client openjdk-11-jre-headless python python-yaml curl rsyslog locales sudo run locale-gen en_US.UTF-8 run bash -ec "dpkg -i packages/*.deb" run apt-get -y clean all run bash -ec "cat /scylla_bashrc >> /etc/bashrc" run mkdir -p /etc/supervisor.conf.d run mkdir -p /var/log/scylla -run /node_exporter_install run chown -R scylla:scylla /var/lib/scylla +run mkdir -p /opt/scylladb/supervisor +bcp dist/common/supervisor/scylla-server.sh /opt/scylladb/supervisor/scylla-server.sh +bcp dist/common/supervisor/scylla-jmx.sh /opt/scylladb/supervisor/scylla-jmx.sh +bcp dist/common/supervisor/scylla-node-exporter.sh /opt/scylladb/supervisor/scylla-node-exporter.sh +bcp dist/common/supervisor/scylla_util.sh /opt/scylladb/supervisor/scylla_util.sh + bconfig --env PATH=/opt/scylladb/python3/bin:/usr/bin:/usr/sbin bconfig --entrypoint "/docker-entrypoint.py" bconfig --port 10000 --port 9042 --port 9160 --port 9180 --port 7000 --port 7001 --port 22 diff --git a/dist/docker/etc/supervisord.conf.d/scylla-jmx.conf b/dist/docker/etc/supervisord.conf.d/scylla-jmx.conf index 50824932c7..386f1ba418 100644 --- a/dist/docker/etc/supervisord.conf.d/scylla-jmx.conf +++ b/dist/docker/etc/supervisord.conf.d/scylla-jmx.conf @@ -1,5 +1,5 @@ [program:scylla-jmx] -command=/scylla-jmx-service.sh +command=/opt/scylladb/supervisor/scylla-jmx.sh stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr diff --git a/dist/docker/etc/supervisord.conf.d/node-exporter.conf b/dist/docker/etc/supervisord.conf.d/scylla-node-exporter.conf similarity index 54% rename from dist/docker/etc/supervisord.conf.d/node-exporter.conf rename to dist/docker/etc/supervisord.conf.d/scylla-node-exporter.conf index c55d593744..fb3d9893b8 100644 --- a/dist/docker/etc/supervisord.conf.d/node-exporter.conf +++ b/dist/docker/etc/supervisord.conf.d/scylla-node-exporter.conf @@ -1,5 +1,5 @@ -[program:node-exporter] -command=/node-exporter-service.sh +[program:scylla-node-exporter] +command=/opt/scylladb/supervisor/scylla-node-exporter.sh stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr diff --git a/dist/docker/etc/supervisord.conf.d/scylla-server.conf b/dist/docker/etc/supervisord.conf.d/scylla-server.conf index dbed742c05..07f0e26325 100644 --- a/dist/docker/etc/supervisord.conf.d/scylla-server.conf +++ b/dist/docker/etc/supervisord.conf.d/scylla-server.conf @@ -1,5 +1,5 @@ -[program:scylla] -command=/scylla-service.sh +[program:scylla-server] +command=/opt/scylladb/supervisor/scylla-server.sh stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr diff --git a/dist/docker/node-exporter-service.sh b/dist/docker/node-exporter-service.sh deleted file mode 100755 index e1cd80c30d..0000000000 --- a/dist/docker/node-exporter-service.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -/usr/bin/node_exporter --collector.interrupts - - diff --git a/dist/docker/node_exporter_install b/dist/docker/node_exporter_install deleted file mode 100755 index 9af1a5c41d..0000000000 --- a/dist/docker/node_exporter_install +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# -# Copyright 2019-present ScyllaDB -# -# This file is part of Scylla. -# -# Scylla is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Scylla is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Scylla. If not, see . -VERSION='0.17.0' -INSTALL_DIR='/usr/lib/scylla/Prometheus/node_exporter' -mkdir -p $INSTALL_DIR -cd $INSTALL_DIR -curl -L https://github.com/prometheus/node_exporter/releases/download/v$VERSION/node_exporter-$VERSION.linux-amd64.tar.gz -o $INSTALL_DIR/node_exporter-$VERSION.linux-amd64.tar.gz -tar -xvzf $INSTALL_DIR/node_exporter-$VERSION.linux-amd64.tar.gz -rm $INSTALL_DIR/node_exporter-$VERSION.linux-amd64.tar.gz -ln -s $INSTALL_DIR/node_exporter-$VERSION.linux-amd64/node_exporter /usr/bin diff --git a/dist/docker/scylla-jmx-service.sh b/dist/docker/scylla-jmx-service.sh deleted file mode 100755 index db20ae91b9..0000000000 --- a/dist/docker/scylla-jmx-service.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -source /etc/default/scylla-jmx - -exec /opt/scylladb/jmx/scylla-jmx $SCYLLA_JMX_PORT $SCYLLA_API_PORT $SCYLLA_API_ADDR $SCYLLA_JMX_ADDR $SCYLLA_JMX_FILE $SCYLLA_JMX_LOCAL $SCYLLA_JMX_REMOTE $SCYLLA_JMX_DEBUG diff --git a/dist/docker/scylla-service.sh b/dist/docker/scylla-service.sh deleted file mode 100755 index eebff9dbb5..0000000000 --- a/dist/docker/scylla-service.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -/opt/scylladb/scripts/scylla_prepare - -. /etc/sysconfig/scylla-server - -export SCYLLA_HOME SCYLLA_CONF - -for f in /etc/scylla.d/*.conf; do - . "$f" -done - -exec /usr/bin/scylla $SCYLLA_ARGS $SEASTAR_IO $DEV_MODE $CPUSET $SCYLLA_DOCKER_ARGS