07. Installing shSMS Server

If you haven't figured it out yet, our Raspberry Pi is basically the same exact setup as our main Ubuntu computer, but without all the desktop "features" slowing us down/getting in our way. We've got the same folder structure and we can run pretty much all the same things, but instead of opening a terminal window, we've just got it full screen right from the start!

  1. I like to create a folder to hold all my shSMS stuff in case I want to save a backup locally at some point and revert back to it. So I'll make a folder in my home directory called shSMS and clone the repo there

git clone https://github.com/pywkt/shsms-backend ~/shSMS/shsms-backend

Navigate to the cloned directory: cd ~/shSMS/shsms-backend

  1. Install all the things: npm install

  2. Create an .env file to store all our sssseeccrreetttsssss

touch .env

  1. I'll copy/paste from the "Clone the Repo" section of the Heroku tutorial about filling out the .env through the terminal:

    • nano .env

    • Copy the sample below, but fill in with your own information!

    • ctrl + o (save changes)

    • Enter (confirm that you want to overwrite the file)

    • ctrl + x (exit the Nano text editor)

    • cat .env (print the file to the screen and make sure your changes are correct and saved)

    • clear (clear the terminal in case some shady fools walk past you and want to take all your base)

    Do not use any kind of quotes/spaces/parenthesis around the values after the equal (=) sign. Your final .env should look something like this Read the Protip below for an easy-ish way to do this without having to type everything out

TWILIO_ACCOUNT_SID=IE3c56b36c9832678w32df32f1x99c1arb
TWILIO_AUTH_TOKEN=0re339862f7ef3aq38o2c8ch6km110aa   MONGO_DB_URI=mongodb://127.0.0.1:27017/compressors=disabled&gssapiServiceName=mongodb
DEV_SERVER=
REQ_TOKEN=THIS_IS_YOUR_SECRET_KEY_IT_CAN_BE_ANYTHING

TWILIO_ACCOUNT_SID - Your Twilio SID (found on the main page of your Twilio console). TWILIO_AUTH_TOKEN - This is directly below the SID, but it's hidden. Just click to show it. MONGO_DB_URI - That MongoDB thing we copied earlier. Make sure to replace the password and database name. DEV_SERVER - Leave this blank for now. We'll come back to it in a minute. REQ_TOKEN - Any "password" unique to you. This is used as validation in all requests to your server and will be used in several places and you can change it at any time.

Protip: On your main (non Raspberry Pi) computer:

  • touch dataStuff.txt

  • Copy/paste the example above

  • Copy/paste all your own info/keys and save

  • In a terminal, in that folder ip a | grep 192.168

  • Notice the ip address that starts with 192.168.

  • Start a simple server: python3 -m http.server

  • On the Pi now, (in the shsms-backend folder), get the file you just made: wget http://192.168.X.XXX/dataStuff.txt

  • Rename the file: mv dataStuff.txt .env

  • Make sure it worked: cat .env

  • Delete dataStuff.txt on the main computer.

Last updated