Steps to swiftly deploy your Laravel app on Heroku

Steps to swiftly deploy your Laravel app on Heroku

In this video tutorial, you will walk through the step by step configuration and deployment of a Laravel 5 application to Heroku platform. And you will also ...

  1. Create the Procfile and add it to your repo. The content should look like this:
web: vendor/bin/heroku-php-apache2 public/
  1. Set up the ENV variables. You can do this using Heroku cli and entering this command line:
heroku config:add APP_KEY="base64:enter_your_key" --app 

or from Heroku interface by selecting the app and going to Settings -> Config Variables -> Reveal

  1. Update the log setting to errorlog. Put this in the app config file:
'log' => 'errorlog'

Now the real gold nuggets I learned the hard way

  1. The Heroku database is usually in Postgres. And there are a few differences from MySql: char fields, enum fields etc. So you better build the project directly on Postgres.

  2. The database config file on Larvel should look like this:

'host' => getenv("DATABASE_URL") ? parse_url(getenv("DATABASE_URL"))["host"] : '',
'port' => getenv("DATABASE_URL") ? parse_url(getenv("DATABASE_URL"))["port"] : '',
'database' => getenv("DATABASE_URL") ? substr(parse_url(getenv("DATABASE_URL"))["path"], 1) : '',
'username' => getenv("DATABASE_URL") ? parse_url(getenv("DATABASE_URL"))["user"] : '',
'password' => getenv("DATABASE_URL") ? parse_url(getenv("DATABASE_URL"))["pass"] : '',
  1. Heroku relies on composer.lock to build the environment and pull the required packages. So if you need some libraries or extensions that are not built-in (e.g. gd library for images) and you cannot add them to your composer.json you can add them manually to the composer.lock file. Here is a step by step guide. Also, here you can find a list of available extensions for Heroku.

  2. Symlinks do not work. So don’t use the storage folder to save resources, better use a CDN.

  3. You can add a free app in Heroku to test you project.

  4. You can use iseed package to create seed files in order to populate your database.

  5. You can run commands with Heroku CLI. For example, Artisan commands can be called like this:

heroku run "php artisan migrate" --app heroku-app-name

That’s all folks! I wish you easy deployment.

For more detailed info on how to get started with Laravel on Heroku you can go trough this article: Deploy Laravel app on Heroku

https://www.youtube.com/watch?v=639Pe0PpVLQ

laravel heroku tutorial devops

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Laravel Google Line Chart Tutorial Example

laravel line chart example, laravel google charts api, google line charts in laravel, laravel google line chart js, laravel google line charts tutorials

Laravel Google Bar Charts Example Tutorial

how to create google bar charts in laravel, laravel google bar charts example, google bar charts in laravel, laravel google bar charts using google api, google bar charts laravel, dynamic bar charts in laravel, laravel google bar charts example tutorial, Dynamic Bar Charts Example Using Google Charts in Laravel

Laravel 7 Tutorial for Beginner: Create your First To-Do App

Laravel Tutorial for Beginners - Learn Laravel in simple and easy steps starting from basic to advanced concepts by creating your first application

Laravel 8 Tutorial For Beginners

In this tutorial, i will provide you some useful tutorial of laravel 8 version. So, you can learn laravel 8 an easy way. <div style = "background-color:#cce5f6;border-left:solid 4px...

Laravel 8 Form Example Tutorial - Complete Guide

Laravel 8 form example tutorial. In this post, i will show you how to send form data on controller and insert in database using laravel 8