Last active
February 12, 2016 12:51
-
-
Save shashankgroovy/966eae2fcd876e9d6eca to your computer and use it in GitHub Desktop.
This file contains 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 | |
# Description: | |
# EC2 setup. | |
# Based on Ubuntu, debian based systems | |
# Execution: | |
# First a lot the correct file permissions for the setup file: | |
# $ chmod 755 setup.sh | |
# And then simply run | |
# $ ./setup.sh | |
# Written by: Shashank Srivastav <shashankgrovy@gmail.com> | |
# Last updated: February 11, 2016 | |
#----------------------------------------------------------- | |
# Set a safe exit for the script when a command fails | |
set -o errexit | |
# uncomment xtrace below to Trace what gets executed. Useful for debugging. | |
# set -o xtrace | |
echo "Updating the repository sources list" | |
sudo apt-get update && \ | |
apt-get install -y nginx git software-properties-common vim curl wget redis-server | |
echo "Installing PHP" | |
sudo add-apt-repository ppa:ondrej/php5 && \ | |
apt-get install -y php5 php5-fpm php5-mysql php5-mcrypt php5-cli php5-curl | |
echo "Installing composer" | |
sudo curl -sS https://getcomposer.org/installer | php | |
mv composer.phar /usr/local/bin/composer | |
echo "Installing Ruby for compass" | |
sudo apt-get install -y ruby && \ | |
gem install compass --version 0.12.6 && \ | |
gem install compass-import-once | |
echo "Installing nodejs and other dependencies" | |
sudo apt-get install -y nodejs nodejs-legacy npm | |
echo "Make and enter project directory" | |
mkdir -p ~/project && cd ~/project | |
# changing user group permissions | |
chgrp www-data . -R | |
chmod g+wrxs . -R | |
echo "Cloning into Musejam/musejam-app" | |
git clone https://github.com/Musejam/musejam-app.git | |
cd musejam-app | |
git remote add upstream https://github.com/Musejam/musejam-app.git | |
# enable write access to logs and storage | |
chmod a+w app/storage -R | |
composer install -vvv | |
composer build-js | |
php artisan migrate | |
echo "Copying sample configs - Please modify according to needs" | |
cp app/config/database.sample.php app/config/database.php | |
cp app/config/auth.sample.php app/config/auth.php | |
cp app/config/thumbor.sample.php app/config/thumbor.php | |
# return to project directory | |
cd ~/project | |
echo "Cloning into Musejam/musejam-website" | |
git clone https://github.com/Musejam/musejam-website.git | |
cd musejam-website | |
npm install | |
npm install -g gulp | |
echo "Copying sample configs - Please modify according to needs" | |
cp app/config.sample.js app/config.js | |
gulp style | |
npm run almond | |
# return to project directory | |
cd ~/project | |
echo "Setting up cors" | |
wget -q https://gist.github.com/adityamenon/9c60b07dd34f506b91f0/raw/670c94007a3f68a350154a51d35bfa430aeb6436/cors-nginx.conf | |
mv cors-nginx.conf /etc/nginx/ | |
echo "Configuring nginx" | |
wget -q https://gist.github.com/shashankgroovy/346be90deaac298bf4c0/raw/c514f7f53e7ea77c96eea4344d5e34abc2d9a89c/nginx-setup.sh | |
chmod 755 nginx-setup.sh | |
bash nginx-setup.sh | |
# start services | |
/etc/init.d/nginx restart | |
/etc/init.d/php5-fpm start | |
/etc/init.d/redis-server start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment