Skip to content

Commit

Permalink
Adding comments in scripts #1
Browse files Browse the repository at this point in the history
  • Loading branch information
tilaks26 committed Jan 31, 2017
1 parent 6844590 commit 8d88be1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
16 changes: 12 additions & 4 deletions .travis.yml
@@ -1,44 +1,52 @@
#Language used
language: php

#Version of PHP used
php:
- 5.6

#Before environment runs
before_script:
- ls

#Run a dummy command
script: ls

matrix:
allow_failures:
- php: 5.6

#Branches to be deployed
branches:
only:
- develop

sudo: required

#Services to run on the instance
services:
- docker

#Push the docker image on to DockerHub
install:
- docker build -t tilaks/laravel-portal .
- docker ps -a
- docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
- docker push tilaks/laravel-portal

#Zip the artifacts to be deployed
before_deploy:
- pwd
- cd /home/travis/build/airavata-courses/spring17-laravel-portal/
- zip -r spring17-laravel-portal.zip Dockerfile app bootstrap config package.json readme.md scripts tests LICENSE appspec.yml composer.json database phpunit.xml resources server.php Trigger.txt artisan composer.lock gulpfile.js public routes storage .env.example || true
- mkdir -p "dpl_cd_upload"
- mv spring17-laravel-portal.zip dpl_cd_upload/spring17-laravel-portal.zip || true

#Instructions to to deploy
deploy:
- provider: s3
access_key_id: $AWS_ACCESS_KEY # declared in Travis repo settings
secret_access_key: $AWS_SECRET_KEY
access_key_id: $AWS_ACCESS_KEY #Declared in Travis repository settings
secret_access_key: $AWS_SECRET_KEY #Declared in Travis repository settings
bucket: laravel-portal-bucket
local_dir: dpl_cd_upload
region: us-west-2
Expand All @@ -49,8 +57,8 @@ deploy:
branch: develop

- provider: codedeploy
access_key_id: $AWS_ACCESS_KEY # declared in Travis repo settings
secret_access_key: $AWS_SECRET_KEY
access_key_id: $AWS_ACCESS_KEY #Declared in Travis repository settings
secret_access_key: $AWS_SECRET_KEY #Declared in Travis repository settings
bucket: laravel-portal-bucket
key: spring17-laravel-portal.zip
bundle_type: zip
Expand Down
8 changes: 4 additions & 4 deletions scripts/before-install.sh
Expand Up @@ -4,7 +4,7 @@ sudo rm -rf /home/ec2-user/laravel-portal/ || true
echo 'Creating destination directory'
sudo mkdir /home/ec2-user/laravel-portal/

echo 'Check if PHP is installed'
echo 'Check if PHP is installed. If not, install it on the instance'
php --version
if [ "$?" -ne 0 ]; then
sudo yum clean all
Expand All @@ -21,7 +21,7 @@ if [ "$?" -ne 0 ]; then
sudo yum -y update
fi

echo 'Check if Composer is installed'
echo 'Check if Composer is installed. If not, install it on the instance'
composer --version
if [ "$?" -ne 0 ]; then
cd ~/
Expand All @@ -32,7 +32,7 @@ if [ "$?" -ne 0 ]; then
sudo alias composer='/usr/local/bin/composer'
fi

echo 'Check if Docker is installed'
echo 'Check if Docker is installed. If not, install it on the instance'
docker -v
if [ "$?" -ne 0 ]; then
sudo yum install -y docker-io
Expand All @@ -41,7 +41,7 @@ fi
echo 'Add current user to Docker group'
sudo usermod -aG docker $(whoami)

echo 'Starting Docker services'
echo 'Start Docker services'
sudo service docker start

echo 'Remove existing containers if any'
Expand Down
10 changes: 8 additions & 2 deletions scripts/install.sh
@@ -1,19 +1,25 @@
echo 'Deploying Laravel Portal'
echo 'Deploy the Laravel Portal'
cd /home/ec2-user/

echo 'Move files to laravel-portal'
sudo mv Dockerfile app bootstrap config package.json readme.md scripts tests LICENSE appspec.yml composer.json database phpunit.xml resources server.php Trigger.txt artisan composer.lock gulpfile.js public routes storage .env.example laravel-portal/
cd laravel-portal/
sudo chmod -R 777 /home/ec2-user/laravel-portal/
cp .env.example .env

echo 'Install Composer to generate vendor packages'
composer install >> /var/log/composer.log 2>&1 &
sudo chmod -R 777 /home/ec2-user/laravel-portal/

echo 'Generate the Artisan key'
php artisan key:generate

echo 'Run the Laravel Portal'
php artisan serve --port=3000 --host=0.0.0.0 & >> /var/log/composer.log 2>&1 &
php artisan serve --port=4000 --host=0.0.0.0 & >> /var/log/composer.log 2>&1 &
php artisan serve --port=5000 --host=0.0.0.0 & >> /var/log/composer.log 2>&1 &

echo 'Running Docker container'
echo 'Running the Docker container'
sudo docker login -e="sneha.tilak26@gmail.com" -u="tilaks" -p="laravel"
sudo docker pull tilaks/laravel-portal
sudo docker images | grep '<none>' | awk '{print $3}' | xargs --no-run-if-empty docker rmi -f
Expand Down

0 comments on commit 8d88be1

Please sign in to comment.