Created
March 4, 2019 13:32
-
-
Save pfrenssen/d56237dff19213650306f9ef3d774e6d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# Making a backup makes most sense if we are on the develop branch. Ask for | |
# confirmation if we aren't. | |
if [ $(git rev-parse --abbrev-ref HEAD) != "develop" ] ; then | |
read -p "The develop branch is not checked out. Continue? " -n 1 -r | |
echo | |
if [[ ! $REPLY =~ ^[Yy]$ ]] ; then | |
exit 1 | |
fi | |
fi | |
# Mount the backup drive. | |
if ! grep -qs '/mnt/workspace ' /proc/mounts; then | |
sudo mount /dev/sdc1 /mnt/workspace/ | |
fi | |
# Create backup folder. | |
mkdir -p /mnt/workspace/backups/ | |
# Turn off XDebug so we can install quickly. | |
sudo systemctl stop httpd | |
sed 's/^zend_extension/;zend_extension/' /etc/php/conf.d/xdebug.ini | sudo tee /etc/php/conf.d/xdebug.ini &> /dev/null | |
sudo systemctl start httpd | |
# Create a fresh build of the site and install it. | |
./vendor/bin/composer install --prefer-source && ./vendor/bin/phing build-dev && ./vendor/bin/phing install-dev | |
# Enable the demo content. This currently fails with an error, ignore that. | |
drush en demo_content -y || : | |
# Make a backup of the database. | |
# sudo rm -rf /mnt/workspace/backups/joinup/ | |
# sudo mariabackup --databases=joinup --backup --target-dir=/mnt/workspace/backups/joinup --user=root | |
drush sql:dump > /mnt/workspace/backups/joinup-dump.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment