Files
training-labs/labs/osbash/scripts/ubuntu/apt_install_mysql.sh
Roger Luethi c5fdafc900 Newton updates
This changeset contains updates for Newton.

Notable changes include:
- Ubuntu 14.04 LTS (trusty) replaced by Ubuntu 16.04 LTS (xenial)
- Higher RAM requirements, the controller VM needs 5120 MB
- Script order changed (install-guide changes)
- By default, mariadb does not use a root password but socket auth (sudo)
- Nova does not configure any default flavors anymore; we create m1.nano
  and that's all there is when the cluster is built.
- Remaining differences to install-guide marked in the source code
- As always, new races fixed

Change-Id: Id59e145140252c4384584a3899e01a38e8a57158
2016-10-17 13:40:06 +02:00

63 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -o errexit -o nounset
TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
source "$TOP_DIR/config/paths"
source "$CONFIG_DIR/credentials"
source "$LIB_DIR/functions.guest.sh"
exec_logfile
indicate_current_auto
#-------------------------------------------------------------------------------
# Controller setup
#-------------------------------------------------------------------------------
DB_IP=$(get_node_ip_in_network "$(hostname)" "mgmt")
echo "Will bind MySQL server to $DB_IP."
#------------------------------------------------------------------------------
# Install and configure the database server
# http://docs.openstack.org/newton/install-guide-ubuntu/environment-sql-database.html
#------------------------------------------------------------------------------
echo "Sourced MySQL password from credentials: $DATABASE_PASSWORD"
#sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password '$DATABASE_PASSWORD''
#sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password '$DATABASE_PASSWORD''
echo "Installing MySQL (MariaDB)."
sudo apt-get install -y mariadb-server python-mysqldb
# Not in the install-guide
echo "Sanity check: distro default is socket auth."
sudo mysql -u root -e quit
# Not in install-guide
# To drop socket auth for root user and use root password:
# sudo mysql -u "root" -e "use mysql; update user set plugin='' where user='root'; update user set password=PASSWORD('$DATABASE_PASSWORD') where user='root'; flush privileges;"
conf=/etc/mysql/mariadb.conf.d/99-openstack.cnf
echo "Creating $conf."
echo '[mysqld]' | sudo tee $conf
echo "Configuring MySQL to accept requests from management network ($DB_IP)."
iniset_sudo $conf mysqld bind-address "$DB_IP"
iniset_sudo $conf mysqld default-storage-engine innodb
iniset_sudo $conf mysqld innodb_file_per_table ""
iniset_sudo $conf mysqld max_connections 4096
iniset_sudo $conf mysqld collation-server utf8_general_ci
iniset_sudo $conf mysqld character-set-server utf8
echo "Restarting MySQL service."
# Close the file descriptor or the script will hang due to open ssh connection
sudo service mysql restart 2>/dev/null
# Difference to install-guide: not running mysql_secure_installation