MythicAI / laravel-heroku

Laravel 5.6 configured for Heroku

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Heroku Laravel Example

This is boilerplate Laravel 5.6 project similar to what the laravel new, composer create-project commands create.

This project can be used as is as a shortcut to deploying Laravel 5.5 on heroku, or used as a guide.

Heroku Specific Configurations

  • Procfile defining a web process using nginx and a worker process for running queues
  • Database configuration defaults to use Postgres using heroku-postgres DATABASE_URL environment variable
  • Redis configuration setup to use heroku-redis REDIS_URL environment variable
  • Failed job database configuration defaults to postgres
  • A heroku app.json and post-deployment script for use with Heroku Review Apps
  • Laravel 5.5 TrustedProxy middleware configured to trust Heroku load balancers correctly

Additional Configurations

  • App is Pinned to PHP 7.1 (~7.1.0)

Local Development

1. Database, app key, .env

Clone this repository and run the following commands:

cp .env.example .env
composer install
php artisan key:generate
touch database/database.sqlite
php artisan migrate

2. Run

php artisan serve

Deploying to Heroku

1. Create a Heroku App

Setup an app name

app_name=heroku-laravel55-test-app

Create a 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
heroku buildpacks:add heroku/nodejs

2. Add Heroku git remote

heroku git:remote --app $app_name

3. Set config parameters

To operate correctly you need to set APP_KEY:

heroku config:set APP_KEY=$(php artisan --no-ansi key:generate --show)
heroku config:set APP_LOG=errorlog 

Configure additional parameters to utilise redis

heroku config:set QUEUE_DRIVER=redis SESSION_DRIVER=redis CACHE_DRIVER=redis

Optionally set your app's environment to development

heroku config:set APP_ENV=development APP_DEBUG=true APP_LOG_LEVEL=debug

4. Deploy to Heroku

 git push heroku master

Or click the button below to deploy to Heroku instantly.

Deploy


License

The Laravel framework is open-sourced software licensed under the MIT license.

About

Laravel 5.6 configured for Heroku

License:MIT License


Languages

Language:PHP 94.3%Language:HTML 3.5%Language:JavaScript 1.5%Language:Vue 0.7%