Last active
August 29, 2015 14:04
-
-
Save lsolesen/c771ccb7e635e2c94d4c to your computer and use it in GitHub Desktop.
Script to setup Codio box easily to use with drupal development.
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
| ########################################################################## | |
| #### Script to setup Codio box for Drupal development | |
| ########################################################################## | |
| #### Instructions | |
| #### From the Codio Dashboard, create a new Empty template project. | |
| #### Open a Terminal window from the Tools->Terminal window | |
| #### Copy the contents of this file to a file called 'setup.sh' in the root of your machines file system | |
| #### Then run the following command in the Terminal Window | |
| #### bash setup.sh | |
| #### End of Instructions | |
| ########################################################################## | |
| echo | |
| echo " START OF AUTOMATED SETUP OF BOX FOR DRUPAL DEVELOPMENT" | |
| echo | |
| # set colour output = echo -e '\E[1;33;44m' | |
| # remove colour = ; tput sgr0 | |
| # See http://www.tldp.org/LDP/abs/html/colorizing.html for colour codes | |
| echo -e '\E[1;33;44m' "Install LAMP stack"; tput sgr0 | |
| parts install mysql php5 php5-apache2 php5-pdo-mysql php5-gd php5-zip php5-curl php5-zlib | |
| echo -e '\E[1;33;44m' "Install extra tools: composer and zip"; tput sgr0 | |
| parts install composer zip | |
| echo -e '\E[1;33;44m' "Setting timezone for PHP"; tput sgr0 | |
| echo "date.timezone = Europe/Copenhagen" > ~/.parts/etc/php5/conf.d/timezone.ini | |
| echo -e '\E[1;33;44m' "Better ressources for PHP"; tput sgr0 | |
| sed -i 's/memory_limit = .*/memory_limit = 256M/' ~/.parts/etc/php5/php.ini | |
| echo -e '\E[1;33;44m' "Start the apache and mysql services"; tput sgr0 | |
| parts start apache2 mysql | |
| echo -e '\E[1;33;44m' "Install mailcatcher"; tput sgr0 | |
| parts install sqlite3 | |
| gem install mailcatcher | |
| sed -i 's/sendmail_path = .*/sendmail_path = \/usr\/bin\/env catchmail -f [email protected]/' ~/.parts/etc/php5/php.ini | |
| mailcatcher --ip=0.0.0.0 | |
| echo -e '\E[1;33;44m' "Create database 'drupal' with user 'drupal' and password 'password'"; tput sgr0 | |
| echo -e '\E[1;33;44m' "WARNING: Those settings are not secure and should be changed"; tput sgr0 | |
| mysql -u root -e "CREATE DATABASE drupal" | |
| mysql -u root -e "CREATE USER 'drupal'@'localhost' IDENTIFIED BY 'password'" | |
| mysql -u root -e "GRANT ALL PRIVILEGES ON drupal.* TO 'drupal'@'localhost' IDENTIFIED BY 'password'" | |
| mysql -u root -e "FLUSH PRIVILEGES" | |
| echo -e '\E[1;33;44m' "Installing drush"; tput sgr0 | |
| cd /home/codio | |
| git clone https://github.com/drush-ops/drush --branch=6.x | |
| cd drush | |
| composer install | |
| cd /home/codio/.parts/bin | |
| ln -s /home/codio/drush/drush drush | |
| drush dl registry_rebuild | |
| echo -e '\E[1;33;44m' "Install phantomjs, sass, compass and sassy-buttons"; tput sgr0 | |
| parts install adminer phantomjs | |
| gem install sass | |
| gem install compass | |
| gem install sassy-buttons | |
| gem install compass_twitter_bootstrap | |
| gem install compass_radix | |
| echo -e '\E[1;33;44m' "Install ungit"; tput sgr0 | |
| npm install -g ungit | |
| echo -e '\E[1;33;44m' "Install grunt-cli globally"; tput sgr0 | |
| npm install -g grunt-cli | |
| echo -e '\E[1;33;44m' "Preview - Setup Menu - editing .codio file"; tput sgr0 | |
| echo ' | |
| { | |
| "commands": { | |
| "Reinstall site": "cd ~/workspace && drush si standard --db-url=mysql://drupal:password@localhost/drupal --account-name=admin --account-pass=admin -y", | |
| "PHP Version": "php --version", | |
| "Start PhantomJS": "phantomjs --webdriver=8643", | |
| "Start Ungit": "ungit" | |
| }, | |
| "preview": { | |
| "Box URL": "http://{{domain}}:3000/", | |
| "Drupal login": "http://{{domain}}:3000/user", | |
| "Mailcatcher": "http://{{domain}}:1080/", | |
| "Adminer MySQL": "http://{{domain}}:3000/adminer", | |
| "Ungit": "http://{{domain}}:8448/#/" | |
| } | |
| }' > ~/workspace/.codio | |
| echo -e '\E[1;33;44m' "Writing startup.sh to ensure services starts when box restarts"; tput sgr0 | |
| echo "parts stop apache2 mysql" > ~/startup.sh | |
| echo "parts start apache2 mysql" >> ~/startup.sh | |
| echo "mailcatcher --ip=0.0.0.0" >> ~/startup.sh | |
| echo -e '\E[1;33;44m' "Restart box"; tput sgr0 | |
| bash ~/startup.sh | |
| echo -e '\E[1;33;44m' "Box has been setup"; tput sgr0 | |
| echo | |
| echo -e '\E[1;33;44m' "You are ready to create your Drupal site by running"; tput sgr0 | |
| echo -e '\E[1;33;44m' "cd ~/workspace && drush make build-platform.make ."; tput sgr0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment