Simple Magento Deployment Script

Here is a quick bash script I created to do a magento deployment. This assumes your magento code is managed by git and you have n98-magerun v1.100 or greater installed on the server. Run this in your project root like “bash mybranchname;” .

echo "fetching new branches";
git fetch;
echo "creating maintenance file";
touch maintenance.flag;
echo "checking out" $1;
git checkout $1;
echo "clearing cache";
n98-magerun cache:flush;
echo "clearing JS and CSS cache";
n98-magerun media:cache:jscss:clear;
echo "running installers";
n98-magerun sys:setup:run;
echo "removing maintenance file";
rm maintenance.flag;
echo "done";

Leave a comment

Your email address will not be published. Required fields are marked *