Skip to content

Commit bc6f68d

Browse files
committed
chore: Enable the ablity to toggle search feature in Dockerfile and Kubernetes deployment templates
1 parent 8a8cd40 commit bc6f68d

File tree

6 files changed

+14
-8
lines changed

6 files changed

+14
-8
lines changed

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ ENV USER_NAME=postgres
55
ENV PASSWORD=password
66
ENV CHANGELOG_VERSION=master.xml
77
ENV SPRING_JPA_PROPERTIES_HIBERNATE_DEFAULT_SCHEMA=public
8+
ENV SEARCH_FEATURE_FLAG=false
89
RUN mkdir workspace
910
WORKDIR /workspace/
1011
COPY target/salesmanager-*-SNAPSHOT.jar .
1112
EXPOSE 8086
12-
CMD ["/bin/sh", "-c", "java -jar salesmanager-*-SNAPSHOT.jar --spring.datasource.url=${DB_URL} --spring.datasource.username=${USER_NAME} --spring.datasource.password=${PASSWORD} --spring.redis.port=6379 --spring.redis.host=${REDIS_HOST} --spring.liquibase.change-log=classpath:db/changelog/${CHANGELOG_VERSION}"]
13+
CMD ["/bin/sh", "-c", "java -DenableSearchFeature=${SEARCH_FEATURE_FLAG} -jar salesmanager-*-SNAPSHOT.jar --spring.datasource.url=${DB_URL} --spring.datasource.username=${USER_NAME} --spring.datasource.password=${PASSWORD} --spring.redis.port=6379 --spring.redis.host=${REDIS_HOST} --spring.liquibase.change-log=classpath:db/changelog/${CHANGELOG_VERSION}"]

build_and_run_app_in_container.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ trap cleanup EXIT
2525

2626
set -e # Exit immediately if a command exits with a non-zero status.
2727
# Getting local ip address from ifconfig
28-
LOCAL_IP=$(ifconfig | grep 'inet ' | grep -Fv 127.0.0.1 | awk '{print $2}')
28+
# LOCAL_IP=$(ifconfig | grep 'inet ' | grep -Fv 127.0.0.1 | awk '{print $2}')
29+
LOCAL_IP=192.168.64.1
2930
# Run a postgresql container with a volume to persist data
3031
docker run -d -p 5432:5432 --name postgres_container -e POSTGRES_PASSWORD=Password123 -v postgresql-data:/var/lib/postgresql/data postgres
3132
# [Optional] Run any previous migrations and tag the latest version with Liquibase

my-chart/templates/spring-app-deployment-v1.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ spec:
3131
value: {{ .Values.v1.springAppContainer.env.redisHost }}
3232
- name: KUBERNETES_CLUSTER_DOMAIN
3333
value: {{ .Values.kubernetesClusterDomain }}
34+
- name: SEARCH_FEATURE_FLAG
35+
value: {{ .Values.v1.springAppContainer.env.searchFeatureEnabled | quote }}
3436
image: {{ .Values.v1.springAppContainer.image.repository }}:{{ .Values.v1.springAppContainer.image.tag }}
3537
imagePullPolicy: Always
3638
name: spring-app-container

my-chart/templates/spring-app-deployment-v2.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ spec:
2929
value: {{ .Values.v2.springAppContainer.env.changelogVersion }}
3030
- name: REDIS_HOST
3131
value: {{ .Values.v2.springAppContainer.env.redisHost }}
32+
- name: SEARCH_FEATURE_FLAG
33+
value: {{ .Values.v2.springAppContainer.env.searchFeatureFlag | quote }}
3234
image: {{ .Values.v2.springAppContainer.image.repository }}:{{ .Values.v2.springAppContainer.image.tag }}
3335
imagePullPolicy: Always
3436
name: spring-app-container

my-chart/values.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
v1:
2-
replicas: 1
2+
replicas: 4
33
springAppContainer:
44
env:
55
changelogVersion: changelog_version-3.3.xml
66
dbUrl: jdbc:postgresql://postgres-database-service:5432/postgres
77
password: admin123
88
redisHost: redis-database-service
99
userName: postgresadmin
10+
searchFeatureEnabled: "false"
1011
image:
1112
repository: ghcr.io/octodemo/java-springboot-demo
12-
tag: "199"
13+
tag: "9999"
1314
resources:
1415
limits:
1516
cpu: "1"
@@ -18,17 +19,18 @@ v1:
1819
cpu: 125m
1920
memory: 128Mi
2021
v2:
21-
replicas: 3
22+
replicas: 0
2223
springAppContainer:
2324
env:
2425
changelogVersion: changelog_version-3.3.xml
2526
dbUrl: jdbc:postgresql://postgres-database-service:5432/postgres
2627
password: admin123
2728
redisHost: redis-database-service
2829
userName: postgresadmin
30+
searchFeatureFlag: "true"
2931
image:
3032
repository: ghcr.io/octodemo/java-springboot-demo
31-
tag: "198"
33+
tag: "9999"
3234
resources:
3335
limits:
3436
cpu: "1"

src/main/resources/static/js/styles.js

-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ if (window.enableSearchFeature) {
4444
'--th-bg-color': '#2196F3',
4545
'--a-color': '#2196F3',
4646
'--tr-bg-color': '#c2e0fb',
47-
'--a-color': '#2196F3',
4847
};
4948
} else {
5049
themeColors = {
@@ -54,7 +53,6 @@ if (window.enableSearchFeature) {
5453
'--tr-bg-color': '#fbfde3',
5554
'--button-color': '#4CAF50',
5655
'--button-hover-color': '#388E3C',
57-
'--a-color': '#4CAF50',
5856
};
5957
}
6058

0 commit comments

Comments
 (0)