This is a step-by-step guide for deploying a Strapi on heroku. The guide follows the documentation strapi-heroku deployment.
This documentation assumes that you have already created a strapi project with
--quickstart
and have pushed the repository to Github
- You must have Git installed and set-up locally .
- You must have a free Heroku account before doing these steps.
- 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.
- From your browser, navigate to the Heroku dashboard, https://id.heroku.com.
- Click New.
- Select Create new app.
Next, you need to login to Heroku from your computer.
heroku login
Follow the instructions and return to your command line.
add your package-lock.json
file path at the end of your .gitignore file
init your repository and commit the files
cd my-project
git init
git add .
git commit -m "Initial Commit"
git remote add heroku [email protected]:my-app.git //change 'my-app with your app's name'
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 runing smoothly until this point, follow the documentation starting from Heroku Postgres