Skip to content

Instantly share code, notes, and snippets.

@strike65
Created August 28, 2019 16:47
Show Gist options
  • Select an option

  • Save strike65/2fd6dd8cfe852e57317c878a1c68084e to your computer and use it in GitHub Desktop.

Select an option

Save strike65/2fd6dd8cfe852e57317c878a1c68084e to your computer and use it in GitHub Desktop.
Deploy an Laravel App the "save" way
#!/bin/bash
cd /path/to/app
sudo chown -R githubuser:githubuser /path/to/app
php artisan down
git fetch && git reset --hard origin/master
cat << EOF > .env
APP_NAME=APP_NAME
APP_ENV=production
APP_KEY=<YOUR KEY>
APP_DEBUG=false
APP_URL=<YOUR URL>
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=<YOUR DATABASE>
DB_USERNAME=<YOUR DATABASE USER>
DB_PASSWORD="<YOUR DATABASE PASSWORD>"
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
EOF
composer install
php artisan cache:clear && php artisan queue:restart
npm run production
sudo systemctl restart php7.3-fpm.service && php artisan up
sudo chown -R www-data:www-data /path/to/app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment