From 629ac4f1dbd5f3083b6ccb50144733186edfa2df Mon Sep 17 00:00:00 2001 From: zeus Date: Sat, 1 Jan 2022 20:56:24 +0200 Subject: [PATCH] worker --- install/usr/share/swarmlab.io/sec/mysqld.cnf | 38 +++++++++++++++++++ .../share/swarmlab.io/sec/sec_bootstrapmysql | 5 ++- .../usr/share/swarmlab.io/sec/swarmlab-sec | 20 +++++----- 3 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 install/usr/share/swarmlab.io/sec/mysqld.cnf diff --git a/install/usr/share/swarmlab.io/sec/mysqld.cnf b/install/usr/share/swarmlab.io/sec/mysqld.cnf new file mode 100644 index 0000000..3b8fc69 --- /dev/null +++ b/install/usr/share/swarmlab.io/sec/mysqld.cnf @@ -0,0 +1,38 @@ +# Copyright (c) 2014, 2021, Oracle and/or its affiliates. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License, version 2.0, +# as published by the Free Software Foundation. +# +# This program is also distributed with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, +# as designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have included with MySQL. +# +# This program 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, version 2.0, for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# +# The MySQL Server configuration file. +# +# For explanations see +# http://dev.mysql.com/doc/mysql/en/server-system-variables.html + +[mysqld] +pid-file = /var/run/mysqld/mysqld.pid +socket = /var/run/mysqld/mysqld.sock +datadir = /var/lib/mysql +skip-grant-tables +#log-error = /var/log/mysql/error.log +# By default we only accept connections from localhost +#bind-address = 127.0.0.1 +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 diff --git a/install/usr/share/swarmlab.io/sec/sec_bootstrapmysql b/install/usr/share/swarmlab.io/sec/sec_bootstrapmysql index b4fef8a..fcdf8f2 100755 --- a/install/usr/share/swarmlab.io/sec/sec_bootstrapmysql +++ b/install/usr/share/swarmlab.io/sec/sec_bootstrapmysql @@ -47,7 +47,8 @@ case $ROLE in auto_update_hosts "${HOSTNAMES}" > /dev/null 2>&1 & - ttyd -p 3787 bash + ttyd -p 3787 bash & + mysqld --user=root tail -f /dev/null # Start ssh server @@ -68,6 +69,8 @@ case $ROLE in # ssh -T -o "StrictHostKeyChecking no" \ # -i "${USER_HOME}/.ssh/id_rsa" \ # ${USER}@${MPI_MASTER_SERVICE_NAME} \ + ttyd -p 3787 bash & + mysqld --user=root tail -f /dev/null #done ;; diff --git a/install/usr/share/swarmlab.io/sec/swarmlab-sec b/install/usr/share/swarmlab.io/sec/swarmlab-sec index 5ca049f..1bdedf3 100755 --- a/install/usr/share/swarmlab.io/sec/swarmlab-sec +++ b/install/usr/share/swarmlab.io/sec/swarmlab-sec @@ -270,6 +270,7 @@ fi /bin/cp -f $DIR/project/hello_world.sh $Wdir/project /bin/cp -f $DIR/$bootstrap $Wdir/$bootstrap /bin/cp -f $DIR/sec_bootstrapmysql $Wdir/sec_bootstrapmysql +/bin/cp -f $DIR/mysqld.cnf $Wdir/mysqld.cnf /bin/cp -f $DIR/$hostnames $Wdir/$hostnames /bin/cp -f $DIR/$hostnames_get $Wdir/$hostnames_get /bin/cp -f $DIR/ROOT_PASSWORD $Wdir/ROOT_PASSWORD @@ -323,13 +324,14 @@ services: cap_add: - NET_ADMIN user: root - entrypoint: ["sec_bootstrapmysql", "role=masterservice", "sec_master_service_name=masterservice", "sec_worker_service_name=workerservice"] + entrypoint: ["sec_bootstrapmysql", "role=workerservice", "sec_master_service_name=masterservice", "sec_worker_service_name=workerservice"] networks: - ${HYBRID_NETWORK} volumes: - $Wdir/project:/home/docker/project - $Wdir/bin/ttyd.x86_64:/usr/bin/ttyd - $Wdir/sec_bootstrapmysql:/usr/bin/sec_bootstrapmysql + - $Wdir/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf - db:/var/lib/mysql networks: @@ -530,13 +532,13 @@ up_workers () docker-compose up --build -d workerservice #docker-compose up --force-recreate -d workerservice - printf "\\n" - printf "\\n%s\\n" "$HEADER" + #printf "\\n" + #printf "\\n%s\\n" "$HEADER" - NUM_WORKER=$((SIZE - 1)) - echo "$ docker-compose scale workerservice=$NUM_WORKER" - printf "\\n" - docker-compose scale workerservice=${NUM_WORKER} + #NUM_WORKER=$((SIZE - 1)) + #echo "$ docker-compose scale workerservice=$NUM_WORKER" + #printf "\\n" + #docker-compose scale workerservice=${NUM_WORKER} } down_master () @@ -695,7 +697,7 @@ if [ $COMMAND_UP -eq 1 ]; then generate_ssh_keys build_and_push_image # remove for microservices up_master - #up_workers + up_workers prompt_ready show_instruction @@ -727,7 +729,7 @@ elif [ $COMMAND_RELOAD -eq 1 ]; then down_workers build_and_push_image up_master - #up_workers + up_workers prompt_ready show_instruction