Skip to content

Commit

Permalink
Merge pull request sunbird-cb#232 from thejk726/dev-4.8.20
Browse files Browse the repository at this point in the history
Dev 4.8.20 Service added: cb-discussion-service
  • Loading branch information
Haritest authored Nov 19, 2024
2 parents ee3b063 + f5b79f6 commit 55bbfb1
Show file tree
Hide file tree
Showing 8 changed files with 271 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ansible/inventory/env/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ service_ml_template_validation_backend_service_service: ml-template-validation-b
service_public_assessment: public-assessment-service
service_cb_comment_service: cb-comment-service
service_thumbnail_generation_service: thumbnail-generation-service

service_cb_discussion_service: cb-discussion-service

# Ports
service_bulk_upload_port: 3009
Expand Down Expand Up @@ -822,6 +822,7 @@ service_ml_template_validation_backend_service_port: 5000
service_public_assessment_port: 8090
service_cb_comment_port: 8099
service_thumbnail_generation_port: 8000
service_cb_discussion_port: 7001

# Network alias names, so that one service can talk to another
network_alias_content_service: private-content-service
Expand Down Expand Up @@ -882,6 +883,7 @@ network_alias_ml_template_validation_backend_service_service: ml-template-valida
network_alias_public_assessment: public-assessment-service
network_alias_cb_comment_service: cb-comment-service
network_alias_thumbnail_generation_service: thumbnail-generation-service
network_alias_cb_discussion_service: cb-discussion-service

# Image names, this is used by the service alone, but since we want to have all the images in one place, we are oncfiguring the images here
image_ui_static: ui-static
Expand Down Expand Up @@ -939,6 +941,6 @@ image_ml_template_validation_backend_service_service: ml-template-validation-bac
image_public_assessment_service: public-assessment-service
image_cb_comment_service: cb-comment-service
image_thumbnail_generation_service: thumbnail-generation-service

image_cb_discussion_service: cb-discussion-service
#####################bulk-upload-spv#########
host_bulk_upload: /mydata/bulk_upload
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: cb-discussion-service
version: 0.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
# vars file for deploy-lex-core-service

# For script
release_name: "{{ network_alias_cb_discussion_service }}"
template_compose_file_name: cb-discussion-service.j2
template_env_file_name: cb-discussion-service-env.j2
compose_file_name: "{{ service_cb_discussion_service }}.yml"
env_file_name: "{{ service_cb_discussion_service }}.env"
helm_env_file_location: "../helm_charts/igot-deploy/templates/"
helm_env_file_name: "{{ helm_env_file_location }}/{{ service_cb_discussion_service }}.env"
#chart_path: "../kubernetes-deploy/cb-discussion-service"

env_file_deployment_location: "{{ env_files_dir }}/{{ env_file_name }}"
compose_file_deployment_location: "{{ compose_files_dir }}/{{ compose_file_name }}"
user_friendly_name: content validation service

# For service
application_port: "{{ service_cb_discussion_port }}"
image_name: "{{ image_cb_discussion_service }}"
tag: "{{ tags_cb_discussion_service }}"
host_port: "{{ application_port }}"
docker_port: "{{ application_port }}"
replicas: "{{ service_replicas_cb_discussion_service }}"
reserved_memory: "{{ service_mem_reserved_cb_discussion_service }}"
limited_memory: "{{ service_mem_limit_cb_discussion_service }}"
#limited_memory: 2048M
health_check_endpoint: http://127.0.0.1:{{ docker_port }}/contentValidation/actuator/health
network_alias_name: "{{ network_alias_cb_discussion_service }}"
docker_service_stack_name: lms
docker_service_name: "{{ service_cb_discussion_service }}"
force_reload: "{{ force_reload_cb_discussion_service }}"

# For application
server_connection_timeout: 5000
tomcat_max_threads: 400
tomcat_min_spare_threads: 20
servlet_multipart_max_file_size: 100Mb
servlet_multipart_max_request_size: 100Mb

content_service_url: http://{{ network_alias_content_service }}:{{ service_content_service_port }}

infosys_lex_core_ip: http://{{ network_alias_sb_cb_ext_service }}:{{ service_sb_cb_ext_port }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
server.connection-timeout=5000
server.tomcat.max-threads=2048
server.tomcat.min-spare-threads=20
server.tomcat.max-connections=15000
server.tomcat.accept-count=500
server.port={{ application_port }}

#spring data jpa for postgres
spring.datasource.url=jdbc:postgresql://{{ postgresql_host }}:{{ postgresql_port }}/sunbird
spring.datasource.username={{postgresql_username_sunbird }}
spring.datasource.password={{ postgresql_password_sunbird }}
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.show-sql=false
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto = update

spring.data.cassandra.startupTimeoutInSeconds=100000
spring.data.cassandra.contact-points={{ sunbird_cassandra_db_host }}
spring.data.cassandra.port=9042
spring.data.cassandra.keyspace-name={{ keyspace_sunbird }}
spring.data.cassandra.username={{ cassandra_username }}
spring.data.cassandra.password={{ cassandra_password }}
spring.data.cassandra.local-datacenter=DC1

cassandra.config.host={{ sunbird_cassandra_db_host }}

spring.redis.host={{ kp_redis_ip }}
spring.redis.port=6379
spring.redis.password=
spring.redis.cacheTtl= 60000
search.result.redis.ttl=600

elasticsearch.host={{ elasticsearch_host }}
elasticsearch.port={{ elasticsearch_http_port }}
elasticsearch.username={{ elasticsearch_username }}
elasticsearch.password={{ elasticsearch_password }}
elastic.required.field.discussion.json.path=/EsFieldsmapping/discussionEsMapping.json

#kafka Server
spring.kafka.bootstrap.servers={{ kafka_servers_list }}
#kafka properties
kakfa.offset.reset.value=latest
kafka.max.poll.interval.ms=15000
kafka.max.poll.records=100
kafka.auto.commit.interval.ms=10000

sso.url==https://{{ domain_name }}/auth/
sso.realm={{ keycloak_sso_realm }}
sso.connection.pool.size=20
sso.enabled=true

accesstoken.publickey.basepath=/keys/
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
{{- $keys := .Files.Glob "keys/*" }}
{{ if $keys }}
apiVersion: v1
kind: Secret
metadata:
name: cb-discussion-access-keys
type: Opaque
data:
{{ (.Files.Glob "keys/*").AsSecrets | indent 2 }}
{{ end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
namespace: {{ .Values.namespace }}
annotations:
reloader.stakater.com/auto: "true"
spec:
replicas: {{ .Values.replicaCount }}
strategy:
rollingUpdate:
maxSurge: {{ .Values.strategy.maxsurge }}
maxUnavailable: {{ .Values.strategy.maxunavailable }}
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
spec:
{{- if .Values.imagepullsecrets }}
imagePullSecrets:
- name: {{ .Values.imagepullsecrets }}
{{- end }}
volumes:
# - name: {{ .Chart.Name }}-xml-config
# configMap:
# name: {{ .Chart.Name }}-xml-config
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.dockerhub }}/{{ .Values.repository }}:{{ .Values.image_tag }}"
imagePullPolicy: Always
env:
- name: JAVA_OPTIONS
value: {{ .Values.env.javaoptions | quote }}
- name: _JAVA_OPTIONS
value: -Dlog4j2.formatMsgNoLookups=true
envFrom:
- configMapRef:
name: {{ .Chart.Name }}-config
resources:
{{ toYaml .Values.resources | indent 10 }}
ports:
- containerPort: {{ .Values.network.port }}
{{- if .Values.healthcheck }}
livenessProbe:
{{ toYaml .Values.livenessProbe | indent 10 }}
readinessProbe:
{{ toYaml .Values.readinessProbe | indent 10 }}
{{- end }}
volumeMounts:
{{- $keys := .Files.Glob "keys/*" }}
{{- if $keys }}
- mountPath: {{ .Values.cb_discussion_backend_basepath }}
name: access-keys
{{- end }}
volumes:
{{- $keys := .Files.Glob "keys/*" }}
{{- if $keys }}
- name: access-keys
secret:
secretName: cb-discussion-access-keys
{{- end }}

---
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}
namespace: {{ .Values.namespace }}
labels:
app: {{ .Chart.Name }}
spec:
ports:
- name: http-{{ .Chart.Name }}
protocol: TCP
port: {{ .Values.network.targetport }}
selector:
app: {{ .Chart.Name }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Chart.Name }}
namespace: {{ .Values.namespace }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Chart.Name }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
43 changes: 43 additions & 0 deletions kubernetes/helm_charts/igot-deploy/cb-discussion-service/values.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
### Default variable file for cb_discussion_service ###

namespace: {{ namespace }}
imagepullsecrets: {{ imagepullsecrets }}
dockerhub: {{ docker_hub_url }}


env:
javaoptions: {{cb_discussion_java_mem_limit|default('-Xmx600m')}}

replicaCount: {{cb_discussion_replicacount|default(1)}}
repository: {{ image_cb_discussion_service }}
image_tag: {{image_tag}}
resources:
requests:
cpu: {{cb_discussion_cpu_req|default('100m')}}
memory: {{cb_discussion_mem_req|default('100Mi')}}
limits:
cpu: {{cb_discussion_cpu_limit|default('1')}}
memory: {{cb_discussion_mem_limit|default('1024Mi')}}
network:
port: {{ service_cb_discussion_port }}
targetport: {{ service_cb_discussion_port }}
strategy:
type: RollingUpdate
maxsurge: {{ cb_discussion_maxsurge|default('25%') }}
maxunavailable: {{ cb_discussion_maxunavailable|default('25%') }}

cb_discussion_backend_basepath: {{ cb_discussion_backend_basepath | default('/keys/') }}


serviceMonitor:
enabled: true
labels: # labels with which the prometheus choose the serviceMonitor
app: prometheus-operator
release: prometheus-operator

autoscaling:
enabled: {{ cb_discussion_service_autoscaling_enabled | default('false') }}
minReplicas: {{ cb_discussion_service_autoscaling_minReplicas|default(1) }}
maxReplicas: {{ cb_discussion_service_autoscaling_maxReplicas|default(2) }}
targetCPUUtilizationPercentage: {{ cb_discussion_service_autoscaling_targetCPUUtilizationPercentage|default(60) }}
targetMemoryUtilizationPercentage: {{ cb_discussion_service_autoscaling_targetMemoryUtilizationPercentage|default('') }}

0 comments on commit 55bbfb1

Please sign in to comment.