Create a deployment script
#!/bin/sh
UNIX_TIME=$(date +%s)
DEPLOYMENT_DIRECTORY=$UNIX_TIME
PROJECT=$(pwd)
mkdir -p $DEPLOYMENT_DIRECTORY
git clone --depth 1 -b main git@github.com:novateltd/example.org.git $DEPLOYMENT_DIRECTORY
cd $DEPLOYMENT_DIRECTORY
cp ../master/.env .
php81 /usr/local/bin/composer.phar install --no-dev
cd ..
#link to the latest deployment from Live
ln -v -s -n -f -T $DEPLOYMENT_DIRECTORY Live
# create a link from deployment storage to master/storage
rm -rf $DEPLOYMENT_DIRECTORY/storage
ln -v -s -n -f -T $PROJECT/master/storage $DEPLOYMENT_DIRECTORY/storage
#echo link public to storage
ln -v -s -n -f -T $PROJECT/master/storage/app/public $DEPLOYMENT_DIRECTORY/public/storage
cd Live
php81 artisan cache:clear
php81 artisan route:cache
php81 artisan config:cache
echo Deployed. Migrations required?
echo Configuring the script for your repo
php version for Artisan
Make your script executable
migrating your database
Composer Version issues
Last updated