Deploybot Laravel Commands

Posted 5 months ago     493      laravel deploybot

Sometimes you might need to keep folders such as upload folders, or session and it's a bit of a pain to write a script for one so here's the one I use for my Laravel project:

# Create a shared vendor directory and symlink it to the project root
mkdir -p $SHARED/vendor
ln -s $SHARED/vendor $RELEASE/vendor

# Create a shared storage directory and symlink it to the project root
if [ ! -d "$SHARED/storage" ]; then
  mkdir -p $SHARED/storage
  mv app/storage/* $SHARED/storage/
  chmod -R 775 $SHARED/storage
fi

rm -rf app/storage
ln -s $SHARED/storage $RELEASE/app/storage
chmod -R 775 app/storage

# Create a shared storage directory and symlink it to the project root
if [ ! -d "$SHARED/public/uploads" ]; then
  mkdir -p $SHARED/public/uploads
  mv public/uploads/* $SHARED/public/uploads/
  chmod -R 775 $SHARED/public/uploads
fi

rm -rf public/uploads
ln -s $SHARED/public/uploads $RELEASE/public/uploads

composer clear-cache
composer dump-autoload
composer update --no-scripts
php artisan migrate --force

Add it to the "Run commands after new version is uploaded" block

Comments

There are no comments yet.

You need to be logged in to post comments.



Welcome to Snippet Repo!

Discover, share and save useful code snippets.

Join our community over over 2,000 members! Currently a 48% acceptance rate. Apply for membership →