Mô tả

For a long time, web applications were usually a single application that handled everything—in other words, a monolithic application. This monolith handled user authentication, logging, sending email, and everything else. While this is still a popular (and useful) approach, today, many larger scale applications tend to break things up into microservices. Today, most large organizations are focused on building web applications using this approach, and with good reason.

Microservices, also known as the microservice architecture, are an architectural style which structures an application as a loosely coupled collection of smaller applications. The microservice architecture allows for the rapid and reliable delivery of large, complex applications. Some of the most common features for a microservice are:

  • it is maintainable and testable;

  • it is loosely coupled with other parts of the application;

  • it  can deployed by itself;

  • it is organized around business capabilities;

  • it is often owned by a small team.

In this course, we'll develop a number of small, self-contained, loosely coupled microservices that will will communicate with one another and a simple front-end application with a REST API, with RPC, over gRPC, and by sending and consuming messages using AMQP, the Advanced Message Queuing Protocol. The microservices we build will include the following functionality:

  • A Front End service, that just displays web pages;

  • An Authentication service, with a Postgres database;

  • A Logging service, with a MongoDB database;

  • A Listener service, which receives messages from RabbitMQ and acts upon them;

  • A Broker service, which is an optional single point of entry into the microservice cluster;

  • A Mail service, which takes a JSON payload, converts into a formatted email, and send it out.

All of these services will be written in Go, commonly referred to as Golang, a language which is particularly well suited to building distributed web applications.

We'll also learn how to deploy our distributed application to a Docker Swarm and Kubernetes, and how to scale up and down, as necessary, and to update individual microservices with little or no downtime.

Bạn sẽ học được gì

Learn what Microservices are and when to use them

How to develop loosely coupled, single purpose applications which work together as a distributed application

How to communicate between services using JSON, Remote Procedure Calls, and gRPC

How to push events to microservices using the Advanced Message Queuing Protocol (AMQP) using RabbitMQ

How to deploy your distributed application to Docker Swarm

How to deploy your your distributed application to a Kubernetes Cluster

Yêu cầu

  • A basic understanding of the Go programming language
  • A Macintosh, Windows, or Linux computer with a connection to the internet

Nội dung khoá học

12 sections

Introduction

8 lectures
Introduction
09:23
About me
01:01
Installing Go
00:51
Installing Visual Studio Code
01:28
Installing Make
01:27
Installing Docker
00:51
Asking for help
01:14
Mistakes. We all make them.
01:06

Building a simple front end and one Microservice

9 lectures
What we'll cover in this section
00:41
Setting up the front end
01:36
Reviewing the front end code
03:36
Our first service: the Broker
14:56
Building a docker image for the Broker service
08:59
Adding a button and JavaScript to the front end
08:38
Creating some helper functions to deal with JSON and such
09:04
Simplifying things with a Makefile (Mac & Linux)
04:18
Simplifying things with a Makefile (Windows)
03:26

Building an Authentication Service

9 lectures
What we'll cover in this section
01:52
Setting up a stub Authentication service
11:13
Creating and connecting to Postgres from the Authentication service
08:55
A note about PostgreSQL
00:25
Updating our docker-compose.yml for Postgres and the Authentication service
14:13
Populating the Postgres database
02:27
Adding a route and handler to accept JSON
08:40
Update the Broker for a standard JSON format, and conect to our Auth service
15:06
Updating the front end to authenticate thorough the Broker and trying things out
07:09

Building a Logger Service

11 lectures
What we'll cover in this section
01:00
Getting started with the Logger service
10:07
Setting up the Logger data models
15:05
Finishing up the Logger data models
08:01
Setting up routes, handlers, helpers, and a web server in our logger-service
08:41
Adding MongoDB to our docker-compose.yml file
06:32
Add the logger-service to docker-compose.yml and the Makefile
04:23
Adding a route and handler on the Broker to communicate with the logger service
06:31
Update the front end to post to the logger, via the broker
04:12
Add basic logging to the Authentication service
04:24
Trying things out
04:23

Building a Mail Service

10 lectures
What we'll cover in this section
01:10
Adding Mailhog to our docker-compose.yml
02:07
Setting up a stub Mail microservice
05:09
Building the logic to send email
23:18
Building the routes, handlers, and email templates
12:30
Challenge: Adding the Mail service to docker-compose.yml and the Makefile
00:45
Solution to challenge
03:47
Modifying the Broker service to handle mail
08:00
Updating the front end to send mail
09:49
A note about mail and security
01:18

Building a Listener service: AMQP with RabbitMQ

13 lectures
What we'll cover in this section
02:29
Creating a stub Listener service
03:20
Adding RabbitMQ to our docker-compose.yml
04:21
Connecting to RabbitMQ
07:51
Writing functions to interact with RabbitMQ
21:15
Adding a logEvent function to our Listener microservice
02:40
Updating main.go to start the Listener function
02:44
Change the RabbitMQ server URL to the Docker address
00:40
Creating a Docker image and updating the Makefile
06:39
Updating the broker to interact with RabbitMQ
04:29
Writing logic to Emit events to RabbitMQ
05:58
Adding a new function in the Broker to log items via RabbitMQ
06:37
Trying things out
03:55

Communicating between services using Remote Procedure Calls (RPC)

5 lectures
What we'll cover in this section
02:14
Setting up an RPC server in the Logger microservice
05:38
Listening for RPC calls in the Logger microservice
04:45
Calling the Logger from the Broker using RPC
05:41
Trying things out
02:46

Speeding things up (potentially) with gRPC

9 lectures
What we'll cover in this section
02:28
Installing the necessary tools for gRPC
02:46
Defining a Protocol for gRPC: the .proto file
04:22
Generating the gRPC code from the command line
06:18
Getting started with the gRPC server
07:00
Listening for gRPC connections in the Logger microservice
04:07
Writing the client code
10:48
Updating the front end code
02:11
Trying things out
02:42

Deploying our Distributed App using Docker Swarm

27 lectures
What we'll cover in this section
03:18
Building images for our microservices
03:52
Creating a Docker swarm deployment file
11:50
Initializing and starting Docker Swarm
04:39
Starting the front end and hitting our swarm
02:12
Scaling services
03:19
Updating services
04:30
Stopping Docker swarm
01:50
Updating the Broker service, and creating a Dockerfile for the front end
05:54
Solution to the Challenge
02:26
Adding the Front end to our swarm.yml deployment file
01:25
Adding Caddy to the mix as a Proxy to our front end and the broker
10:15
Modifying our hosts file to add a "backend" entry and bringing up our swarm
06:31
Challenge: correcting the URL to the broker service in the front end
06:43
Solution to challenge
02:20
Updating Postgres to 14.2 - why monitoring is important!
01:53
Spinning up two new servers on Linode
04:38
Setting up a non-root account and putting a firewall in place.
05:32
Installing Docker on the servers
03:19
Setting the hostname for our server
03:32
Adding DNS entries for our servers
05:44
Adding a DNS entry for the Broker service
01:18
Initializing a manager, and adding a worker
02:26
Updating our swarm.yml and Caddy dockerfile for production
07:05
Trying things out, and correcting some mistakes
10:48
Populating the remote database using an SSH tunnel
02:33
Enabling SSL certificates on the Caddy microservice
11:12

Deploying our Distributed App to Kubernetes

22 lectures
What we'll cover in this section
01:58
Installing minikube
01:54
Installing kubectl
02:38
Initializing a cluster
03:06
Bringing up the k8s dashboard
02:46
Creating a deployment file for Mongo
14:07
Creating a deployment file for RabbitMQ
04:52
Creating a deployment file for the Broker service
03:21
When things go wrong...
07:53
Creating a deployment file for MailHog
02:20
Creating a deployment file for the Mail microservice
04:18
Creating a deployment file for the Logger service
04:27
Creating a deployment file for the Listener service
02:02
Running Postgres on the host machine, so we can connect to it from k8s
02:47
Creating a deployment file for the Authentication service
03:50
Trying things out by adding a LoadBalancer service
06:28
Creating a deployment file for the Front End microservice
04:41
Adding an nginx Ingress to our cluster
05:33
Trying out our Ingress
04:24
Scaling services
03:32
Updating services
02:03
Deploying to cloud services
05:20

Testing Microservices

8 lectures
Testing Routes
10:12
Getting started with the Repository pattern for our data package
04:45
Updating our models, handlers, and the main function to use our repository
05:06
Setting up a Test repository
05:16
Correcting a (rather stupid) oversight in models.go
01:31
Testing Handlers
06:36
Mocking our call to the logger-service for tests
08:08
Testing section in progress...
00:03

Final Thoughts

1 lectures
Just some final thoughts and observations
03:51

Đánh giá của học viên

Chưa có đánh giá
Course Rating
5
0%
4
0%
3
0%
2
0%
1
0%

Bình luận khách hàng

Viết Bình Luận

Bạn đánh giá khoá học này thế nào?

image

Đăng ký get khoá học Udemy - Unica - Gitiho giá chỉ 50k!

Get khoá học giá rẻ ngay trước khi bị fix.