Skip to content

Latest commit

History

History
77 lines (46 loc) 路 1.46 KB

File metadata and controls

77 lines (46 loc) 路 1.46 KB

Laravel Heroku Deployment Tutorial

Creating a Procfile

$ echo web: vendor/bin/heroku-php-apache2 public/ > Procfile

Create or Link Heroku

Create a Heroku App:

$ heroku create

Or link project to existing Heroku App:

$ git remote add heroku git@heroku.com:<app-name>.git

Change <app-name> to your Heroku App name

Setup Database

Add a PostgreSQL Database

$ heroku addons:create heroku-postgresql:hobby-dev

Add database credentials to the Heroku App

Go to https://dashboard.heroku.com/apps and click on your Application.

Click on the Installed add-ons -> Heroku Postgres

From the new website, click on Settings -> View Credentials to see database credentials

Go back to the website https://dashboard.heroku.com/apps/ and click on Settings -> Reveal Config Vars

Add the following to the config vars:

DB_CONNECTION -> pgsql

DB_DATABASE -> Database from Database Credentials

DB_HOST -> Host from Database Credentials

DB_PASSWORD -> Password from Database Credentials

DB_PORT -> Port from Database Credentials

DB_USERNAME -> User from Database Credentials

Migrate

Run php migrations

$ heroku run php /app/artisan migrate

Or you can use heroku bash to migrate

$ heroku run bash
$ php artisan migrate

Reference

Getting Started with Laravel on Heroku