This is boilerplate Laravel 5.7 project similar to what the laravel new or composer create-project commands create.
This project can be used as is as a shortcut to deploying a Laravel 5.6 app on heroku, or used as a guide.
- Procfile defining a web process using nginx and a worker process for running queues
- Database configuration defaults set to use Postgres and to parse heroku-postgres
DATABASE_URLenvironment variable - Redis configuration setup to use heroku-redis
REDIS_URLenvironment variable - Failed job database configuration defaulting to postgres
- A heroku app.json and post-deployment script (
php artisan postdeploy:heroku)for use with Heroku Review Apps - TrustedProxies middleware configured to trust Heroku load balancers correctly
- npm task named "postinstall" that is run during heroku deployments
- Heroku specific logging configuration set as the default.
- Pinned to PHP 7.2 (
~7.2.0) - Setup with bootstrap scaffolding (
php artisan preset bootstrap)
1. Database, app key, .env
Clone this repository and run the following commands:
composer install
cp .env.example .env
touch database/database.sqlite
php artisan key:generate
php artisan migrate
npm install
npm run dev2. Run
php artisan serve1. Create a Heroku app
Create an app name
app_name=heroku-laravel57-test-appCreate Heroku app
heroku apps:create $app_name
heroku addons:create heroku-postgresql:hobby-dev --app $app_name
heroku addons:create heroku-redis:hobby-dev --app $app_name
heroku buildpacks:add heroku/php --app $app_name
heroku buildpacks:add heroku/nodejs --app $app_name2. Add Heroku git remote
heroku git:remote --app $app_name3. Set config parameters
For Laravel to operate correctly you need to set APP_KEY:
heroku config:set --app $app_name APP_KEY=$(php artisan --no-ansi key:generate --show)Set Queues, sessions and cache to use redis
heroku config:set --app $app_name QUEUE_CONNECTION=redis SESSION_DRIVER=redis CACHE_DRIVER=redisOptionally set your app's environment to development
heroku config:set --app $app_name APP_ENV=development APP_DEBUG=true APP_LOG_LEVEL=debug4. Deploy to Heroku
git push heroku master5. Run migrations
heroku run -a $app_name php artisan postdeploy:herokuThe Laravel framework is open-sourced software licensed under the MIT license.