Skip to content

Commit e1d30a9

Browse files
committed
first draft README
1 parent ac5c783 commit e1d30a9

30 files changed

+1141
-190
lines changed

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ target/
1616
**/*.settings
1717

1818
# K8S generated files
19-
kubernetes/deploy/
19+
kubernetes/deploy/
20+
piggymetrics/
21+
22+
# Scripts
23+
.scripts/

.scripts/e2e-using-aks.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ envsubst < 4-auth-service.yaml > deploy/4-auth-service.yaml
7878
kubectl apply -f deploy/4-auth-service.yaml
7979

8080
# deploy account-service
81-
envsubst < 5-account-service.yaml > deploy.5-account-service.yaml
81+
envsubst < 5-account-service.yaml > deploy/5-account-service.yaml
8282
kubectl apply -f deploy/5-account-service.yaml
8383

8484
# deploy statistics-service
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
mkdir -p deploy
4+
envsubst < 0-secrets.yaml > deploy/0-secrets.yaml
5+
envsubst < 1-config.yaml > deploy/1-config.yaml
6+
envsubst < 2-registry.yaml > deploy/2-registry.yaml
7+
envsubst < 3-gateway.yaml > deploy/3-gateway.yaml
8+
envsubst < 4-auth-service.yaml > deploy/4-auth-service.yaml
9+
envsubst < 5-account-service.yaml > deploy/5-account-service.yaml
10+
envsubst < 6-statistics-service.yaml > deploy/6-statistics-service.yaml
11+
envsubst < 7-notification-service.yaml > deploy/7-notification-service.yaml

README-piggymetrics.md

+276
Large diffs are not rendered by default.

README.md

+428-188
Large diffs are not rendered by default.

docs/create-application-insights.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# How to create Application Insights
2+
3+
This guide walks you through how to create an Application Insights
4+
instance in Azure.
5+
6+
## Create an Application Insights instance
7+
8+
Open the Azure Portal and start:
9+
10+
![](../media/create-application-insights-01.jpg)
11+
12+
![](../media/create-application-insights-02.jpg)
13+
14+
![](../media/create-application-insights-03.jpg)
15+
16+
Go to the created Application Insights and note down the `Instrumentation Key`.
17+
18+
## Resources
19+
20+
- [Create Application Insights](https://docs.microsoft.com/en-us/azure/azure-monitor/app/create-new-resource)
21+
22+
Go back to [How to use AKS end-to-end for Java apps?](https://github.com/azure-samples/java-on-aks)

docs/create-log-analytics.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# How to create Log Analytics
2+
3+
This guide walks you through how to create a Log Analytics workspace
4+
in Azure.
5+
6+
## Create a Log Analytics Workspace
7+
8+
Open the Azure Portal and start:
9+
10+
![](../media/create-log-analytics-workspace-01.jpg)
11+
12+
![](../media/create-log-analytics-workspace-02.jpg)
13+
14+
## Resources
15+
16+
- [Create a Log Analytics Workspace using Azure Portal](https://docs.microsoft.com/en-us/azure/azure-monitor/learn/quick-create-workspace)
17+
18+
Go back to [How to use AKS end-to-end for Java apps?](https://github.com/azure-samples/java-on-aks)

docs/create-mongodb-and-rabbitmq.md

+199
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
# Create MongoDB and RabbitMQ in Azure
2+
3+
This guide will walk you through HOW to create MongoDB and RabbitMQ in Azure.
4+
5+
## Prep the dev environment
6+
7+
Prep the dev environment by populating environment variables in
8+
`.scripts/setup-env-variables-azure.sh`
9+
bash script:
10+
11+
```bash
12+
# ====== Piggy Metrics Azure Coordinates
13+
export RESOURCE_GROUP=INSERT-your-resource-group-name
14+
export REGION=westus2
15+
export AKS_CLUSTER=INSERT-your-AKS-cluster-name
16+
export CONTAINER_REGISTRY=INSERT-your-Azure-Container-Registry-name
17+
18+
## ===== Mongo DB
19+
export MONGODB_DATABASE=INSERT-your-mongodb-database-name
20+
export MONGODB_USER=INSERT-your-cosmosdb-account-name
21+
22+
## ===== Rabbit MQ
23+
export RABBITMQ_RESOURCE_GROUP=INSERT-your-rabbitmq-resource-group-name
24+
export RABBITMQ_VM_NAME=INSERT-your-rabbitmq-virtual-machine-name
25+
export RABBITMQ_VM_ADMIN_USERNAME=INSERT-your-rabbitmq-admin-user-name
26+
```
27+
28+
Then export these environment variables from the
29+
`java-on-aks' directory:
30+
31+
```bash
32+
pwd
33+
/Users/selvasingh/GitHub/selvasingh/java-on-aks
34+
35+
source .scripts/setup-env-variables-azure.sh
36+
```
37+
38+
## Create MongoDB
39+
Create an instance of MongoDB:
40+
```bash
41+
# Change directory
42+
cd java-on-aks
43+
44+
# Login into Azure
45+
az login
46+
47+
# Create a Resource Group
48+
az group create --name ${RESOURCE_GROUP} \
49+
--location ${REGION}
50+
51+
# Create a Cosmos DB account
52+
az cosmosdb create --kind MongoDB \
53+
--resource-group ${RESOURCE_GROUP} \
54+
--name ${MONGODB_USER}
55+
```
56+
Cut and paste the resource `'id'` value from Azure CLI response into
57+
`setup-env-variables-azure.sh`, say for example:
58+
59+
```bash
60+
"id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/spring-cloud-0918/providers/Microsoft.DocumentDB/databaseAccounts/ ...
61+
```
62+
63+
```bash
64+
# Get Cosmos DB connection strings
65+
az cosmosdb list-connection-strings --resource-group ${RESOURCE_GROUP} \
66+
--name ${MONGODB_USER}
67+
```
68+
Cut and paste the primary connection string as `MONGODB_URI` in `setup-env-variables-azure.sh` bash file.
69+
70+
## Create RabbitMQ
71+
72+
Create an instance of Bitnami RabbitMQ Stack For Microsoft Azure, go to
73+
[https://portal.azure.com/#blade/Microsoft_Azure_Marketplace/MarketplaceOffersBlade/selectedMenuItemId/home/searchQuery/rabbitmq](https://portal.azure.com/#blade/Microsoft_Azure_Marketplace/MarketplaceOffersBlade/selectedMenuItemId/home/searchQuery/rabbitmq)
74+
and start:
75+
76+
![](../media/create-rabbitmq-on-azure-0.jpg)
77+
78+
Fill in the form, use the same value as `RABBITMQ_RESOURCE_GROUP`,
79+
`RABBITMQ_VM_NAME` and `RABBITMQ_VM_ADMIN_USERNAME`, and choose SSH. Select 'Standard DS3 v2' as
80+
the size:
81+
![](../media/create-rabbitmq-on-azure-1.jpg)
82+
83+
Accept defaults:
84+
![](../media/create-rabbitmq-on-azure-1-b.jpg)
85+
86+
Accept defaults:
87+
![](../media/create-rabbitmq-on-azure-2.jpg)
88+
89+
Accept defaults in all subsequent screens, and proceed to create:
90+
![](../media/create-rabbitmq-on-azure-3.jpg)
91+
92+
![](../media/create-rabbitmq-on-azure-4.jpg)
93+
94+
Open RabbitMQ client and administration ports:
95+
```bash
96+
# https://docs.bitnami.com/azure/infrastructure/rabbitmq/get-started/understand-default-config/
97+
az vm open-port --port 5672 --name ${RABBITMQ_VM_NAME} \
98+
--resource-group ${RABBITMQ_RESOURCE_GROUP}
99+
az vm open-port --port 15672 --name ${RABBITMQ_VM_NAME} \
100+
--resource-group ${RABBITMQ_RESOURCE_GROUP} --priority 1100
101+
```
102+
103+
Find the public IP address of the Linux virtual machine where RabbitMQ is running and
104+
and set the `RABBITMQ_HOST` environment variable in
105+
`piggymetrics/.scripts/setup-env-variables-azure.sh`:
106+
```bash
107+
# Open an SSH connection, say
108+
# First, export the environment variables
109+
source .scripts/setup-env-variables-azure.sh
110+
# Open an SSH connection
111+
ssh selvasingh@${RABBITMQ_HOST}
112+
```
113+
114+
You can adjust RabbitMQ to connect with clients from a different machine:
115+
```bash
116+
# https://docs.bitnami.com/azure/infrastructure/rabbitmq/administration/control-services/
117+
sudo /opt/bitnami/ctlscript.sh status
118+
119+
# Stop RabbitMQ
120+
sudo /opt/bitnami/ctlscript.sh stop
121+
122+
# Edit RabbitMQ configurtion file
123+
# https://docs.bitnami.com/azure/infrastructure/rabbitmq/administration/connect-remotely/
124+
# https://github.com/rabbitmq/rabbitmq-server/blob/master/docs/rabbitmq.config.example
125+
sudo nano /opt/bitnami/rabbitmq/etc/rabbitmq/rabbitmq.config
126+
127+
# Particularly, change line 4 from
128+
{tcp_listeners, [{"127.0.0.1", 5672}, {"::1", 5672}]},
129+
# TO
130+
{tcp_listeners, [{"0.0.0.0", 5672}, {"::1", 5672}]},
131+
132+
# Start RabbitMQ
133+
sudo /opt/bitnami/ctlscript.sh start
134+
```
135+
136+
You can get your RabbitMQ admin credentials by following the steps in
137+
[https://docs.bitnami.com/azure/faq/get-started/find-credentials/](https://docs.bitnami.com/azure/faq/get-started/find-credentials/).
138+
Particularly, open a file in the SSH terminal
139+
140+
```bash
141+
cat ./bitnami_credentials
142+
```
143+
144+
Note down the credentials and close the SSH connections. Onto your local
145+
development machine ...
146+
147+
From the `bitnami_credentials` file, populate the credentials in
148+
the `piggymetrics/.scripts/setup-env-variables-azure.sh` file
149+
and export them to the environment:
150+
```bash
151+
# Rabbit MQ
152+
export RABBITMQ_USERNAME=INSERT-your-rabbitmq-username
153+
export RABBITMQ_PASSWORD=INSERT-your-rabbitmq-password
154+
155+
# export them
156+
source .scripts/setup-env-variables-azure.sh
157+
```
158+
159+
160+
You should be able to reach the RabbitMQ admin console at:
161+
```bash
162+
open http://${RABBITMQ_HOST}:15672
163+
```
164+
165+
![](../media/rabbitmq-admin-console.jpg)
166+
167+
## Re-prep the local dev environment
168+
169+
Re-prep the dev environment by populating environment variables in
170+
`piggymetrics/.scripts/setup-env-variables-azure.sh` and
171+
`piggymetrics/.scripts/setup-env-variables-development.sh`
172+
bash scripts:
173+
174+
```bash
175+
# ====== Piggy Metrics Azure Coordinates
176+
export RESOURCE_GROUP=INSERT-your-resource-group-name
177+
export REGION=eastus
178+
export SPRING_CLOUD_SERVICE=INSERT-your-spring-cloud-service-name
179+
180+
## ===== Mongo DB
181+
export MONGODB_DATABASE=INSERT-your-mongodb-database-name
182+
export MONGODB_USER=INSERT-your-cosmosdb-account-name
183+
export MONGODB_URI="INSERT-your-mongodb-connection-string"
184+
export MONGODB_RESOURCE_ID=INSERT-your-mongodb-resource-id
185+
186+
## ===== Rabbit MQ
187+
export RABBITMQ_RESOURCE_GROUP=INSERT-your-rabbitmq-resource-group-name
188+
export RABBITMQ_VM_NAME=INSERT-your-rabbitmq-virtual-machine-name
189+
export RABBITMQ_VM_ADMIN_USERNAME=INSERT-your-rabbitmq-admin-user-name
190+
191+
# Rabbit MQ
192+
export RABBITMQ_HOST=INSERT-your-rabbitmq-host-public-ip-address
193+
export RABBITMQ_PORT=5672
194+
export RABBITMQ_USERNAME=INSERT-your-rabbitmq-username
195+
export RABBITMQ_PASSWORD=INSERT-your-rabbitmq-password
196+
197+
```
198+
199+
Go back to [How to use AKS end-to-end for Java apps?](https://github.com/azure-samples/java-on-aks)

0 commit comments

Comments
 (0)