Common CLI Tasks

Stephan Smith
Mechanics of Search
2 min readOct 27, 2019

As you work through the code and tasks to build out your search engine, you are going to need to remember a few common command-line (err..) commands.

How to Check Heroku Logs?

Heroku is the glue that bridges your Takeshape content to your Algolia Indexes. As you build out your Takeshape data you will find that you need to make changes to the code that watches for changes in Takeshape.

The following shows you have to monitor the Heroku microservice.

heroku logs -t

Note: The -t argument tells Heroku to keep sending down log messages as they are generated. To break out of this flow, us ‘command + c’ to return to the command line prompt.

How to push code to Heroku?

This task is something you will need to do a few times as you update the microservice on Heroku. Heroku uses Git for code changes. The following command will let you push your ‘committed’ changes to your Heroku App.

git push heroku

How to get my Heroku App URL?

Every Heroku app has its own unique URL. You will need this URL when you set up your Takeshape.io Webhook. There are two ways to get the URL.

First you can get the information using the Heroku CLI. Use this command from the root of your git repo.

heroku info

This command will yield the following in your terminal. Note the URL value for the app.

Output from the ‘heroku info’ command.

The second way to find the app URL is to open the Heroku console. Notice the ‘Open App’ button in the upper right-hand corner.

How to edit Heroku Configuration Variables?

To keep your Algolia and Takeshape API keys save, you need to keep them in Heroku configuration variables. You can edit these in two ways, on the command line, or in the Heroku App Console. I recommend you use the console. Below is a screenshot of the variable names.

Screenshot of the Configuration Variables.

Command Mac Terminal Commands

To list all the files or folders in a folder, use the following:

ls

To move down into a folder:

cd foldername

To move up out of a folder into the parent folder.

cd ..

To make a new folder.

mkdir newfoldername

--

--

Stephan Smith
Mechanics of Search

Startup founder — Boston based full stack developer with a strong focus on rapid prototyping, server-less solutions, and testable code.