Skip to content

Commit 0c0c49e

Browse files
authored
Merge pull request #26 from arafkarsh/spring-341-k8s
Added Pod Autoscaler and optimized CPU and Memory specs
2 parents b8fdca0 + d48ea3d commit 0c0c49e

20 files changed

+366
-37
lines changed
Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
# =======================================================================
2+
# MS-Vanilla Service Properties
3+
# =======================================================================
4+
build.number=225
5+
build.date=Sat Feb 1 16:35:06 IST 2025
6+
# ------------------------------------------------------------------------
7+
# Spring Profile
8+
# ------------------------------------------------------------------------
9+
spring.profiles.default=dev
10+
# =======================================================================
11+
# Service Name & API Details - Version, Path
12+
# =======================================================================
13+
service.org=arafkarsh
14+
service.name=MS-Vanilla
15+
service.api.name=ms-vanilla
16+
service.api.prefix=api
17+
service.api.version=v1
18+
service.api.error.prefix=13
19+
service.container=ms-vanilla-service
20+
service.api.repository=https://github.com/arafkarsh/ms-springboot-334-vanilla
21+
service.api.path=/${service.api.name}/${service.api.prefix}/${service.api.version}
22+
service.url=http://www.arafkarsh.com/
23+
service.license=Apache 2 License
24+
service.license.url=https://github.com/arafkarsh/ms-springboot-334-vanilla?tab=Apache-2.0-1-ov-file
25+
# =======================================================================
26+
# Microservice Server Properties
27+
# =======================================================================
28+
server.port=9334
29+
server.version=0.3.4
30+
server.restart=false
31+
server.leak.test=3
32+
server.resources.url=${service.url}${service.api.path}
33+
server.api.url.print=true
34+
# ------------------------------------------------------------------------
35+
# Host SSL Details :
36+
# Rename the file fusionAir.pkcs12 in resources folder and uncomment the
37+
# following lines to enable SSL
38+
# ------------------------------------------------------------------------
39+
#server.ssl.key-store=classpath:fusionAir.pkcs12
40+
#server.ssl.key-store-type=PKCS12
41+
#server.ssl.key-store-password=Fusion.2023
42+
#server.ssl.key-alias=fusionAir
43+
# ------------------------------------------------------------------------
44+
# Security & JWT Token (Type 1 = secret key, 2 = public / private key)
45+
# ------------------------------------------------------------------------
46+
server.crypto.public.key=publicKey.pem
47+
server.crypto.private.key=privateKey.pem
48+
server.token.issuer=${service.org}
49+
# Type 1 = Secret, Type 2 = Public / Private Key
50+
server.token.type=1
51+
server.token.test=true
52+
# Token Expiry Times - Security Policy will reject High Expiry Time
53+
server.token.auth.expiry=600000
54+
server.token.refresh.expiry=3600000
55+
server.token.key=<([1234567890SecretKey!!To??Encrypt##Data@12345%6790])>
56+
server.secure.data.key=<([1234567890SecretKEY!!TO??Encrypt##DATA@12345%6790])>
57+
# ------------------------------------------------------------------------
58+
# Keycloak Details for OAuth 2 Authentication
59+
# ------------------------------------------------------------------------
60+
server.keycloak.url=http://localhost:8080/realms/Fusion-Air/protocol/openid-connect/token
61+
server.keycloak.certs=http://localhost:8080/realms/Fusion-Air/protocol/openid-connect/certs
62+
server.keycloak.clientId=fusion-air-user-service
63+
server.keycloak.secret=2AGe7XxP8evCmhdjD3cmgpE23y0g6PGU
64+
server.keycloak.grantType=password
65+
server.keycloak.publicKey=publicKey.KeyCloak.pem
66+
server.keycloak.issuer=http://localhost:8080/realms/Fusion-Air
67+
server.keycloak.enabled=false
68+
# ------------------------------------------------------------------------
69+
# Host Details
70+
# ------------------------------------------------------------------------
71+
# To make Swagger API Docs to work in a Kubernetes cluster
72+
server.host.k8s.service.port=80
73+
server.host.k8s.enabled=false
74+
server.host=localhost
75+
server.host.dev=http://localhost
76+
server.host.dev.desc=Development Server
77+
server.host.uat=https://uat.${service.org}.com
78+
server.host.uat.desc=UAT Server
79+
server.host.prod=https://prod.${service.org}.com
80+
server.host.prod.desc=Production Server
81+
server.error.whitelabel.enabled=true
82+
server.vulnerability.demos.allowed=false
83+
# Service Properties Details
84+
# ------------------------------------------------------------------------
85+
spring.codec.max-in-memory-size=3MB
86+
app.property.product=fusion.air.product
87+
app.property.product.list=/create, /status, /all/secured, /search/product, /search/price, /search/active, /deactivate, /activate, /update, /update/price, /update/details, /delete
88+
app.property.list=element1, element2, element3
89+
app.property.map={key1:'val1', key2 : 'val2', key3 : 'val3'}
90+
# ------------------------------------------------------------------------
91+
# Logging / Events: LogBack Setup / File Roll Over,
92+
# ------------------------------------------------------------------------
93+
# Log Groups
94+
logging.group.tomcat=org.apache.catalina, org.apache.coyote, org.apache.tomcat
95+
# Logging Levels for various components
96+
logging.level.org.springframework.boot.web.servlet=INFO
97+
logging.level.org.springframework.web.servlet.DispatcherServlet=INFO
98+
logging.level.org.springframework.security.web.FilterChainProxy=INFO
99+
# Spring Default Groups
100+
logging.level.web=INFO
101+
logging.level.sql=INFO
102+
logging.level.tomcat=INFO
103+
# Root level logging
104+
logging.level.root=INFO
105+
# Specify the logback configuration file
106+
logging.config=classpath:logback-spring.xml
107+
# Supported Log Format plain / json
108+
logging.format=plain
109+
# Log file paths and rolling policy
110+
logging.path=/tmp/logs/${service.api.name}
111+
# Log File Name. File Extension .log or .json is added dynamically based on logging format.
112+
logging.file.name=${service.api.name}.v${server.version}
113+
# Log File Pattern for Size and Time based File Roll Over Name
114+
logging.pattern.rolling-file-name=${logging.path}/${logging.file.name}-%d{yyyy-MM-dd}-%i
115+
# Max Single File Size = 30 MB
116+
logging.file.max-size=10MB
117+
# Retention and total size cap for logs
118+
# Keep Log Files for 100 Days with Max Cap at 3 GB
119+
logging.file.max-history=100
120+
logging.file.total-size-cap=3GB
121+
# ------------------------------------------------------------------------
122+
# Metrics: Micrometer / Prometheus / Actuator /
123+
# ------------------------------------------------------------------------
124+
# Enable exposure of specific actuator endpoints (health, metrics, prometheus)
125+
springdoc.show-actuator=true
126+
management.endpoints.web.exposure.include=health,metrics,prometheus,info
127+
# Enable Spring Boot Actuator Endpoints
128+
management.endpoint.health.enabled=true
129+
management.endpoint.metrics.enabled=true
130+
management.endpoint.prometheus.enabled=true
131+
# Enable Metrics
132+
management.metrics.export.prometheus.enabled=true
133+
management.metrics.enable.jvm=false
134+
management.metrics.enable.jvm.gc=false
135+
management.metrics.enable.datasource=false
136+
# ------------------------------------------------------------------------
137+
# Tracing: Open Telemetry / Micrometer
138+
# Micrometer only supports HTTP/Protobuf (http) for OTLP. grpc is not supported.
139+
# ------------------------------------------------------------------------
140+
# OpenTelemetry Setup
141+
# W3C Standard, B3 Zipkin Standard
142+
# ------------------------------------------------------------------------
143+
otel.propagators=tracecontext
144+
otel.resource.attributes.deployment.environment=dev
145+
otel.resource.attributes.service.name=ms-vanilla
146+
otel.resource.attributes.service.namespace=shopping
147+
# ------------------------------------------------------------------------
148+
# Export to Collector
149+
# ------------------------------------------------------------------------
150+
# Enable OpenTelemetry
151+
otel.javaagent.debug=true
152+
otel.service.name=${service.container}
153+
otel.exporter.otlp.endpoint=http://localhost:4318
154+
# to load the Custom OpenTelemetric Config
155+
otel.traces.exporter=none
156+
otel.metrics.exporter=none
157+
otel.logs.exporter=none
158+
# ------------------------------------------------------------------------
159+
# Disable global auto-instrumentation and explicitly enable for jdbc, logback, web, kafka, etc
160+
# ------------------------------------------------------------------------
161+
otel.instrumentation.common.default-enabled=false
162+
# Enable specific instrumentation (JDBC is not supported in this version of Open Telemetry)
163+
otel.instrumentation.jdbc.enabled=false
164+
otel.instrumentation.logback-mdc.enabled=true
165+
otel.instrumentation.spring-web.enabled=true
166+
otel.instrumentation.spring-webmvc.enabled=true
167+
otel.instrumentation.micrometer.enabled=true
168+
# External Systems Kafka / MongoDB
169+
otel.instrumentation.kafka.enabled=false
170+
otel.instrumentation.mongo.enabled=false
171+
# ------------------------------------------------------------------------
172+
# Async - Reactive Framework
173+
# ------------------------------------------------------------------------
174+
#otel.instrumentation.spring-webflux.enabled=false
175+
#otel.instrumentation.r2dbc.enabled=false
176+
# ------------------------------------------------------------------------
177+
#management.tracing.enabled=false
178+
# OpenTelemetry Tracing Configuration
179+
#management.otlp.metrics.export.enabled=false
180+
#management.otlp.metrics.export.url=http://localhost:4358/v1/metrics
181+
# number of Meter to include in a single payload sent to the backend. The default is 10,000.
182+
#management.otlp.metrics.export.batchSize=15000
183+
#management.otlp.metrics.export.timeout=5s
184+
# Determines how the additive quantities are expressed, in relation to time. Values are cumulative or delta
185+
#management.otlp.metrics.export.aggregationTemporality=cumulative
186+
# Additional headers to send with exported metrics
187+
#management.otlp.metrics.export.headers.Authorization=Bearer abc123
188+
# the interval at which metrics will be published.
189+
#management.otlp.metrics.export.step=10s
190+
# Resource Attributes are used for all metrics published.
191+
#management.otlp.metrics.export.resourceAttributes.service.name=ms-vanilla-service
192+
# =======================================================================
193+
# Text Encryption
194+
# =======================================================================
195+
# Ensure this matches your environment variable
196+
jasypt.encryptor.password=${JASYPT_ENCRYPTOR_PASSWORD}
197+
#jasypt.encryptor.password=${BASE64:JASYPT_ENCRYPTOR_PASSWORD}
198+
# Match the algorithm
199+
jasypt.encryptor.algorithm=PBEWithHmacSHA512AndAES_256
200+
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.RandomIvGenerator
201+
jasypt.encryptor.salt-generator-classname=org.jasypt.salt.RandomSaltGenerator
202+
# =======================================================================
203+
# Database Properties
204+
# =======================================================================
205+
db.server=mem
206+
db.port=5432
207+
db.name=ms_cache
208+
db.schema=ms_schema
209+
db.vendor=H2
210+
# To Store the Data in File
211+
#spring.datasource.url=jdbc:h2:file:/data/demo
212+
spring.datasource.url=jdbc:h2:${db.server}:${db.name};DB_CLOSE_ON_EXIT=FALSE
213+
spring.datasource.driverClassName=org.h2.Driver
214+
spring.datasource.username=sa
215+
spring.datasource.password=ENC(lA6JCEpK7+wuHDpB1A41DOUfn6L74DQxaazXLTjyQHY5/X6CONfUEyDt6erWifrN)
216+
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
217+
spring.datasource.hikari.connection-test-query=SELECT 1
218+
# =======================================================================
219+
# JPA / Hibernate Properties
220+
# ------------------------------------------------------------------------
221+
spring.jpa.show-sql=true
222+
spring.jpa.defer-datasource-initialization=true
223+
#spring.sql.init.data-locations=data-trans.sql
224+
# Hibernate ddl auto (create, create-drop, validate, update)
225+
spring.jpa.hibernate.ddl-auto=create-drop
226+
spring.jpa.properties.hibernate.format_sql=true
227+
spring.jpa.properties.hibernate.validator.apply_to_ddl=false
228+
#spring.jpa.properties.hibernate.check_nullability=true
229+
# =======================================================================
230+
# External Remote Server Properties
231+
# =======================================================================
232+
remote.host=127.0.0.1
233+
remote.port=8080
234+
remote.protocol=http
235+
# =======================================================================
236+
# Open API Properties
237+
# For More Info: https://springdoc.org/#Introduction
238+
# springdoc.api-docs.path=/api-docs
239+
# =======================================================================
240+
springdoc.api-docs.path=${service.api.path}
241+
springdoc.swagger-ui.path=${service.api.path}/swagger-ui.html
242+
springdoc.swagger-ui.tryItOutEnabled=true
243+
springdoc.swagger-ui.filter=true
244+
springdoc.swagger-ui.use-root-path=true
245+
springdoc.swagger-ui.disable-swagger-default-url=true
246+
server.forward-headers-strategy=framework
247+
springdoc.cache.disabled=true
248+
springdoc.writer-with-default-pretty-printer=true
249+
#springdoc.swagger-ui.configUrl=${service.api.path}/swagger-config/swagger-config.json
250+
# Disabling the api-docs endpoint
251+
springdoc.api-docs.enabled=true
252+
# Disabling the swagger-ui
253+
#springdoc.swagger-ui.enabled=true
254+
springdoc.swagger-ui.operationsSorter=method
255+
# For sorting tags alphabetically
256+
springdoc.swagger-ui.tagsSorter=alpha
257+
#springdoc.show-actuator=true
258+
# Packages to include
259+
# springdoc.packagesToScan=io.fusion.water, io.fusion.fire
260+
# Paths to include
261+
# springdoc.pathsToMatch=/v1, /api/health/**
262+
# To expose the swagger-ui, on the management port
263+
#springdoc.use-management-port=true
264+
# This property enables the openapi and swaggerui endpoints to be exposed
265+
# beneath the actuator base path.
266+
# management.endpoints.web.exposure.include=openapi, swaggerui
267+
# =======================================================================

config/application.properties

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# =======================================================================
22
# MS-Vanilla Service Properties
33
# =======================================================================
4-
build.number=225
5-
build.date=Sat Feb 1 16:35:06 IST 2025
4+
build.number=226
5+
build.date=Sat Feb 1 18:42:58 IST 2025
66
# ------------------------------------------------------------------------
77
# Spring Profile
88
# ------------------------------------------------------------------------
@@ -80,9 +80,12 @@ server.host.prod=https://prod.${service.org}.com
8080
server.host.prod.desc=Production Server
8181
server.error.whitelabel.enabled=true
8282
server.vulnerability.demos.allowed=false
83+
# ------------------------------------------------------------------------
8384
# Service Properties Details
8485
# ------------------------------------------------------------------------
85-
spring.codec.max-in-memory-size=3MB
86+
spring.main.lazy-initialization=true
87+
# Required only for WebFlux Applications
88+
#spring.codec.max-in-memory-size=256KB
8689
app.property.product=fusion.air.product
8790
app.property.product.list=/create, /status, /all/secured, /search/product, /search/price, /search/active, /deactivate, /activate, /update, /update/price, /update/details, /delete
8891
app.property.list=element1, element2, element3

src/docker/Input/application.properties

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# =======================================================================
22
# MS-Vanilla Service Properties
33
# =======================================================================
4-
build.number=225
5-
build.date=Sat Feb 1 16:35:06 IST 2025
4+
build.number=226
5+
build.date=Sat Feb 1 18:42:58 IST 2025
66
# ------------------------------------------------------------------------
77
# Spring Profile
88
# ------------------------------------------------------------------------
@@ -80,9 +80,12 @@ server.host.prod=https://prod.${service.org}.com
8080
server.host.prod.desc=Production Server
8181
server.error.whitelabel.enabled=true
8282
server.vulnerability.demos.allowed=false
83+
# ------------------------------------------------------------------------
8384
# Service Properties Details
8485
# ------------------------------------------------------------------------
85-
spring.codec.max-in-memory-size=3MB
86+
spring.main.lazy-initialization=true
87+
# Required only for WebFlux Applications
88+
#spring.codec.max-in-memory-size=256KB
8689
app.property.product=fusion.air.product
8790
app.property.product.list=/create, /status, /all/secured, /search/product, /search/price, /search/active, /deactivate, /activate, /update, /update/price, /update/details, /delete
8891
app.property.list=element1, element2, element3

src/docker/buildx.k8s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ echo "Building Container for $FULL_NAME-$K8S"
3636

3737
# Build Multi-Architecture Container
3838
echo "docker buildx build --platform linux/arm64,linux/amd64 \ "
39-
echo " --rm=true -t $FULL_NAME-$K8S -f $DOCKER_FILE.$K8S --push ."
39+
echo " --rm=true --build-arg BASE_IMAGE=$BASE_IMAGE \ "
40+
echo " -t $FULL_NAME-$K8S -f $DOCKER_FILE.$K8S --push ."
4041

4142
docker buildx build --platform linux/arm64,linux/amd64 \
42-
--rm=true -t "$FULL_NAME-$K8S" -f "$DOCKER_FILE.$K8S" --push .
43+
--rm=true --build-arg BASE_IMAGE=$BASE_IMAGE \
44+
-t "$FULL_NAME-$K8S" -f "$DOCKER_FILE.$K8S" --push .
4345

44-
#echo "docker push $FULL_NAME-$K8S"
45-
#docker push "$FULL_NAME-$K8S"

src/kubernetes/Package/application.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
build.number=225
2-
build.date=Sat Feb 1 16:35:06 IST 2025
1+
build.number=226
2+
build.date=Sat Feb 1 18:42:58 IST 2025
33
spring.profiles.default=dev
44
service.org=arafkarsh
55
service.name=MS-Vanilla
@@ -47,7 +47,7 @@ server.host.prod=https://prod.${service.org}.com
4747
server.host.prod.desc=Production Server
4848
server.error.whitelabel.enabled=true
4949
server.vulnerability.demos.allowed=false
50-
spring.codec.max-in-memory-size=3MB
50+
spring.main.lazy-initialization=true
5151
app.property.product=fusion.air.product
5252
app.property.product.list=/create, /status, /all/secured, /search/product, /search/price, /search/active, /deactivate, /activate, /update, /update/price, /update/details, /delete
5353
app.property.list=element1, element2, element3

src/kubernetes/Package/application.properties-r

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
build.number=225
2-
build.date=Sat Feb 1 16:35:06 IST 2025
1+
build.number=226
2+
build.date=Sat Feb 1 18:42:58 IST 2025
33
spring.profiles.default=dev
44
service.org=arafkarsh
55
service.name=MS-Vanilla
@@ -47,7 +47,7 @@ server.host.prod=https://prod.${service.org}.com
4747
server.host.prod.desc=Production Server
4848
server.error.whitelabel.enabled=true
4949
server.vulnerability.demos.allowed=false
50-
spring.codec.max-in-memory-size=3MB
50+
spring.main.lazy-initialization=true
5151
app.property.product=fusion.air.product
5252
app.property.product.list=/create, /status, /all/secured, /search/product, /search/price, /search/active, /deactivate, /activate, /update, /update/price, /update/details, /delete
5353
app.property.list=element1, element2, element3

src/kubernetes/Setup/vanillaInstall

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ echo "Deploy the Vanilla Service in Kubernetes cluster"
1313
echo "---------------------------------------------------------------"
1414
echo "1. Deploy the Vanilla Service Config/Secrets in Kubernetes cluster"
1515
kubectl create -f ../Yamls/vanilla-configmap-active.yaml
16-
kubectl create -f ../Yamls/vanilla-configmap-dev.yaml
17-
kubectl create -f ../Yamls/vanilla-configmap-staging.yaml
18-
kubectl create -f ../Yamls/vanilla-configmap-prod.yaml
16+
kubectl create -f ../Yamls/vanilla-configmap-profiles.yaml
1917
kubectl create -f ../Yamls/vanilla-secret.yaml
2018
echo "---------------------------------------------------------------"
2119
echo "2. Deploy the External Database Service"

src/kubernetes/Setup/vanillaUnInstall

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ uninstall() {
1616
echo "UnInstall the Vanilla ConfigMaps from Kubernetes cluster"
1717
echo "---------------------------------------------------------------"
1818
kubectl delete configmap vanilla-configmap-active
19-
kubectl delete configmap vanilla-configmap-dev
20-
kubectl delete configmap vanilla-configmap-staging
21-
kubectl delete configmap vanilla-configmap-prod
19+
kubectl delete configmap vanilla-configmap-profiles
2220
echo "---------------------------------------------------------------"
2321
echo "UnInstall the Vanilla Secret from Kubernetes cluster"
2422
echo "---------------------------------------------------------------"

src/kubernetes/Yamls/vanilla-configmap-active.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ kind: ConfigMap
33
metadata:
44
name: vanilla-configmap-active
55
data:
6-
spring.profiles.active: dev
6+
spring.profiles.active: prod

0 commit comments

Comments
 (0)