You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 18, 2024. It is now read-only.
# OfficeSpace: Polyglot Microservices application leveraging Java Spring Boot on Kubernetes
3
3
4
-
Spring Boot is one of the popular Java microservices framework. Spring Cloud has a rich set of well integrated Java libraries to address runtime concerns as part of the Java application stack, and Kubernetes provides a rich featureset to run polyglot microservices. Together these technologies complement each other and make a great platform for Spring Boot applications.
4
+
Spring Boot is one of the popular Java microservices framework. Spring Cloud has a rich set of well integrated Java libraries to address runtime concerns as part of the Java application stack, and Kubernetes provides a rich featureset to run polyglot microservices. Together these technologies complement each other and make a great platform for Spring Boot applications.
5
5
6
6
In this code we demonstrate how a simple Spring Boot application can be deployed on top of Kuberneets. This application, Office Space, mimicks the fictitious app idea from Michael Bolton in the movie [Office Space](http://www.imdb.com/title/tt0151804/). The app takes advantage of a financial program that computes interest for transactions by diverting fractions of a cent that are usually rounded off into a seperate bank account.
7
7
@@ -31,10 +31,13 @@ Please follow the [Toolchain instructions](https://github.com/IBM/container-jour
31
31
4.[Create the Transaction Generator service](#4-create-the-transaction-generator-service)
32
32
5.[Access Your Application](#5-access-your-application)
The backend consists of the MySQL database and the Spring Boot app. You will also be creating a deployment controller for each to provision their Pods.
36
39
37
-
* There are two ways to create the MySQL database backend: **Use MySQL in a container in your cluster***OR***Use Bluemix MySQL**
40
+
* There are two ways to create the MySQL database backend: **Use MySQL in a container in your cluster***OR***Use Bluemix MySQL**
38
41
39
42
## 1.1 Use MySQL in container
40
43
**NOTE:** Leave the environment variables blank in the `compute-interest-api.yaml` and `account-summary.yaml`
@@ -72,7 +75,11 @@ deployment "account-database" created
72
75
You will need to have [Maven installed on your environment](https://maven.apache.org/index.html).
73
76
If you want to modify the Spring Boot apps, you will need to do it before building the Java project and the docker image.
74
77
75
-
The Spring Boot Microservices are the **Compute-Interest-API** and the **Email-Service**.
78
+
The Spring Boot Microservices are the **Compute-Interest-API** and the **Send-Notification**.
79
+
80
+
The **Send-Notification** can be configured to send notification through gmail and/or Slack.
81
+
82
+
You will need to use an [OpenWhisk](#using-openwhisk-action-with-slack-notification) action for the slack notification. You may also choose to use an OpenWhisk action for the email notification. If you want to use OpenWhisk, go to [Using OpenWhisk](#using-openwhisk-action-with-slack-notification) section before building and deploying the images. Otherwise, you can proceed if you choose to only have an email notification setup.
76
83
77
84
* 1. Build the images
78
85
@@ -84,7 +91,7 @@ The Spring Boot Microservices are the **Compute-Interest-API** and the **Email-S
*We will be using Bluemix container registry to push images (hence the image naming), but the images [can be pushed in Docker hub](https://docs.docker.com/datacenter/dtr/2.2/guides/user/manage-images/pull-and-push-images) as well.*
90
97
* 2. Push the images:
@@ -96,23 +103,23 @@ The Spring Boot Microservices are the **Compute-Interest-API** and the **Email-S
* 3. Modify `compute-interest-api.yaml` and `email-service.yaml` to use your image
108
+
* 3. Modify `compute-interest-api.yaml` and `send-notification.yaml` to use your image
102
109
```yaml
103
110
// compute-interest-api.yaml
104
111
spec:
105
112
containers:
106
113
- image: registry.ng.bluemix.net/<namespace>/compute-interest-api # replace with your image name
107
-
// email-service.yaml
114
+
// send-notification.yaml
108
115
spec:
109
116
containers:
110
-
- image: registry.ng.bluemix.net/<namespace>/email-service # replace with your image name
117
+
- image: registry.ng.bluemix.net/<namespace>/send-notification # replace with your image name
111
118
```
112
-
You will also need to modify the **environment variables** in the `email-service.yaml`:
119
+
You will also need to modify the **environment variables** in the `send-notification.yaml`:
113
120
```yaml
114
121
env:
115
-
- name: GMAIL_SENDER_USER
122
+
- name: GMAIL_SENDER_USER
116
123
value: 'username@gmail.com' # change this to the gmail that will send the email
117
124
- name: GMAIL_SENDER_PASSWORD
118
125
value: 'password' # change this to the the password of the gmail above
@@ -126,9 +133,9 @@ The Spring Boot Microservices are the **Compute-Interest-API** and the **Email-S
126
133
deployment "compute-interest-api" created
127
134
```
128
135
```bash
129
-
$ kubectl create -f email-service.yaml
130
-
service "email-service" created
131
-
deployment "email-service" created
136
+
$ kubectl create -f send-notification.yaml
137
+
service "send-notification" created
138
+
deployment "send-notification" created
132
139
```
133
140
> Note: The compute-interest-api multiplies the fraction of the pennies to x100,000 for simulation purposes. You can edit/remove the line `remainingInterest *= 100000` in `src/main/java/officespace/controller/MainController.java` then build the image again.
* [John Zaccone](https://github.com/jzaccone) - The original author of the [office space app deployed via Docker](https://github.com/jzaccone/office-space-dockercon2017).
183
243
* The Office Space app is based on the 1999 film that used that concept.
0 commit comments