From ea67401d95fb84de1efb26a34cd84fe7c3b44bf5 Mon Sep 17 00:00:00 2001 From: boyska Date: Tue, 9 Feb 2016 22:23:55 -0500 Subject: [PATCH] deploy mysql, base install --- deploy/deploy.sh | 51 +++++++++++++++++++++++++++++++++++++---- testingtoolchain/out.sh | 3 +++ 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/deploy/deploy.sh b/deploy/deploy.sh index 4c7d2f8..1f035e2 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -3,20 +3,61 @@ drupal_mail=dio@ca.ne drupal_password=porcoddio drupal_path=/var/www/d8/ +drupal_db_name=www +drupal_db_user=www +drupal_hostname=www.example.com +drupal_db_password=$(pwgen -B 16 1) +. $(dirname $0)/../testingtoolchain/out.sh conf=$(dirname $0)/../config.sh [[ -f "$conf" ]] && . "$conf" -set -x +set -e +set -u +progress "setting up MariaDB" +pgrep -x mysqld || /etc/init.d/mysql start +for try in {1..20}; do # elegante! + if [[ -S /var/run/mysqld/mysqld.sock ]]; then + break + else + sleep 0.2 + fi +done +if ! mysql -u root <<<'show databases;' | fgrep -v ${drupal_db_name} +then + #mysqladmin create "${drupal_db_name}" + mysql -u root < /etc/drush/aliases.drushrc.php + '${drupal_path}', +'uri' => 'http://${drupal_hostname}', +); +EOF +ok "Drush configurated" + +progress "Download and install drupal8 'base'" if [[ ! -d ${drupal_path} ]]; then mkdir -p "$(dirname ${drupal_path})" cd "$(dirname ${drupal_path})" drush dl drupal --drupal-project-rename=$(basename ${drupal_path}) fi cd "${drupal_path}" -drush site-install --locale=it \ - --account-mail ${drupal_mail} \ - --account-name techbloc-admin \ - --account-pass ${drupal_password} \ +note "Ci mette TANTO ma veramente!" +drush --yes site-install --locale=it \ + --account-mail=${drupal_mail} \ + --account-name=techbloc-admin \ + --account-pass=${drupal_password} \ + --db-su=root \ + --db-url="mysql://${drupal_db_user}:${drupal_db_password}@localhost/${drupal_db_name}" \ standard +ok "Drupal is functional at ${drupal_path}" diff --git a/testingtoolchain/out.sh b/testingtoolchain/out.sh index c8bec5a..b7742bf 100644 --- a/testingtoolchain/out.sh +++ b/testingtoolchain/out.sh @@ -4,6 +4,9 @@ tp() { tput "$@" } +note() { + echo "$(tp bold)$(tp setaf 11)OCCHIO: $(tp sgr0)$(tp setaf 11)$*$(tp sgr0)" +} error() { echo "$(tp bold)$(tp setaf 1)$*$(tp sgr0)" >&2 }