-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Installation: Linux: Heroku
Faiz-ur Rahman edited this page Apr 30, 2021
·
2 revisions
- Fork this repo
- Create a new Heroku app from your Heroku dashboard (Create new app)
- After creation go to the Deploy tab and under Deployment method connect to the forked repo you created in step 1.
- After it's connected it'll look like this.
- After it's connected it'll look like this.
- Download your forked repo and run
npm install
- Set up the
dotenv
file to your liking-
IMPORTANT
OPEN_BROWSER
needs to be set tofalse
in thedotenv
file, otherwise it will error when running on Heroku
-
IMPORTANT
- Run the app with
npm run start
and verify everything is working to your liking
-
Create a
Procfile
in the root directory of the project and add the following line:
worker: npm run start:production
- We use
worker
or else Heroku will timeout by attempting to bind to aport
. Also notice we're using thestart:production
target. When you push to Heroku, your code is already compiled bytsc
.
- We use
-
Remove
build/
anddotenv
from the.gitignore
file- If you didn't test locally in the previous section, make sure to run
npm run start
at least once so that yourbuild/
folder is created.
- If you didn't test locally in the previous section, make sure to run
-
Update
puppeteer
args in themain
function inindex.ts
const args: string[] = [ '--no-sandbox', '--disable-setuid-sandbox' ];
-
Commit all these changes to the forked repo
-
Add the puppeteer and nodejs buildpacks in settings in your Heroku dashboard
- Manually add
https://github.com/jontewks/puppeteer-heroku-buildpack
to the "buildpacks" list - Add nodejs from the prepopulated choices
- It should look like this afterwards
- Manually add
- In the deploy tab of your Heroku project, scroll down to Manual deploy, and click Deploy Branch
- Wait for the build to finish deploying
- Click More (top right of the screen) > View Logs
- CONGRATS! You should now see the same output as you would if you were running this app locally
↩️ Go back to Home