The first thing I did was install Heroku on Windows
I used cmd.exe to access my Windows command prompt followed all the prompts and set up my Heroku account
I then cloned the sample app source code
by using Heroku create I created an app
I deployed the app by typing git push heroku main
I used heroku open but that didn’t work. I had to manually open the heroku app in my browser
To view the logs on your app you type heroku logs –tail
procfile - a text file in the root directory of your application, to explicitly declare what command should be executed to start your app.
web: node index.js is an example
This declares a single process type, web, and the command needed to run it
The name web is important here. It declares that this process type will be attached to the HTTP routing stack of Heroku, and receive web traffic when deployed.
a dyno is a lightweight container that runs the command specified in the Procfile
To check how many dynos are running use the ps command
heroku ps
By default, your app is deployed on a free dyno. Free dynos will sleep after a half hour of inactivity (if they don’t receive any traffic). This causes a delay of a few seconds for the first request upon waking. Subsequent requests will perform normally. Free dynos also consume from a monthly, account-level quota of free dyno hours - as long as the quota is not exhausted, all free apps can continue to run.
To avoid dyno sleeping, you can upgrade to a hobby or professional dyno type
Scaling an application on Heroku is equivalent to changing the number of dynos that are running.
the command to scale is
heroku ps: scale web=0
to open it again hit refresh on the web tab or type heroku open
to scale it up again :
heroku ps: scale web=1
For abuse prevention, scaling a non-free application to more than one dyno requires account verification.
heroku recognizes an app as Node.js by the existence of a package.json file in the root directory.
To create one:
npm init --yes.
The package.json file determines both the version of Node.js that will be used to run your application on Heroku, as well as the dependencies that should be installed with your application.
to install dependencies locally you type
npm install
When an app is deployed, Heroku reads the package.json to install the appropriate node version and the package-lock.json to install the dependencies.
To run the app locally you type
heroku local web
Just like Heroku, heroku local examines the Procfile to determine what to run.
I changed some code and added a cool ASCII face
then I ACPd like normal.
Add-ons are third-party cloud services that provide out-of-the-box additional services for your application, from persistence through logging to monitoring and more.
By default, Heroku stores 1500 lines of logs from your application. However, it makes the full log stream available as a service - and several add-on providers have written logging services that provide things such as log persistence, search, and email and SMS alerts.
https://deannaj401.github.io/reading-notes/