Getting Started With Docker Compose and Speedscale CLI

Introduction

Observability, introspection, logging, and dependency mapping are critical when building APIs. With the advent of microservice architecture, understanding what happens inside your container is vital during development.

API Observability Video

 

Speedscale CLI is a container-centric tool that allows you to monitor inbound and outbound traffic. With Speedscale CLI, you can monitor raw requests, latency, encoding, and detected technologies.

Getting Started

We will use Speedscale CLI to observe a dockerized podtato-head application. podtato head is an example microservices app from the CNCF Technical Advisory Group for Application Delivery, along with instructions on how to deploy it in numerous different ways.

In this tutorial, we’ll use docker-compose to deliver the podtato-head application. Begin by cloning the podtato-head application on Github.

git clone https://github.com/Bamimore-Tomi/podtato-head.git

Setting up Docker Compose

Docker-compose is a container orchestration framework. It is helpful when managing multiple containers, like our podtato-head application.

Installing Docker Compose
Before installing docker-compose, make sure you have Docker engine up and running. Select and download the suitable installation file for your operating system here.

When Docker engine is up and running install docker compose on linux operating systems.

  • sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  • sudo chmod +x /usr/local/bin/docker-compose
    Tip: You can find docker-compose installing instructions for other operations systems here.
    To confirm that docker-compose is installed correctly, you can check the version in your terminal using:

    docker-compose --version

    Tip: Installing docker desktop will automatically install docker-engine and docker-compose. You’ll also get a friendly GUI to monitor containers and images.

Now, let’s build images for all the services needed in the podtato head application.

Step 1: Build the images in the docker-compose.yml

  • Enter the podtato-head-microservices directory that contains docker-compose.yml.
    cd podtato-head-microservices/
    The docker-compose.yml file has six services:

    1. Podtato-head-entry
    2. Podtato-head-hat
    3. Podtato-head-left-leg
    4. Podtato-head-left-arm
    5. Podtato-head-right-leg
    6. podtato-head-right-arm
  • Build the images with
    docker-compose build

    Verify that images are built correctly using:

    docker images

podtato head docker images

 

Step 2: Run the containers
Run the services with:

docker-compose up

docker compose up screenshot

 

Let’s visit localhost:9000 to make sure everything works fine. You should see a nice face with four limbs and a nice hat.

podtato head app

Setting up Speedscale CLI

Using Speedscale CLI, we can observe inbound and outbound traffic from our container. The speedscale CLI tool will:

  • Capture inbound traffic.
  • Capture outbound traffic.
  • Inspect technology used.
  • Replay traffic with cURL.

 

Step 1: Install Speedscale CLI

    • Install the latest version of Speedscale CLI.
      sh -c "$(curl -sL https://downloads.speedscale.com/speedscale-cli/install)"
    • Initialize speedscale and customize setup options.
      speedscale init

      Tip: If you get a -bash: speedscale: command not found error, make sure ~/.speedscale make sure exists in $PATH

    • You can explore different speedscale features with:
      speedscale –help

      Step 2: Start inspecting traffic

    • Get the name of the image you want to capture traffic from.
      In this tutorial, we will inspect the entry image, i.e. podtato-head-microservices_podtato-head-entry
      Capture inbound and outbound traffic with speedscale CLI using:

      speedscale start capture -i podtato-head-microservices_podtato-head-entry -p 9000:9000 

      speedscale cli start capture

    • Stimulate traffic by running curl localhost:9000 multiple times.

Step 3: Inspect Captured Traffic
Before inspecting captured traffic, you have to stop capturing with:

speedscale stop capture

speedscale cli stop capture

 

Inspect captured inbound and outbound traffic using:

speedscale inspect

speedscale cli inspect

 

Press enter on any items on the list to get more insight into the request.

 

You can also the the tab key to alternate the details of the request.

speedscale cli traffic viewer

 

If you need to replay a request, you can go to the cURL section, copy the command, and execute it in the terminal.

In addition, using the ‘tab’ key to navigate to the service map section can help see a summary of all inbound and outbound transactions, counts, target endpoints, and primary technology observed.

Summary

We learned how to install docker-compose, deploy containerized applications, and inspect traffic with speedscale CLI in this tutorial. The Speedscale CLI makes observability and testing in containerized applications quick and simple.

About The Author