Skip to content

Commit dfd0cf4

Browse files
author
Araf Karsh Hamid
committed
Updated the README
1 parent 38ab073 commit dfd0cf4

File tree

5 files changed

+39
-25
lines changed

5 files changed

+39
-25
lines changed

README.md

+23-12
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,23 @@ Microservice Template gives you a
66
2. Open API 3 Ex,
77
3. Spring Actuator,
88
4. Spring Sleuth and
9-
5. Pom file with (SpringBoot) Fat and Thin (Maven) jar file creation and
9+
5. POM File with (SpringBoot) Fat and Thin (Maven) jar file creation and
1010
6. Dockerfile for containerisation.
1111

1212
## Service Setup
1313

14-
### Step 1 - Set the Org and Service Name, Versions, API Path
14+
### Step 1 - Setup Org, Service, & Container Name, Versions, API Path in app.props.tmpl
1515

1616
1. Update the Org Name in src/main/resources/app.props.tmpl file (service.org)
17-
2. Update the microservice name in src/main/resources/app.props.tmpl file (service.name)
17+
2. Update the Microservice name in src/main/resources/app.props.tmpl file (service.name)
1818
3. Update the API Version in src/main/resources/app.props.tmpl file (service.api.version)
1919
4. Update the API Name in src/main/resources/app.props.tmpl file (service.api.name)
20-
5. Update the Server Version src/main/resources/app.props.tmpl file (server.version)
21-
6. Update the SRC_BASE (Your Service Repository Base Directory) in getServiceName shell script
20+
5. Update the Container Name in src/main/resources/app.props.tmpl file (service.container)
21+
6. Update the Server Version src/main/resources/app.props.tmpl file (server.version)
22+
7. Update the SRC_BASE (Your Service Repository Base Directory) in getServiceName shell script
23+
24+
Sample Property File Template
25+
![Property File](https://raw.githubusercontent.com/MetaArivu/microservice-template/master/diagrams/MS-Property-File.jpg)
2226

2327
When you change the version in POM.xml, update that info in src/main/resources/app.props.tmpl - service.version property also.
2428

@@ -44,28 +48,35 @@ Without generated application.properties file the service will not be running.
4448

4549
## Docker Container Setup
4650

47-
### Step 1 - Setting Microservice Name
51+
### Step 1 - Verify Container Name and Org Name
4852

49-
1. Change the EntryPoint in the Dockerfile (Last line - jar file name)
53+
1. Verify the Org Name in src/main/resources/app.props.tmpl file (service.org)
54+
2. Verify the container name in src/main/resources/app.props.tmpl file (service.container)
55+
3. Verify the microservice name in src/main/resources/app.props.tmpl file (service.api.name)
5056

5157
### Step 2 - Build the image
5258

53-
1. build
54-
2. scan
59+
1. build (Build the Container)
60+
2. scan (Scan the container vulnerabilities)
5561

5662
### Step 3 - Test the image
5763

58-
1. start
64+
1. start (Start the Container)
5965
2. logs (to view the container logs) - Wait for the Container to Startup
6066
3. Check the URL in a Browser
6167

62-
### Step 4 - Push the image to Cloud Repo
68+
### Step 4 - Push the image to Container Cloud Repository
69+
70+
Update the Org Name in src/main/resources/app.props.tmpl file (service.org)
71+
Setup the Docker Hub or any other Container Registry
6372

64-
1. push
73+
1. push (Push the Container to Docker Hub)
6574

6675
### Other Commands
6776

6877
1. stop (Stop the Container)_
6978
2. stats (show container stats)
7079

7180

81+
(C) Copyright 2021 - MetArivu
82+
Author: Araf Karsh Hamid

diagrams/MS-Property-File.jpg

63.3 KB
Loading

src/docker/README.MD

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
# Create Docker Container
2-
# -------------------------------------------------------------------------------------------
32

4-
## Step 1 - Setting Microservice Name
3+
## Step 1 - Verify Container Name and Org Name
54

6-
1. Update the microoservice name in src/main/resources/app.props.tmpl file (service.api.name)
7-
2. Update the Org Name in src/main/resources/app.props.tmpl file (service.org)
8-
3. Change the EntryPoint in the Dockerfile (Last line - jar file name)
5+
1. Verify the Org Name in src/main/resources/app.props.tmpl file (service.org)
6+
2. Verify the container name in src/main/resources/app.props.tmpl file (service.container)
7+
3. Verify the microservice name in src/main/resources/app.props.tmpl file (service.api.name)
98

109
## Step 2 - Build the image
1110

12-
1. build
13-
2. scan
11+
1. build (Build the Container)
12+
2. scan (Scan the container for vulnerabilities)
1413

1514
## Step 3 - Test the image
1615

17-
1. start
16+
1. start (Start the Container)
1817
2. logs (to view the container logs) - Wait for the Container to Startup
1918
3. Check the URL in a Browser
2019

2120
## Step 4 - Push the image to Cloud Repo
2221

23-
1. push
22+
1. push (Push the image to Cloud)
2423

2524
## Other Commands
2625

27-
1. stop (Stop the Container)_
26+
1. stop (Stop the Container)
2827
2. stats (show container stats)

src/docker/start

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
# -------------------------------------------------------------------------------------------
55
# Start Container
66
# -------------------------------------------------------------------------------------------
7+
PORT=9030
78
ORG=`../../getServiceName 1`
89
SERVICE=`../../getServiceName 4`
9-
echo "docker container run --name $SERVICE -d --rm -p 9010:9090 $ORG/$SERVICE"
10-
docker container run --name $SERVICE -d --rm -p 9010:9090 $ORG/$SERVICE
10+
API=`../../getServiceName 3`
11+
echo "docker container run --name $SERVICE -d --rm -p $PORT:9090 $ORG/$SERVICE"
12+
docker container run --name $SERVICE -d --rm -p $PORT:9090 $ORG/$SERVICE
13+
echo "Checkout API: http://localhost:$PORT/api/v1/$API/swagger-ui.html"
1114
echo "Container id for $SERVICE ="`docker container ls | grep $SERVICE | tr -s " " | cut -d " " -f 1`
1215
docker container ls | grep $SERVICE | tr -s " " | cut -d " " -f 1 > $SERVICE.cid

src/main/resources/app.props.tmpl

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ service.api.prefix=api
77
service.api.version=v1
88
service.api.name=mock
99
service.container=mock-service
10-
service.api.repository=https://github.com/MetaArivu/mock-${service.api.name}
10+
#service.api.repository=https://github.com/MetaArivu/${service.container}
11+
service.api.repository=https://github.com/MetaArivu/microservice-template
1112
service.api.path=/${service.api.prefix}/${service.api.version}/${service.api.name}
1213
service.url=http://www.metarivu.com/
1314
# =======================================================================

0 commit comments

Comments
 (0)