Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 0.0 | ||
os: linux | ||
files: | ||
- source: / | ||
destination: /home/ec2-user/laravel-portal | ||
hooks: | ||
BeforeInstall: | ||
- location: scripts/before-install.sh | ||
timeout: 3600 | ||
runas: root | ||
ApplicationStart: | ||
- location: scripts/install.sh | ||
timeout: 3600 | ||
runas: root |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
echo 'Update OS' | ||
sudo yum -y update | ||
|
||
echo 'Check if PHP is installed' | ||
php --version | ||
if [ "$?" -ne 0 ]; then | ||
sudo yum clean all | ||
sudo yum -y update | ||
sudo yum -y install epel-release | ||
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm | ||
wget https://centos6.iuscommunity.org/ius-release.rpm | ||
sudo rpm -Uvh ius-release*.rpm | ||
sudo yum -y update | ||
sudo yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath | ||
fi | ||
|
||
echo 'Check if Laravel is installed' | ||
cd /var/www/laravel-develop/ | ||
if [ "$?" -ne 0 ]; then | ||
curl -sS https://getcomposer.org/installer | php | ||
sudo mv composer.phar /usr/local/bin/composer | ||
chmod +x /usr/local/bin/composer | ||
wget https://github.com/laravel/laravel/archive/develop.zip | ||
unzip develop.zip | ||
mv laravel-develop /var/www/ | ||
sudo rm -rf develop.zip | ||
cd /var/www/laravel-develop/ | ||
composer install | ||
fi | ||
|
||
echo 'Update Composer' | ||
composer update | ||
|
||
echo 'Move back to ec2-user directory' | ||
cd /home/ec2-user | ||
|
||
echo 'Check if Docker is installed' | ||
docker -v | ||
if [ "$?" -ne 0 ]; then | ||
sudo yum install -y docker-io | ||
fi | ||
|
||
echo 'Starting Docker services' | ||
sudo service docker start | ||
|
||
echo 'Remove existing containers if any' | ||
sudo docker ps -a | grep -w "laravel-container" | awk '{print $1}' | xargs --no-run-if-empty docker stop | ||
sudo docker ps -a | grep -w "laravel-container" | awk '{print $1}' | xargs --no-run-if-empty docker rm | ||
|
||
echo 'Remove existing images if any' | ||
sudo docker images | grep -w "laravel-image" | awk '{print $3}' | xargs --no-run-if-empty docker rmi -f |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
echo 'Deploying Laravel Portal' | ||
cd '/home/ec2-user/laravel-portal' | ||
|
||
echo 'Run Laravel' | ||
php -S localhost:4000 |