deploy mysql, base install
This commit is contained in:
parent
bd241d19b0
commit
ea67401d95
2 changed files with 49 additions and 5 deletions
|
@ -3,20 +3,61 @@
|
||||||
drupal_mail=dio@ca.ne
|
drupal_mail=dio@ca.ne
|
||||||
drupal_password=porcoddio
|
drupal_password=porcoddio
|
||||||
drupal_path=/var/www/d8/
|
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
|
conf=$(dirname $0)/../config.sh
|
||||||
[[ -f "$conf" ]] && . "$conf"
|
[[ -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
|
if [[ ! -d ${drupal_path} ]]; then
|
||||||
mkdir -p "$(dirname ${drupal_path})"
|
mkdir -p "$(dirname ${drupal_path})"
|
||||||
cd "$(dirname ${drupal_path})"
|
cd "$(dirname ${drupal_path})"
|
||||||
drush dl drupal --drupal-project-rename=$(basename ${drupal_path})
|
drush dl drupal --drupal-project-rename=$(basename ${drupal_path})
|
||||||
fi
|
fi
|
||||||
cd "${drupal_path}"
|
cd "${drupal_path}"
|
||||||
drush site-install --locale=it \
|
note "Ci mette TANTO ma veramente!"
|
||||||
--account-mail ${drupal_mail} \
|
drush --yes site-install --locale=it \
|
||||||
--account-name techbloc-admin \
|
--account-mail=${drupal_mail} \
|
||||||
--account-pass ${drupal_password} \
|
--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
|
standard
|
||||||
|
ok "Drupal is functional at ${drupal_path}"
|
||||||
|
|
|
@ -4,6 +4,9 @@ tp() {
|
||||||
tput "$@"
|
tput "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
note() {
|
||||||
|
echo "$(tp bold)$(tp setaf 11)OCCHIO: $(tp sgr0)$(tp setaf 11)$*$(tp sgr0)"
|
||||||
|
}
|
||||||
error() {
|
error() {
|
||||||
echo "$(tp bold)$(tp setaf 1)$*$(tp sgr0)" >&2
|
echo "$(tp bold)$(tp setaf 1)$*$(tp sgr0)" >&2
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue