diff --git a/ansible/roles/reset-docker/tasks/main.yml b/ansible/roles/reset-docker/tasks/main.yml index 636997729b1fc3e459daeb5c1a137d6f1fdba42c..bdc4ebc59f6fce5f748cafee2ce2a9972311044f 100644 --- a/ansible/roles/reset-docker/tasks/main.yml +++ b/ansible/roles/reset-docker/tasks/main.yml @@ -10,8 +10,8 @@ shell: "docker stack rm player" ignore_errors: yes -- name: Remove learner service - shell: "docker stack rm player" +- name: Remove lms service + shell: "docker stack rm lms-service" ignore_errors: yes - name: Copy the restart command script diff --git a/ansible/roles/stack-monitor-stateful/defaults/main.yml b/ansible/roles/stack-monitor-stateful/defaults/main.yml index edcae49b98bdb0c7b65e4501970f3a573b64f27b..09f83cce2b129a7396300ef60e6fd8509f930436 100644 --- a/ansible/roles/stack-monitor-stateful/defaults/main.yml +++ b/ansible/roles/stack-monitor-stateful/defaults/main.yml @@ -107,6 +107,7 @@ service_teams: services: - actor-service - learner-service + - lms-service - content-service - player_player - cassandra diff --git a/ansible/roles/stack-monitor/defaults/main.yml b/ansible/roles/stack-monitor/defaults/main.yml index e67189b8b95a943c20b16186c1aa02b9e4118a8c..457e201b7697ea9b4dd7c33b0d38b766fe07e4bb 100644 --- a/ansible/roles/stack-monitor/defaults/main.yml +++ b/ansible/roles/stack-monitor/defaults/main.yml @@ -96,6 +96,7 @@ service_teams: services: - actor-service - learner-service + - lms-service - content-service - player_player - cassandra diff --git a/ansible/roles/stack-sunbird/tasks/lms_service.yml b/ansible/roles/stack-sunbird/tasks/lms_service.yml new file mode 100644 index 0000000000000000000000000000000000000000..f99ef4502ac4b4334c63f00f06a785ee1cd6d20f --- /dev/null +++ b/ansible/roles/stack-sunbird/tasks/lms_service.yml @@ -0,0 +1,9 @@ +--- +- name: Remove lms service + shell: "docker service rm lms-service" + ignore_errors: yes + +- name: Deploy lms service + shell: "docker service create --with-registry-auth --replicas {{ learner_replicas }} -p 9005:9000 --name lms-service --hostname lms-service --reserve-memory {{ learner_reservation_memory }} --limit-memory {{ learner_limit_memory }} --limit-cpu {{ learner_limit_cpu }} --reserve-cpu {{ learner_reservation_cpu }} --health-cmd 'wget -qO- lms-service:9000/service/health || exit 1' --health-timeout 3s --health-retries 3 --network application_default --env-file /home/deployer/env/sunbird_lms-service.env {{hub_org}}/{{image_name}}:{{image_tag}}" + args: + chdir: /home/deployer/stack \ No newline at end of file diff --git a/ansible/roles/stack-sunbird/tasks/main.yml b/ansible/roles/stack-sunbird/tasks/main.yml index 6d477105816cffa662d5b65718dd0c2d9e1452ba..d400460d96f780da824ae79c0299115d3867137b 100644 --- a/ansible/roles/stack-sunbird/tasks/main.yml +++ b/ansible/roles/stack-sunbird/tasks/main.yml @@ -6,6 +6,9 @@ - include: learner_service.yml when: deploy_learner is defined + + - include: lms_service.yml + when: deploy_lms is defined - include: enc_service.yml when: deploy_enc is defined diff --git a/ansible/roles/stack-sunbird/templates/sunbird_lms-service.env b/ansible/roles/stack-sunbird/templates/sunbird_lms-service.env new file mode 100644 index 0000000000000000000000000000000000000000..65a97a3c6f639edfb95ca5e37048915ad5e6743e --- /dev/null +++ b/ansible/roles/stack-sunbird/templates/sunbird_lms-service.env @@ -0,0 +1,102 @@ +sunbird_sso_publickey={{sunbird_sso_publickey}} +sunbird_sso_url={{keycloak_auth_server_url}}/ +sunbird_sso_realm={{keycloak_realm}} +sunbird_sso_username={{sunbird_sso_username}} +sunbird_sso_password={{sunbird_sso_password}} +sunbird_sso_client_id={{sunbird_sso_client_id}} +sunbird_es_host={{sunbird_es_host}} +sunbird_es_port={{sunbird_es_port}} +sunbird_cassandra_username=cassandra +sunbird_cassandra_password=password +actor_hostname=actor-service +bind_hostname=0.0.0.0 +ekstep_authorization={{sunbird_ekstep_api_key}} +sunbird_pg_host={{sunbird_pg_host}} +sunbird_pg_port={{sunbird_pg_port}} +sunbird_pg_db={{sunbird_pg_db}} +sunbird_pg_user={{sunbird_pg_user}} +sunbird_pg_password={{sunbird_pg_password}} +sunbird_installation={{sunbird_installation}} +sunbird_analytics_api_base_url={{sunbird_analytics_api_base_url}} +sunbird_search_service_api_base_url={{sunbird_search_service_api_base_url}} +ekstep_api_base_url={{sunbird_content_repo_api_base_url}} +sunbird_mail_server_host={{sunbird_mail_server_host}} +sunbird_mail_server_port={{sunbird_mail_server_port}} +sunbird_mail_server_username={{sunbird_mail_server_username}} +sunbird_mail_server_password={{sunbird_mail_server_password}} +sunbird_mail_server_from_email={{sunbird_mail_server_from_email}} +sunbird_encryption_key={{sunbird_encryption_key}} +sunbird_encryption_mode={{sunbird_encryption_mode}} +sunbird_account_name={{sunbird_account_name}} +sunbird_account_key={{sunbird_account_key}} +sunbird_quartz_mode={{sunbird_sunbird_quartz_mode}} +sunbird_env_logo_url={{sunbird_env_logo_url}} +sunbird_web_url={{sunbird_web_url}} +sunbird_fcm_account_key={{sunbird_fcm_account_key}} +sunbird_msg_91_auth={{sunbird_msg_91_auth}} +sunbird_msg_sender={{sunbird_msg_sender}} +sunbird_installation_email={{sunbird_installation_email}} +{% if groups['cassandra-2'] is defined %} +sunbird_cassandra_host={{groups['cassandra']|join(',')}} +sunbird_cassandra_port=9042,9042,9042 +sunbird_cassandra_consistency_level=quorum +{% else %} +sunbird_cassandra_host={{sunbird_cassandra_host}} +sunbird_cassandra_port=9042 +sunbird_cassandra_consistency_level={{sunbird_cassandra_consistency_level}} +{% endif %} + +sunbird_mw_system_host=lms-service +sunbird_mw_system_port=8088 +background_actor_provider=local +api_actor_provider=local +badging_authorization_key={{vault_badging_authorization_key}} +sunbird_badger_baseurl=http://badger-service:8004 +sunbird_remote_req_router_path=akka.tcp://SunbirdMWSystem@actor-service:8088/user/RequestRouter +sunbird_remote_bg_req_router_path=akka.tcp://SunbirdMWSystem@actor-service:8088/user/BackgroundRequestRouter +sunbird_api_base_url=http://content-service:5000 +sunbird_authorization={{sunbird_api_auth_token}} +telemetry_pdata_id={{sunbird_telemetry_pdata_id}} +telemetry_pdata_pid=lms-service +sunbird_telemetry_base_url=http://telemetry-service:9001 +telemetry_queue_threshold_value=100 +sunbird_default_channel={{sunbird_default_channel}} +sunbird_api_mgr_base_url=http://content-service:5000 +sunbird_cs_base_url={{sunbird_cs_base_url}} +sunbird_cs_search_path=/v1/content/search + +sunbird_env_logo_url={{sunbird_env_logo_url}} +sunbird_user_bulk_upload_size={{sunbird_user_bulk_upload_size}} +sunbird_installation_display_name={{sunbird_installation_display_name}} + +sunbird_app_name={{sunbird_app_name|default('Sunbird')}} +sunbird_registry_service_baseurl=http://registry_registry:8080/ +sunbird_open_saber_bridge_enable={{sunbird_open_saber_bridge_enable|default('false')}} +sunbird_environment={{sunbird_environment}} +sunbird_instance={{sunbird_instance}} +sunbird_email_max_recipients_limit={{sunbird_email_max_recipients_limit}} +sunbird_url_shortner_access_token={{sunbird_url_shortner_access_token}} +sunbird_url_shortner_enable={{sunbird_url_shortner_enable}} +sunbird_user_profile_field_default_visibility={{sunbird_user_profile_field_default_visibility}} +sunbird_keycloak_required_action_link_expiration_seconds={{sunbird_keycloak_required_action_link_expiration_seconds}} +sunbird_course_batch_notification_enabled={{sunbird_course_batch_notification_enabled}} +sunbird_course_batch_notification_signature={{sunbird_course_batch_notification_signature}} +sunbird_otp_expiration={{sunbird_otp_expiration}} +sunbird_otp_length={{sunbird_otp_length}} +sunbird_content_azure_storage_container={{sunbird_content_azure_storage_container}} +# Release-1.14 +sunbird_time_zone={{sunbird_time_zone}} +# Release-1.15 +sunbird_health_check_enable={{sunbird_health_check_enable}} +sunbird_keycloak_user_federation_provider_id={{core_vault_sunbird_keycloak_user_federation_provider_id}} +sunbird_gzip_enable={{sunbird_gzip_enable}} +sunbird_course_metrics_base_url={{sunbird_course_metrics_base_url}} +sunbird_gzip_size_threshold={{sunbird_gzip_size_threshold | default(262144)}} +sunbird_analytics_blob_account_name={{sunbird_analytics_blob_account_name}} +sunbird_analytics_blob_account_key={{sunbird_analytics_blob_account_key}} +# Optional for caching +sunbird_cache_enable={{sunbird_cache_enable | default(false)}} +# Set below variables if above true +sunbird_redis_host={{sunbird_redis_host}} +sunbird_redis_port={{sunbird_redis_port|default(6379)}} +sunbird_user_org_api_base_url={{sunbird_user_org_api_base_url}} diff --git a/ansible/static-files/health.sh b/ansible/static-files/health.sh index 932a9a02f834daac045071ef182e9be4978fa0ec..575fd669e270382be9f1da100e8e44960244567d 100755 --- a/ansible/static-files/health.sh +++ b/ansible/static-files/health.sh @@ -7,6 +7,7 @@ outpt1=$(curl -s content-service:5000/health | jq '.result.healthy') outpt2=$(curl -s player_player:3000/health| jq '.result.healthy') outpt3=$(curl -s learner-service:9000/health | jq '.result.response.checks[0].healthy') +outpt4=$(curl -s lms-service:9005/health | jq '.result.response.checks[0].healthy') echo "" echo "" if [ "$outpt1" == "true" ];then @@ -32,3 +33,12 @@ if [ "$outpt3" == "true" ];then else echo "Learner Service is unhealthy" fi + +echo "" +echo "" + +if [ "$outpt4" == "true" ];then + echo "Lms Service is Healthy" +else + echo "Lms Service is unhealthy" +fi diff --git a/pipelines/deploy/lms/Jenkinsfile b/pipelines/deploy/lms/Jenkinsfile new file mode 100644 index 0000000000000000000000000000000000000000..fc8ab4cd2e447f174dfeed5b9e2cb2a667116a4f --- /dev/null +++ b/pipelines/deploy/lms/Jenkinsfile @@ -0,0 +1,26 @@ +@Library('deploy-conf') _ +node() { + try { + stage('checkout public repo') { + cleanWs() + checkout scm + } + + stage('deploy') { + values = docker_params() + currentWs = sh(returnStdout: true, script: 'pwd').trim() + ansiblePlaybook = "$currentWs/ansible/deploy.yml" + ansibleExtraArgs = "--tags \"stack-sunbird\" --extra-vars \"hub_org=$hub_org image_name=$values.image_name image_tag=$values.image_tag service_name=lms-service deploy_lms=True\" --vault-password-file /var/lib/jenkins/secrets/vault-pass" + values.put('currentWs', currentWs) + values.put('ansiblePlaybook', ansiblePlaybook) + values.put('ansibleExtraArgs', ansibleExtraArgs) + ansible_playbook_run(values) + archiveArtifacts 'metadata.json' + currentBuild.description = "${values.image_tag}" + } + } + catch (err) { + currentBuild.result = "FAILURE" + throw err + } +} \ No newline at end of file