deploy mysql, base install

This commit is contained in:
boyska 2016-02-09 22:23:55 -05:00
parent bd241d19b0
commit ea67401d95
2 changed files with 49 additions and 5 deletions

View file

@ -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 <<EOF
CREATE USER '${drupal_db_user}'@'127.0.0.1' IDENTIFIED BY '${drupal_db_password}';
GRANT ALL PRIVILEGES ON ${drupal_db_name}.* TO '${drupal_db_user}'@'127.0.0.1';
EOF
fi
ok "MariaDB ready"
progress "Drush system-wide config"
mkdir -p /etc/drush/
cat <<EOF > /etc/drush/aliases.drushrc.php
<?php
\$aliases['www'] = array(
'root' => '${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}"

View file

@ -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
}