Created
March 4, 2015 09:50
-
-
Save GwendolenLynch/49e041c4e48cac11be8b to your computer and use it in GitHub Desktop.
Bolt Install Reset
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/sh | |
| # Set the install directory | |
| WD=/var/www/sites/example.com | |
| # Location of your Composer install binary | |
| COMPOSER=~/bin/composer | |
| # Location of the MySQL client binary | |
| MYSQL=/usr/bin/mysql | |
| # Bolt's MySQL database, username and password to use | |
| DB_NAME=bolt_example | |
| DB_USER=bolt_example | |
| DB_PASS=bolt_example | |
| cd $WD | |
| git reset --hard HEAD | |
| git checkout master | |
| git pull --all | |
| # Clean up extensions | |
| rm -rf $WD/extensions/local/ | |
| rm -rf $WD/extensions/vendor/ | |
| rm -rf $WD/extensions/composer.json | |
| # Clean up configs | |
| rm -f $WD/app/config/*.yml | |
| rm -f $WD/app/config/extensions/*.yml | |
| # Install new config | |
| cp $WD/app/config/config.yml.dist $WD/app/config/config.yml | |
| # Set timezone | |
| perl -p -i -e "s/#timezone: UTC/timezone: UTC/" $WD/app/config/config.yml | |
| # Set database config | |
| perl -p -i -e "s/driver: sqlite/driver: mysql/" $WD/app/config/config.yml | |
| perl -p -i -e "s/driver: mysql/driver: mysql\n username: $DB_USER\n password: $DB_PASS/" $WD/app/config/config.yml | |
| perl -p -i -e "s/databasename: bolt/databasename: $DB_NAME/" $WD/app/config/config.yml | |
| # Flush the existing relevant tables | |
| TABLES=$($MYSQL -u $DB_USER -p$DB_PASS $DB_NAME -e "SHOW TABLES;" | awk '{print $1}' | grep -v 'Tables_') | |
| for t in $TABLES; do | |
| echo "Deleting $t table from database..." | |
| $MYSQL -u $DB_USER -p$DB_PASS $DB_NAME -e "DROP TABLE $t;" | |
| done | |
| # Nut update the DB | |
| $WD/app/nut database:update | |
| # Clear the cache | |
| $WD/app/nut cache:clear | |
| # Set site name and payoff | |
| $WD/app/nut config:set sitename "Clippy Inc." | |
| $WD/app/nut config:set payoff "Taking over the world, one paperclip at a time!" | |
| # Add the admin account | |
| $WD/app/nut user:add admin 'Admin User' '[email protected]' 'password' root | |
| # Enable the change log | |
| perl -p -i -e "undef $/; s/changelog:\n enabled: false/changelog:\n enabled: true/g" $WD/app/config/config.yml | |
| # Enabled development debugging levels | |
| $WD/app/nut config:set strict_variables true | |
| perl -p -i -e "s/debug_error_level: 6135/debug_error_level: -1/" $WD/app/config/config.yml | |
| # Reset Composer | |
| rm -rf $WD/vendor/ | |
| # Update composer packages | |
| $COMPOSER update | |
| # Set permissions | |
| chown -R nginx:nginx $WD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment