Skip to content

Commit 4c5cf9c

Browse files
committed
feat: switch config-server from git to native profiles
- Replace gitlab git backend with native classpath configs - Add dev/prod profiles per service: - dev: docker-compose service names (linkedin-db, connections-db) - prod: k8s service names (postgres, neo4j) - Update K8s configmap to SPRING_PROFILES_ACTIVE=prod - Split NEO4J_AUTH (container) and NEO4J_PASSWORD (app) in secrets - Remove hardcoded env overrides from K8s microservice manifests
1 parent 45dce53 commit 4c5cf9c

29 files changed

Lines changed: 262 additions & 203 deletions
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
spring:
22
application:
33
name: config-server
4-
4+
profiles:
5+
active: native
56
cloud:
67
config:
78
server:
8-
git:
9-
uri: https://gitlab.cs.nuim.ie/linkedin-microservice/linkedinconfigs
10-
default-label: main
11-
username: p250109
12-
password: ${GIT_PASSWORD} # Use env var or Docker secret for safety
13-
clone-on-start: true # Good for reliability on restart
9+
native:
10+
search-locations: classpath:/configs
1411

1512
server:
1613
port: 8888
@@ -20,4 +17,4 @@ eureka:
2017
register-with-eureka: true
2118
fetch-registry: true
2219
service-url:
23-
defaultZone: http://discovery-server:8761/eureka
20+
defaultZone: http://discovery-server:8761/eureka
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
server:
2+
port: 8080
3+
4+
jwt:
5+
secretKey: ${JWT_SECRET:asdfladf98a7df89aysf8d9yasiudfha9s87dfa89syudhfa98sdfyaisuhdfa98sfy}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Shared config for all services
2+
management:
3+
health:
4+
circuitbreakers:
5+
enabled: true
6+
endpoints:
7+
web:
8+
exposure:
9+
include: "*"
10+
endpoint:
11+
health:
12+
show-details: always
13+
tracing:
14+
sampling:
15+
probability: 1.0
16+
zipkin:
17+
tracing:
18+
endpoint: http://zipkin:9411/api/v2/spans
19+
20+
eureka:
21+
client:
22+
service-url:
23+
defaultZone: http://discovery-server:8761/eureka
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Dev profile — Docker Compose
2+
spring:
3+
neo4j:
4+
uri: bolt://connections-db:7687
5+
authentication:
6+
username: neo4j
7+
password: password
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Prod profile — K8s / K3s
2+
spring:
3+
neo4j:
4+
uri: bolt://neo4j:7687
5+
authentication:
6+
username: neo4j
7+
password: ${NEO4J_PASSWORD:neo4j_prod_password}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Common connections-service config
2+
server:
3+
servlet:
4+
context-path: /connections
5+
port: 8080
6+
7+
spring:
8+
data:
9+
neo4j:
10+
repositories:
11+
enabled: true
12+
kafka:
13+
bootstrap-servers: kafka:9092
14+
producer:
15+
key-serializer: org.apache.kafka.common.serialization.LongSerializer
16+
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
17+
consumer:
18+
group-id: ${spring.application.name}
19+
key-deserializer: org.apache.kafka.common.serialization.LongDeserializer
20+
value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
21+
properties:
22+
spring.json.trusted.packages: "com.premtsd.linkedin.*"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
server:
2+
port: 8761
3+
4+
eureka:
5+
client:
6+
register-with-eureka: false
7+
fetch-registry: false
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Dev profile — Docker Compose
2+
spring:
3+
datasource:
4+
url: jdbc:postgresql://linkedin-db:5432/linkedinDB
5+
username: user
6+
password: password
7+
jpa:
8+
hibernate:
9+
ddl-auto: create-drop
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Prod profile — K8s / K3s
2+
spring:
3+
datasource:
4+
url: jdbc:postgresql://postgres:5432/linkedinDB
5+
username: linkedin_user
6+
password: ${DB_PASSWORD:password}
7+
jpa:
8+
hibernate:
9+
ddl-auto: update
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Common notification-service config
2+
server:
3+
port: 8080
4+
5+
spring:
6+
mail:
7+
host: smtp.gmail.com
8+
port: 587
9+
username: i.prem.tsd@gmail.com
10+
password: ${MAIL_PASSWORD:qwxzaaiswyqigbdh}
11+
properties:
12+
mail:
13+
smtp:
14+
auth: true
15+
starttls:
16+
enable: true
17+
required: true
18+
ssl:
19+
trust: smtp.gmail.com
20+
kafka:
21+
bootstrap-servers: kafka:9092
22+
consumer:
23+
group-id: ${spring.application.name}
24+
key-deserializer: org.apache.kafka.common.serialization.LongDeserializer
25+
value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
26+
properties:
27+
spring.json.trusted.packages: "com.premtsd.linkedin.*"

0 commit comments

Comments
 (0)