Skip to content

Instantly share code, notes, and snippets.

@jahidulsaeid
Last active September 2, 2019 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jahidulsaeid/3dd0a074076efe0ae1705264eaee2648 to your computer and use it in GitHub Desktop.
Save jahidulsaeid/3dd0a074076efe0ae1705264eaee2648 to your computer and use it in GitHub Desktop.
Laravel Project Deployment in Heroku

Laravel Heroku Deployment

Install Heroku CLI

https://devcenter.heroku.com/articles/heroku-cli

Create Procfile Inside the Laravel Root folder, make a file called Procfile.

touch Procfile (web: vendor/bin/heroku-php-apache2 public/)

Login via CLI

heroku login

Create app

heroku create appname

Deploy with Git

git init
git add .
git commit -m 'Deploy'

heroku git:remote -a appname
OR
git remote add heroku git-url

git push heroku master

Setup env variable setup

https://dashboard.heroku.com/apps/***appname***/resources

Add a addons

Search: Heroku Postgres

See database info

heroku pg:credentials:url

You also see database info from postgres option

Click -> Heroku Postgress > Setting > View Credentials… 

Open .env file and add APP & DB connection

heroku config:add App_NAME=Laravel
heroku config:add database
OR
heroku config:add DB_CONNECTION=pgsql DB_HOST=ec2-50-19-109-120.compute-1.amazonaws.com DB_PORT=5432 DB_DATABASE=d1ite58p8mnakv DB_USERNAME=slvbllpbwvvaok DB_PASSWORD=d85269d6c46296406914a6807824f1caaaa6200f0c6e511ba42540991a102bcb

heroku run php artisan migrate

Add the files on the Heroku.

git add .
git commit -m "added auth scaffold"
git push heroku master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment