Technical requirements

You will need a modern web browser such as Firefox, Chrome, Safari, or Edge.

If you do not have an Azure account, you can create a free account here: https://azure.microsoft.com/en-us/free/?WT.mc_id=A261C142F.

If you do not want to run the sample application in Docker locally, then skip to the Entering the Azure portal section where we will show you how to do the same in Azure without installing anything locally.

In this section, we will show you how to run the Azure Voting application on your local machine. This requires the following:

Now let's check out what version of Docker is running on your machine by using the following command. Open your favorite command-line prompt and check the versions of the Docker components that are installed. The response will be the versions you are running locally.

$ docker --version
Docker version 18.06.1-ce, build e68fc7a
$docker-compose --version
docker-compose version 1.22.0, build f46880f
$docker-machine --version
docker-machine version 0.15.0, build b48dc28d

It is time to get the application code from GitHub and run the Azure Voting application locally. You will see how easy it is to do that. In your command-line window, type the following commands:

$ git clone https://github.com/Azure-Samples/azure-voting-app-redis.git

Change the directory to see the content of the cloned repository:

$ cd azure-voting-app-redis

Now let's take a sneak peek at the docker-compose.yaml file. The Azure Voting application is composed of three containers:

  1.  Azure-vote-back, the backend service of the application
  2. Azure-vote-front, the web application frontend
  3. Redis DB, the default Redis image

The YAML files describe the services, the container images, and ports that compose the application. You can also see that the application is using a default Redis Docker image. If you open the YAML file, it will look like this:

version: '3'
services:
azure-vote-back:
image: redis
container_name: azure-vote-back
ports:
- "6379:6379"

azure-vote-front:
build: ./azure-vote
image: azure-vote-front
container_name: azure-vote-front
environment:
REDIS: azure-vote-back
ports:
- "8080:80"

Use the docker-compose.yaml file we just explored to build the container images, download the Redis image, and run the application:

$ docker-compose up -d

Let's check the containers running on the local machine:

$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9062b399fd6e azure-vote-front "/entrypoint.sh /sta…" 20 hours ago Up 20 hours 443/tcp, 0.0.0.0:8080->80/tcp azure-vote-front
09befdf2128a redis "docker-entrypoint.s…" 20 hours ago Up 20 hours 0.0.0.0:6379->6379/tcp azure-vote-back

Last, but not least, let's start the Azure Voting app running on your local machine by going to your web browser and typing http://localhost:8080. The application will be loaded, and you can vote for cats or dogs. Happy voting!

Before moving on to the Azure portal, clean up the Docker images and resources with the following:

$ docker-compose down
Stopping azure-vote-front ... done
Stopping azure-vote-back ... done
Removing azure-vote-front ... done
Removing azure-vote-back ... done
Removing network azure-voting-app-redis_default

In the next sections, you will use Azure portal to deploy and run the same application on AKS in Microsoft Azure.

Provide the GitHub URL for the code in the chapter (setup instructions should be on the GitHub page). Create a GitHub folder named chX, where X is the chapter number, for example, ch1.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset