Skip to content

Instantly share code, notes, and snippets.

@kaustubhmalgaonkar
Last active June 30, 2017 09:18
Show Gist options
  • Save kaustubhmalgaonkar/980c8b12ff59d97c9d3dbcfa8716d940 to your computer and use it in GitHub Desktop.
Save kaustubhmalgaonkar/980c8b12ff59d97c9d3dbcfa8716d940 to your computer and use it in GitHub Desktop.
Autodeploy Laravel Application
# git current release id
RELEASEID=$1
USERNAME=$2
PASSWORD=$3
APPNAME="trualta"
cd $APPNAME
if [ ! -d "releases" ]; then
mkdir releases
fi
cd releases
# clone git current release with username and password
git clone https://$USERNAME:$PASSWORD@github.com/fwmobiledev/trualta_app.git $RELEASEID
# checking if storage directory exists
if [ ! -d "../storage" ]; then
cp -r $RELEASEID/storage ../storage
fi
cd $RELEASEID
# Create .env file symlink
ln -s ../../.env ./
composer install --no-interaction
php artisan migrate --no-interaction --force
# Create symlink of Main storage folder in to current release
rm -r storage
ln -s ../../storage storage
# Create symlink of Main storage folder to access files from public/storage to storage/app/public
php artisan storage:link
cd ../../
# check if current symlink is exists
if [ -d "current" ]; then
rm current
fi
# creating current release symlink
ln -s releases/$RELEASEID current
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment