Skip to content

Instantly share code, notes, and snippets.

@meganlkm
Last active April 17, 2016 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save meganlkm/a2abe36af1478a0a49f9 to your computer and use it in GitHub Desktop.
Save meganlkm/a2abe36af1478a0a49f9 to your computer and use it in GitHub Desktop.
deploy laravel project to a shared hosting provider
#!/bin/bash
PRJ_HOME=$(pwd)
REPO_URL='git@github.com:username/repo.git'
BUILD_DIR=${PRJ_HOME}/project-build
APP_DIR=${BUILD_DIR}/my-app
RSYNC_CMD='rsync -avz -e ssh --exclude-from ./.build-exclude'
COMPOSER_CMD='composer install'
if [[ -d $BUILD_DIR ]]; then
echo "${BUILD_DIR} is in the way.."
exit 1
fi
mkdir $BUILD_DIR && cd $BUILD_DIR
case "$1" in
dev)
echo "Building dev..."
git clone -b develop $REPO_URL .
perl -pi -e 's|production|dev|' $APP_DIR/bootstrap/start.php
cd $APP_DIR
$COMPOSER_CMD
cd $BUILD_DIR
$RSYNC_CMD ./ myappserver:~/dev/ --delete
;;
stage)
echo "Building stage..."
git clone -b master $REPO_URL .
perl -pi -e 's|production|stage|' $APP_DIR/bootstrap/start.php
cd $APP_DIR
$COMPOSER_CMD --no-dev
cd $BUILD_DIR
$RSYNC_CMD ./ myappserver:~/stage/ --delete
;;
production)
echo "Building production..."
git clone -b master $REPO_URL .
cd $APP_DIR
$COMPOSER_CMD --no-dev
cd $BUILD_DIR
$RSYNC_CMD ./myappserver-app/ myappserver:~/myappserver-app/ --delete
$RSYNC_CMD ./public_html/ myappserver:~/public_html/ --delete
;;
*)
echo $"Usage: $0 {dev|stage|production}"
esac
cd $PRJ_HOME
rm -rf $BUILD_DIR
@hostinglaravel
Copy link

http://hostinglaravel.com/planes.php
Hosting for developers and programmers. Pay only for what you need, you can migrate to a more advanced plan at any time, CMS (Wordpress, Joomla, Drupal ...) and Framework (Laravel, Django, Ruby on rails). Hosting high performance SSD for your applications and Web pages that load 300% faster !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment