Browse Source

worker

master
zeus 3 years ago
parent
commit
629ac4f1db
  1. 38
      install/usr/share/swarmlab.io/sec/mysqld.cnf
  2. 5
      install/usr/share/swarmlab.io/sec/sec_bootstrapmysql
  3. 20
      install/usr/share/swarmlab.io/sec/swarmlab-sec

38
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

5
install/usr/share/swarmlab.io/sec/sec_bootstrapmysql

@ -47,7 +47,8 @@ case $ROLE in
auto_update_hosts "${HOSTNAMES}" > /dev/null 2>&1 & auto_update_hosts "${HOSTNAMES}" > /dev/null 2>&1 &
ttyd -p 3787 bash ttyd -p 3787 bash &
mysqld --user=root
tail -f /dev/null tail -f /dev/null
# Start ssh server # Start ssh server
@ -68,6 +69,8 @@ case $ROLE in
# ssh -T -o "StrictHostKeyChecking no" \ # ssh -T -o "StrictHostKeyChecking no" \
# -i "${USER_HOME}/.ssh/id_rsa" \ # -i "${USER_HOME}/.ssh/id_rsa" \
# ${USER}@${MPI_MASTER_SERVICE_NAME} \ # ${USER}@${MPI_MASTER_SERVICE_NAME} \
ttyd -p 3787 bash &
mysqld --user=root
tail -f /dev/null tail -f /dev/null
#done #done
;; ;;

20
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/project/hello_world.sh $Wdir/project
/bin/cp -f $DIR/$bootstrap $Wdir/$bootstrap /bin/cp -f $DIR/$bootstrap $Wdir/$bootstrap
/bin/cp -f $DIR/sec_bootstrapmysql $Wdir/sec_bootstrapmysql /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 $Wdir/$hostnames
/bin/cp -f $DIR/$hostnames_get $Wdir/$hostnames_get /bin/cp -f $DIR/$hostnames_get $Wdir/$hostnames_get
/bin/cp -f $DIR/ROOT_PASSWORD $Wdir/ROOT_PASSWORD /bin/cp -f $DIR/ROOT_PASSWORD $Wdir/ROOT_PASSWORD
@ -323,13 +324,14 @@ services:
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
user: root 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: networks:
- ${HYBRID_NETWORK} - ${HYBRID_NETWORK}
volumes: volumes:
- $Wdir/project:/home/docker/project - $Wdir/project:/home/docker/project
- $Wdir/bin/ttyd.x86_64:/usr/bin/ttyd - $Wdir/bin/ttyd.x86_64:/usr/bin/ttyd
- $Wdir/sec_bootstrapmysql:/usr/bin/sec_bootstrapmysql - $Wdir/sec_bootstrapmysql:/usr/bin/sec_bootstrapmysql
- $Wdir/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf
- db:/var/lib/mysql - db:/var/lib/mysql
networks: networks:
@ -530,13 +532,13 @@ up_workers ()
docker-compose up --build -d workerservice docker-compose up --build -d workerservice
#docker-compose up --force-recreate -d workerservice #docker-compose up --force-recreate -d workerservice
printf "\\n" #printf "\\n"
printf "\\n%s\\n" "$HEADER" #printf "\\n%s\\n" "$HEADER"
NUM_WORKER=$((SIZE - 1)) #NUM_WORKER=$((SIZE - 1))
echo "$ docker-compose scale workerservice=$NUM_WORKER" #echo "$ docker-compose scale workerservice=$NUM_WORKER"
printf "\\n" #printf "\\n"
docker-compose scale workerservice=${NUM_WORKER} #docker-compose scale workerservice=${NUM_WORKER}
} }
down_master () down_master ()
@ -695,7 +697,7 @@ if [ $COMMAND_UP -eq 1 ]; then
generate_ssh_keys generate_ssh_keys
build_and_push_image # remove for microservices build_and_push_image # remove for microservices
up_master up_master
#up_workers up_workers
prompt_ready prompt_ready
show_instruction show_instruction
@ -727,7 +729,7 @@ elif [ $COMMAND_RELOAD -eq 1 ]; then
down_workers down_workers
build_and_push_image build_and_push_image
up_master up_master
#up_workers up_workers
prompt_ready prompt_ready
show_instruction show_instruction

Loading…
Cancel
Save