03. Heroku

Heroku is going to act like the middleman between our device and our database. Our app/frontend client/Twilio will communicate directly with the app we put on Heroku and Heroku will send/get everything we need from our database (mLab)

  1. Go to heroku.com and sign up for an account. I recommend using an anonymous name/email because as you'll see in the first line of the TOS summary (after confirming your email)

Effective October 1, 2020, you agree that your use of the Heroku Services is governed by the Salesforce Master Subscription Agreement...

The phrase "Abandon hope all ye who enter here" immediately comes to mind.

  1. After accepting your fate, click the Accept button to enter the Heroku dashboard

  2. Click the "Create New App" button

  3. Give your app a name. I'm going to name mine shsms-heroku-server-01 and click "Create App"

  4. Near the top of the page there should be a horizontal menu, go to the "Settings" page. We need to add our environmental variables to Heroku.

  5. In the "Config Vars" section, click the button to "Reveal Config Vars" and you should see two text fields. These correlate to our .env we will make once we clone the backend repo. Let's add all of those now.

    Protip: Open a text editor and copy/paste this snippet and edit the information. Then copy/paste them in to Heroku one by one. We're going to use all of these again in a minute anyway. The capitalized value before the equal (=) sign is the KEY and after it is the VALUE, if that wasn't obvious...

    TWILIO_ACCOUNT_SID=IE3c56b36c9832678w32df32f1x99c1arb
    TWILIO_AUTH_TOKEN=0re339862f7ef3aq38o2c8ch6km110aa
    MONGO_DB_URI=mongodb+srv://shSMS-admin:dont_hack_me_bro@shsms-cluster.lq31i.mongodb.net/shSMS?retryWrites=true&w=majority
    DEV_SERVER=https://shsms-heroku-server-01.herokuapp.com
    REQ_TOKEN=THIS_IS_YOUR_SECRET_KEY_IT_CAN_BE_ANYTHING

    Your final Config Vars should look something like this (but with your own values) NOTE: You do NOT need to add the TWILIO_PHONE_NUMBERvariable like in the screenshot below. In the latest version (1.1.0) of shSMS that has been removed to allow multiple phone numbers. It won't break anything if it's in there, but there's no need to add it. I will take a new screenshot eventually...

    Heroku vars

  6. Install the Heroku CLI because we're going to use this to deploy our project to Heroku. You might be asking yourself "Why aren't we just connecting it to a fork of the repo on Github??". Well, because I personally prefer to connect as little as possible to each other and have total control over where all the pieces are. This may be an extra step depending on how you look at it, but it allows me to make changes locally without having to send them to Github if I don't want to. To each their own I guess...

    If you're using a Debian based Linux distribution, Snapd should already be installed on your machine. Go to your terminal and install Heroku CLI by typing

    sudo snap install --classic heroku

    If you're on an Arch based system, try

    yay -S heroku-cli

    Type heroku -v in the terminal to confirm it installed Installing the CLI is all we're going to do with it until we're ready to deploy our project. We'll come back to this after we set up Twilio.

Last updated