Strapi-Heroku- deployment

Strapi-Heroku- deployment

This is a step-by-step guide for deploying a Strapi on Herok. The guide follows the deployment strapi-heroku documentation.

This documentation assumes that you have already created a strapi project with
--quickstart and have pushed the repository to GitHub

Requirements

  1. You must have Git installed and set-up locally .
  2. You must have a free Heroku account before doing these steps.
  3. Download and install the Heroku CLI for your operating system

ForHeroku CLI installation follow this

At this moment Heroku github deployment is not woriking due to internal-server error. For that reason, we will be deploying our project from the local repository to Heroku.

Create an app on heroku

  1. From your browser, navigate to the Heroku dashboard, id.heroku.com.
  2. Click New.
  3. Select Create new app.

Login to Heroku from your CLI

Next, you need to login to Heroku from your computer.

heroku login

Follow the instructions and return to your command line.

update .gitignore

add your package-lock.json file path at the end of your .gitignore file

commit your repository and initialize your local project

init your repository and commit the files

cd my-project
git init
git add .
git commit -m "Initial Commit"
git remote add heroku git@heroku.com:my-app.git // dot forget change 'my-app with your app's name'

stage, commit, and push changes

Now that your repository is initialized, you can use the following commands to push your changes

git add .
git commit -am "commit message goes here"
git push heroku main

tip: make sure your default branch is main. If not, change accordingly. reference

If everything is running smoothly until this point, follow the documentation starting from Heroku Postgres