In this guide you will learn how Weave Cloud can help you understand and troubleshoot a microservices-based app. The app you will deploy is an online store, called the Socks Shop that consists of several microservices written in three different languages: Node.js, Spring Boot and Go Kit, and which also uses the data services, RabbitMQ and MongoDB.
Docker and Docker Compose will be used to deploy the Socks Shop onto your local machine, and then you will launch Weave Scope probes to push metrics to Weave Cloud so that you can observe the topology of the app and explore how it works. Weave Scope probes monitor network traffic and builds a topology graph in real-time. The view in Weave Cloud is augmented with metadata from the Docker API along with several different systems metrics that allow you to troubleshoot your app.
The following topics are discussed:
- Installing Docker for Mac
- Deploying the Socks Shop App
- Signing Up for Weave Cloud
- Connecting the Scope Probes to Weave Cloud
Installing Docker for Mac
If you haven’t installed Docker for Mac, please follow the installation instructions on Docker website .
Once it’s running you will see in your menu bar.
Deploying the Socks Shop App
To deploy The Socks Shop:
1. Get the code:
git clone https://github.com/microservices-demo/microservices-demo.git cd microservices-demo/deploy/docker-compose
2. Deploy the Socks Shop app:
docker-compose up -d open http://localhost
Note: If localhost does not load the Socks Shop, then use the IP
Once the app displays in your browser, you can test the functionality. Login using
password1, and then put an item in the basket and proceed to the checkout.
Signing Up for Weave Cloud
To visualize microservices, first sign up for Weave Cloud:
- Go to Weave Cloud
- Sign up using either a Github, or Google account or use an email address.
- Obtain the cloud service token from the User settings screen:
Connecting the Scope Probes to Weave Cloud
Install and launch the Weave Scope probes:
sudo curl --silent --location https://git.io/scope --output /usr/local/bin/scope sudo chmod +x /usr/local/bin/scope scope launch --service-token=<WEAVE_CLOUD_TOKEN>
<WEAVE_CLOUD_TOKEN>- is the token that appears on the settings page, once you’ve logged into Weave Cloud.
Note: To set the Weave Cloud controls to read-only for all users, you can launch scope with the –probe.no-controls flag. In this demo, you will be launching a terminal window and viewing messages between microservices, and so this flag is not necessary. However, you may want to keep this flag in mind when using Weave Cloud and sharing your infrastructure views with others outside of your organization.
Weave Cloud controls allow you to stop, start and pause containers. They also enable you to launch a terminal and interact directly with your containers.
Running the Load Test
To fully appreciate the topology of this app, you will need to run a load on the app.
Run a load test with the following:
docker run -ti --rm --name=LOAD_TEST --net=dockercompose_default \ --net=shop_external \ weaveworksdemos/load-test -h edge-router -r 100 -c 2
With the load test running, you can observe the different services communicating by clicking on the Load Test container in Weave Cloud. From the metrics panel, open Load Test’s terminal to view the messages. With the load test running, the Sock Shop topology will form in Weave Cloud.
Tearing Down the App
To clean up the app from your system:
In this guide, an online store using a microservices-based approach was launched into the Weave Cloud, where you could observe communication events and also interact with the topology of the microservices app.
If you have any questions or comments, we would be happy to hear from you, visit Weave Help & Support for information on ways to contact us.