Commit 522930b6 authored by Ricardo Amaro's avatar Ricardo Amaro
Browse files

fixed mysql auth

parent 45ea3f19
......@@ -30,21 +30,11 @@ RUN echo "export VISIBLE=now" >> /etc/profile; \
# Install Composer, drush and drupal console
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install supervisor
COPY ./files/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ./files/start.sh /start.sh
COPY ./files/foreground.sh /etc/apache2/foreground.sh
# Apache & Xdebug
RUN rm /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled/*
ADD ./files/000-default.conf /etc/apache2/sites-available/000-default.conf
ADD ./files/xdebug.ini /etc/php/7.3/mods-available/xdebug.ini
RUN a2ensite 000-default ; a2enmod rewrite vhost_alias
# Drupal new version, clean cache
ADD https://updates.drupal.org/release-history/drupal/${DRUPALVER} /tmp/latest.xml
# Retrieve drupal & adminer
# TODO: also require drupal/memcache
RUN cd /var/www/html; \
git clone --depth 1 --single-branch -b ${DRUPALVER} https://git.drupalcode.org/project/drupal.git web \
&& cd web; composer require drush/drush:~10; composer install \
......@@ -54,6 +44,17 @@ RUN cd /var/www/html; \
chmod -R ug+w /var/www/html/ ; \
wget "http://www.adminer.org/latest.php" -O /var/www/html/web/adminer.php
# Install supervisor
COPY ./files/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ./files/start.sh /start.sh
COPY ./files/foreground.sh /etc/apache2/foreground.sh
# Apache & Xdebug
RUN rm /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled/*
ADD ./files/000-default.conf /etc/apache2/sites-available/000-default.conf
ADD ./files/xdebug.ini /etc/php/7.3/mods-available/xdebug.ini
RUN a2ensite 000-default ; a2enmod rewrite vhost_alias
# Set some permissions
RUN mkdir -p /var/run/mysqld; \
chown mysql:mysql /var/run/mysqld; \
......
......@@ -28,7 +28,8 @@ if [ ! -f ${DOCROOT}/index.php ]; then
# ${DRUSH} -vy dl drupal --default-major=${DRUPALVER} --drupal-project-rename="web"
git clone --depth 1 --single-branch -b ${DRUPALVER} \
https://git.drupalcode.org/project/drupal.git web;
cd web; composer require drush/drush:~10 drupal/console; composer install
# TODO: also require drupal/memcache
cd web; composer require drush/drush:~10; composer install
chmod a+w ${DOCROOT}/sites/default;
mkdir ${DOCROOT}/sites/default/files;
wget "http://www.adminer.org/latest.php" -O ${DOCROOT}/adminer.php
......@@ -55,18 +56,20 @@ if ( ! grep -q 'database.*=>.*drupal' ${DOCROOT}/sites/default/settings.php 2>/d
echo;
# Create and change MySQL creds
mysqladmin -u root password ${ROOT_PASSWORD} 2>/dev/null
mysql -uroot -p${ROOT_PASSWORD} -e \
"GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED WITH mysql_native_password BY '$DEBPASS';" 2>/dev/null
mysql -uroot -p${ROOT_PASSWORD} -e \
"CREATE DATABASE drupal; GRANT ALL PRIVILEGES ON drupal.* TO 'drupal'@'%' IDENTIFIED WITH mysql_native_password BY '$DRUPAL_PASSWORD'; FLUSH PRIVILEGES;" 2>/dev/null
echo -e "[client]\npassword=${ROOT_PASSWORD}\n" > /root/.my.cnf
mysql -e \
"CREATE USER 'debian-sys-maint'@'localhost' IDENTIFIED WITH mysql_native_password BY '${DEBPASS}';
GRANT ALL ON *.* TO 'debian-sys-maint'@'localhost';
CREATE DATABASE drupal;
CREATE USER 'drupal'@'%' IDENTIFIED WITH mysql_native_password BY '${DRUPAL_PASSWORD}';
GRANT ALL ON drupal.* TO 'drupal'@'%';
FLUSH PRIVILEGES;"
cd ${DOCROOT}
cp sites/default/default.settings.php sites/default/settings.php
${DRUSH} site-install standard -y --account-name=admin --account-pass=admin \
--db-url="mysql://drupal:${DRUPAL_PASSWORD}@localhost:3306/drupal" \
--site-name="Drupal9 docker App" | grep -v 'continue?' 2>/dev/null
# TODO: move this to composer.json
${DRUSH} -y dl memcache >/dev/null 2>&1
${DRUSH} -y en memcache | grep -v 'continue?' | grep -v error 2>/dev/null
#${DRUSH} -y en memcache | grep -v 'continue?' | grep -v error 2>/dev/null
else
echo "**** ${DOCROOT}/sites/default/settings.php database found ****"
ROOT_PASSWORD=$(cat /var/lib/mysql/mysql/mysql-root-pw.txt)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment