Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
denismaggior8 committed Sep 20, 2021
0 parents commit 5fd7dd7
Show file tree
Hide file tree
Showing 95 changed files with 3,145 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/target
**/*.class
**/.idea
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ITS-ICT_Microservices

## Labs

- [00 - Prerequisites](labs/00-Prerequisites/README.md)

- [01 - Fork and clone this repo](labs/01-Fork_and_clone_this_repo/README.md)

- [02 - eCommerce microservices](labs/02-eCommerce_microservices/README.md)

- [03 - Testing microservices](labs/03-Testing_microservices/README.md)

- [04 - Logging and tracing](labs/04-Logging_and_tracing/README.md)

- [05 - Microservices design patterns](labs/05-Microservices_design_patterns/README.md)

- [06 - Install infrastructure components on K8S](labs/06-Install_infrastructure_components_on_K8S/README.md)

- [07 - Deploy microservices on K8S](labs/07-Deploy_microservices_on_K8S/README.md)

- [08 - Microservices continuous integration and delivery](labs/08-Microservices_continuous_integration_and_delivery/README.md)

- [09 - Service mesh](labs/09-Service_mesh/README.md)

- [10 - Microservices monitoring](labs/10-Microservices_monitoring/README.md)

## Assignments

- [01 - Library application](assignments/01-Library_application/README.md)



## Appendinces

[A - Sync a local copy of forked repo](appendices/A-Sync_copy_of_forked_repo/README.md)
70 changes: 70 additions & 0 deletions appendices/A-Sync_copy_of_forked_repo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Sync your forked repo

![Sync your forked repo](img/Git_workflow.jpeg)


## Configure a remote that points to the upstream repository

Change <GIT_LOCAL_WORKING_COPY> placeholder with a path pointing to your local working copy of the forked repo

```
$ cd <GIT_LOCAL_WORKING_COPY>
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
```

Verify the new upstream repository you've specified for your fork.

```
$ git remote -v
> origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
> origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
> upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
> upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
```


## Fetch the branches and their respective commits from the upstream repository.

Commits to master will be stored in a local branch, upstream/master.

```
$ git fetch upstream
> remote: Counting objects: 75, done.
> remote: Compressing objects: 100% (53/53), done.
> remote: Total 62 (delta 27), reused 44 (delta 9)
> Unpacking objects: 100% (62/62), done.
> From https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY
> * [new branch] master -> upstream/master
```

Check out your fork's local master branch.

```
$ git checkout master
> Switched to branch 'master'
```

Merge the changes from upstream/master into your local master branch. This brings your fork's master branch into sync with the upstream repository, without losing your local changes.

```
$ git merge upstream/master
> Updating a422352..5fdff0f
> Fast-forward
> README | 9 -------
> README.md | 7 ++++++
> 2 files changed, 7 insertions(+), 9 deletions(-)
> delete mode 100644 README
> create mode 100644 README.md
```

If your local branch didn't have any unique commits, Git will instead perform a "fast-forward":

```
$ git merge upstream/master
> Updating 34e91da..16c56ad
> Fast-forward
> README.md | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
```


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
20 changes: 20 additions & 0 deletions assignments/01-Library_application/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Library application

Develop 4 microservices as depicted in this diagram:

![](img/diagram.png)

Microservices can be developed in any any techology , but they must comply with following constraints:

- Use HTTP/REST for synchronous communication
- Use at least two different database technology (RDBMS and NoSQL).
- Use a message broker (Kafka, Active MQ, Rabbit MQ) for asynchronous communications (ie: calling the Notification service)

Evaluation criteria:

- Microservices (0 to 5 points)
- Design patterns (0 to 5 points)
- Testing (0 to 5 points)
- Logging and tracing (0 to 5 points)
- CI/CD (0 to 5 points)
- Docker and Kubernetes (0 to 5 points)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions labs/00-Prerequisites/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Prerequisites

The following softwares have to be installed on your PC

- Docker Desktop (Win 10 Pro or MacOS) or Toolbox (Win 10 Home or Win 8)
- Git client [download here](https://git-scm.com/downloads)
- Bash command line (Git bash, Moba or Cygwin if you are on Windows)
- Visual Studio Code [download here](https://code.visualstudio.com)
- IntelliJ IDEA Community Edition [download here](https://www.jetbrains.com/idea/download/)
- Postman [download here](https://www.postman.com/downloads/)
- A GitHub account
- A DockerHUB account
33 changes: 33 additions & 0 deletions labs/01-Fork_and_clone_this_repo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Fork and clone this repo

## Prerequisites

- A github account

## Fork the repo

Open your browser and go to: https://github.com/sunnyvale-academy/ITS-ICT_Microservices

The ITS-ICT_Microservices repo home page opens.

Click on **Fork** button at the top-right of the screen. GitHub asks you to authenticate.

When you enter as logged-in user, re-click on **Fork** button at the top-right of the screen. Forking a repository allows you create a copy of the original repo on your GitHub account so as to freely experiment with changes without affecting the original project.

## Clone the forked repo

When forked the original repo, clone it on your PC.

In the following command, please make sure to change \<YOUR GITHUB ACCOUNT\> placeolders accordingly:

- \<YOUR PREFERRED FOLDER\> with the folder you want to clone this repo into
- \<YOUR GITHUB ACCOUNT\> with your actual GitHub account (i.e. mine is denismaggior8)

```
$ cd <YOUR PREFERRED FOLDER>
$ git clone https://github.com/<YOUR GITHUB ACCOUNT>/ITS-ICT_Microservices
```

Please not that your forked repo, nor your local clone, will receive new commits from the original repo automatically; you need to pull updates manually, please refer to appendix [A - Sync copy of forked repo](../../appendices/A-Sync_copy_of_forked_repo/README.md)

If you need some Git help, download [**The Git cheat-sheet**](https://www.atlassian.com/dam/jcr:8132028b-024f-4b6b-953e-e68fcce0c5fa/atlassian-git-cheatsheet.pdf)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions labs/02-eCommerce_microservices/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# eCommerce Microservices

![](img/eCommerce.png)

## Prerequisites

- Having completed lab [00 - Prerequisites](../00-Prerequisites/README.md)

## Run microservices containers + infrastructure containers (MongoDB, Zookeeper, Kafka, Postgres)

To compile the classes, start microservices containers and infrastructure containers:

```console
$ ./start.sh
```

## Run ONLY infrastructure containers (MongoDB, Zookeeper, Kafka, Postgres)

To run ONLY infrastructure containers (MongoDB, Zookeeper, Kafka, Postgres):

```console
$ ./start-infra.sh
```


## Customer Microservice details

Open API url [http://localhost:8102/customers-service/v2/api-docs](http://localhost:8102/customers-service/v2/api-docs)

Microservice base url: [http://localhost:8102/customers-service](http://localhost:8102/customers-service)

Microservice URI: **/v2/customers**

Microservice complete url: [http://localhost:8102/customers-service/v2/customers](http://localhost:8102/customers-service/v2/customers)

## Order Microservice details

Open API url [http://localhost:8103/orders-service/v2/api-docs](http://localhost:8103/orders-service/v2/api-docs)

Microservice base url: [http://localhost:8103/orders-service](http://localhost:8103/orders-service)

Microservice URI: **/v2/orders**

Microservice complete url: [http://localhost:8103/orders-service/v2/orders](http://localhost:8103/orders-service/v2/orders)
14 changes: 14 additions & 0 deletions labs/02-eCommerce_microservices/customer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM maven:3.6.3-jdk-8-slim as builder
ARG MVN_ARGS
ADD ./src/ /app/src/
ADD ./pom.xml /app/pom.xml
WORKDIR /app
RUN echo "127.0.0.1 customer-mongodb order-postgres kafka" >> /etc/hosts && mvn --batch-mode package ${MVN_ARGS}

FROM openjdk:8-jdk-alpine
WORKDIR /app
COPY --from=builder /app/target/*.jar app.jar
EXPOSE 8102
ENTRYPOINT ["java","-jar","app.jar"]


21 changes: 21 additions & 0 deletions labs/02-eCommerce_microservices/customer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Customers Microservice

![](img/customer-ms.png)

## Prerequisites

Before running the microservice, the following prerequisites must be met:
- Having **Maven** and **Java** (8+) installed
- **customer-mongodb** Docker container must be started
- **customer-mongodb** host name must resolve to **127.0.0.1** (modify `/etc/hosts` file accordingly), for example:

```
$ cat /etc/hosts | grep 127.0.0.1
127.0.0.1 localhost customer-mongodb
```

## Run microservice

```console
$ mvn exec:exec
```
Loading

0 comments on commit 5fd7dd7

Please sign in to comment.