diff --git a/ansible_workspace_dir/main.yml b/ansible_workspace_dir/main.yml index bc41ea30d1b5769bed4a0c34d905c62c44ab2494..47443b5d03a3f3bbcc9c0dea9863535d4b45cda9 100644 --- a/ansible_workspace_dir/main.yml +++ b/ansible_workspace_dir/main.yml @@ -14,6 +14,9 @@ tags: [deploy-user-service] - role: deploy-gateway-service tags: [deploy-gateway-service] + - role: deploy-analytics-service + tags: [deploy-analytics-service] + - role: stack-proxy tags: [stack-proxy] diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/README.md b/ansible_workspace_dir/roles/deploy-analytics-service/README.md new file mode 100755 index 0000000000000000000000000000000000000000..225dd44b9fc5b3abff7e9c68ff9e91d505cdd5f0 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/defaults/main.yml b/ansible_workspace_dir/roles/deploy-analytics-service/defaults/main.yml new file mode 100755 index 0000000000000000000000000000000000000000..f7a32d2e72f8f40e950342ad66797e5e8afb7123 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for deploy-sb-ext \ No newline at end of file diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/handlers/main.yml b/ansible_workspace_dir/roles/deploy-analytics-service/handlers/main.yml new file mode 100755 index 0000000000000000000000000000000000000000..8b41ab532c1d43279b305468dc4fbcd0a4b2910a --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for deploy-sb-ext \ No newline at end of file diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/meta/main.yml b/ansible_workspace_dir/roles/deploy-analytics-service/meta/main.yml new file mode 100755 index 0000000000000000000000000000000000000000..72237997416054b6ceb4dcba9ceeb992ab8e7f71 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/meta/main.yml @@ -0,0 +1,57 @@ +galaxy_info: + author: your name + description: your description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Some suggested licenses: + # - BSD (default) + # - MIT + # - GPLv2 + # - GPLv3 + # - Apache + # - CC-BY + license: license (GPLv2, CC-BY, etc) + + min_ansible_version: 1.2 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # Optionally specify the branch Galaxy will use when accessing the GitHub + # repo for this role. During role install, if no tags are available, + # Galaxy will use this branch. During import Galaxy will access files on + # this branch. If Travis integration is configured, only notifications for this + # branch will be accepted. Otherwise, in all cases, the repo's default branch + # (usually master) will be used. + #github_branch: + + # + # platforms is a list of platforms, and each platform has a name and a list of versions. + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. \ No newline at end of file diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/tasks/create-and-save-env-file.yml b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/create-and-save-env-file.yml new file mode 100755 index 0000000000000000000000000000000000000000..9e7c6ce29035e07ed5feaf56450def30bf42bcbd --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/create-and-save-env-file.yml @@ -0,0 +1,9 @@ +--- + - name: Ensure env directory exists + file: + path: "{{ env_files_dir }}" + state: directory + - name: Create and save env template + template: + src: "{{ template_env_file_name }}" + dest: "{{ env_file_deployment_location }}" diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/tasks/create-compose-dir.yml b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/create-compose-dir.yml new file mode 100755 index 0000000000000000000000000000000000000000..847a403cbffdec88c1f81bfe516ab05c259a5b11 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/create-compose-dir.yml @@ -0,0 +1,5 @@ +--- +- name: Ensure compose files directory exists + file: + path: "{{ compose_files_dir }}" + state: directory \ No newline at end of file diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/tasks/create-compose-file.yml b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/create-compose-file.yml new file mode 100755 index 0000000000000000000000000000000000000000..9efe760080bdead7916b5dc6322ce4e50e06f0c7 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/create-compose-file.yml @@ -0,0 +1,4 @@ +- name: Create and move {{ user_friendly_name }} template + template: + src: "{{ template_compose_file_name }}" + dest: "{{ compose_file_deployment_location }}" \ No newline at end of file diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/tasks/deploy-service.yml b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/deploy-service.yml new file mode 100755 index 0000000000000000000000000000000000000000..db14b0efc8b3cee84ccb441754649493eea41505 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/deploy-service.yml @@ -0,0 +1,2 @@ +- name: Deploy {{ user_friendly_name }} + shell: docker stack deploy --with-registry-auth -c {{ compose_file_deployment_location }} {{ docker_service_stack_name }} diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/tasks/main.yml b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/main.yml new file mode 100755 index 0000000000000000000000000000000000000000..ae8667ee4a0147844aa8cd9905f513553e8137c7 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/main.yml @@ -0,0 +1,9 @@ +--- +# tasks file for deploy-sb-ext +- import_tasks: create-and-save-env-file.yml +- import_tasks: create-compose-dir.yml +- import_tasks: create-compose-file.yml +- import_tasks: remove-existing-service.yml +- import_tasks: deploy-service.yml +- import_tasks: remove-compose-file.yml +# - import_tasks: remove-env-file.yml diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/tasks/remove-compose-file.yml b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/remove-compose-file.yml new file mode 100755 index 0000000000000000000000000000000000000000..f38a758420da20f9227f232d97ec94c8aef77124 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/remove-compose-file.yml @@ -0,0 +1,5 @@ +--- + - name: Remove the compose file from the location + file: + path: "{{ compose_file_deployment_location }}" + state: absent \ No newline at end of file diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/tasks/remove-env-file.yml b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/remove-env-file.yml new file mode 100755 index 0000000000000000000000000000000000000000..d0422d740425da464e64b6a2e486b72bedc731ff --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/remove-env-file.yml @@ -0,0 +1,5 @@ +--- + - name: Remove the env file + file: + path: "{{ env_file_deployment_location }}" + state: absent \ No newline at end of file diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/tasks/remove-existing-service.yml b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/remove-existing-service.yml new file mode 100755 index 0000000000000000000000000000000000000000..0f38b6574d1a0bac724c4d1ec9da85dbeccae37c --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/tasks/remove-existing-service.yml @@ -0,0 +1,5 @@ +--- + - name: Removing the existing service + shell: docker service rm {{ docker_service_stack_name }}_{{ docker_service_name }} + when: "force_reload==true" + ignore_errors: true \ No newline at end of file diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/templates/analytics-service-compose-file.j2 b/ansible_workspace_dir/roles/deploy-analytics-service/templates/analytics-service-compose-file.j2 new file mode 100755 index 0000000000000000000000000000000000000000..c6e57ac4de1540a8a5532d906eeabe01b6d4c770 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/templates/analytics-service-compose-file.j2 @@ -0,0 +1,51 @@ +version: '3.7' + +services: + {{ docker_service_name }}: + image: {{ docker_hub_url }}/{{ image_name }}:{{ tag }} + hostname: "{{ docker_service_name }}" + + {% if publish_ports == true %} + + ports: + - {{ host_port }}:{{ docker_port }} + + {% endif %} + + deploy: + placement: + constraints: + - node.role == {{ var_docker_deploy_node_type }} + replicas: {{ replicas }} + resources: + reservations: + memory: {{ reserved_memory }} + limits: + memory: {{ limited_memory }} + update_config: + parallelism: 1 + delay: 0s + failure_action: rollback + order: start-first + rollback_config: + parallelism: 1 + delay: 0s + restart_policy: + condition: on-failure +# healthcheck: +# test: wget --quiet --spider http://localhost:5902/v1/latest/terms/user +# interval: 10s +# timeout: 10s +# retries: 3 +# start_period: 100s + volumes: + - {{ host_logs_location }}:{{ docker_logs_location }} + networks: + application_default: + aliases: + - {{ network_alias_name }} + env_file: + - {{ env_file_deployment_location }} +networks: + application_default: + external: true \ No newline at end of file diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/templates/analytics-service-env.j2 b/ansible_workspace_dir/roles/deploy-analytics-service/templates/analytics-service-env.j2 new file mode 100755 index 0000000000000000000000000000000000000000..101faeece40dd090873974c02f9e5798b6aae7b2 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/templates/analytics-service-env.j2 @@ -0,0 +1,78 @@ +server.port={{ service_analytics_port }} + +spring.datasource.url=jdbc:mysql://{{ mysql_host }}:3306/smfanalytics +spring.datasource.username={{ mysql_username }} +spring.datasource.password={{ mysql_password }} +spring.datasource.driver-class-name=com.mysql.jdbc.Driver +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration + +#----------------------------- ELASTIC SEARCH CONFIGURATIONS ------------------------------# +services.esindexer.quadnary.host=http://{{ elastic_host }}/ +services.esindexer.quadnary.host.name={{ elastic_host }} +services.esindexer.quadnary.host.port=9200 +services.esindexer.quadnary.username={{ elastic_username }} +services.esindexer.quadnary.password={{ elastic_password }} + +# Kronos-RAIN Production +services.esindexer.primary.host={{ elastic_host }} +services.esindexer.primary.host.name={{ elastic_host }} +services.esindexer.primary.host.port=9200 +services.esindexer.primary.username={{ elastic_username }} +services.esindexer.primary.password={{ elastic_password }} + +#services.esindexer.secondary.host={{ elastic_host }} +#services.esindexer.secondary.host.name={{ elastic_host }} +#services.esindexer.secondary.host.port=9200 +#services.esindexer.secondary.username={{ elastic_username }} +#services.esindexer.secondary.password={{ elastic_password }} + +# Anuvad +services.esindexer.secondary.host={{ elastic_host }} +services.esindexer.secondary.host.name={{ elastic_host }} +services.esindexer.secondary.host.port=9200 +services.esindexer.secondary.username={{ elastic_username }} +services.esindexer.secondary.password={{ elastic_password }} + + + +services.esindexer.ternary.host={{ elastic_host }} +services.esindexer.ternary.host.name={{ elastic_host }} +services.esindexer.ternary.host.port=9200 +services.esindexer.ternary.username={{ elastic_username }} +services.esindexer.ternary.password={{ elastic_password }} +es.index.name=_transaction +es.document.type=transaction +es.target.index.name=store_target +es.target.document.type=storeTarget +config.schema.paths=classpath*:schema/*.json + +#----------------------------- MISCELLANEOUS CONFIGURATION ----------------------------------# +top.performance.record.count=5 + +es.services.esindexer.host.search=/_search + +es.username={{ elastic_username }} +es.password={{ elastic_password }} + +#----------------------------- AMAZON S3 CREDENTIALS -------------------------------------------------# +aws.access.key.id=test +aws.access.key.secret=test +aws.region=ap-south-1 +aws.s3.audio.bucket=dss-project-bucket + +#---------------------------- MDMS ---------------------------------------------------------------------# +egov.mdms-service.target.url=https://{{ egov_domain }}/egov-mdms-service/v1/_search +egov.mdms-service.request={"RequestInfo":{"authToken":""},"MdmsCriteria":{"tenantId":"pb","moduleDetails":[{"moduleName":"tenant","masterDetails":[{"name":"tenants"}]}]}} + +# KAFKA SERVER CONFIGURATIONS +spring.kafka.bootstrap.servers={{ kafka_host }}:9092 + +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer + +# KAFKA PRODUCER CONFIGURATIONS +kafka.producer.config.retries_config=0 +kafka.producer.config.batch_size_config=100000 +kafka.producer.config.linger_ms_config=100 +kafka.producer.config.buffer_memory_config=66554432 + diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/tests/inventory b/ansible_workspace_dir/roles/deploy-analytics-service/tests/inventory new file mode 100755 index 0000000000000000000000000000000000000000..878877b0776c44f55fc4e458f70840f31da5bb01 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/tests/test.yml b/ansible_workspace_dir/roles/deploy-analytics-service/tests/test.yml new file mode 100755 index 0000000000000000000000000000000000000000..4c4d35571b7e9fd00e869a48dbddbe845c6d9fa1 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - deploy-sb-ext \ No newline at end of file diff --git a/ansible_workspace_dir/roles/deploy-analytics-service/vars/main.yml b/ansible_workspace_dir/roles/deploy-analytics-service/vars/main.yml new file mode 100755 index 0000000000000000000000000000000000000000..eb83f251a8cba97ab868e8b4b54a493c2ecbbce6 --- /dev/null +++ b/ansible_workspace_dir/roles/deploy-analytics-service/vars/main.yml @@ -0,0 +1,43 @@ +--- +# vars file for deploy-sb-ext +# For script +template_compose_file_name: analytics-service-compose-file.j2 +template_env_file_name: analytics-service-env.j2 +compose_file_name: "{{ service_analytics_service }}.yml" +env_file_name: "{{ service_analytics_service }}.env" +compose_file_deployment_location: "{{ compose_files_dir }}/{{ compose_file_name }}" +env_file_deployment_location: "{{ env_files_dir }}/{{ env_file_name }}" +analytics_friendly_name: analytics service + + +# For service +application_port: "{{ service_analytics_port }}" +image_name: "{{ image_analytics_service }}" +tag: "{{ tags_analytics_service }}" +host_port: "{{ application_port }}" +docker_port: "{{ application_port }}" +replicas: "{{ service_replicas_analytics_service }}" +reserved_memory: "{{ service_mem_reserved_analytics_service }}" +limited_memory: "{{ service_mem_limit_analytics_service }}" +health_check_endpoint: http://127.0.0.1:{{ docker_port }}/v1/course/new +network_alias_name: "{{ network_alias_analytics_service }}" +docker_service_stack_name: smf +docker_service_name: "{{ service_analytics_service }}" +force_reload: "{{ force_reload_analytics_service }}" +#host_logs_location: "{{ analytics_logs_path }}" +docker_logs_location: /logs + +spring_datasource_jdbc_url: jdbc:postgresql://{{ postgresql_host }}:{{ postgresql_port }}/{{ postgresql_analytics_profile_database }} + +# For application +spring_data_mongodb_uri: mongodb://{{ mongodb_analytics }}:{{ mongodb_password | urlencode }}@{{ mongodb_host }}:{{ mongodb_port }}/{{ mongodb_authentication_database }} +enable_new_assessments: 1 +bodhi_ui_index: lexcontentindex +bodhi_content_port: "{{ service_content_service_port }}" +iap_certification_url: https://{{ var_common_iap_base }}/backend/Profile/CertificationResult +com_infosys_root_org: "{{ var_common_root_org }}" +com_infosys_org: "{{ var_common_org }}" +com_infosys_neo4j_ip: http://10.177.157.22:7474/graphaware/ +com_infosys_enable_access_control: "{{ var_analytics_service_enable_access_control }}" +app_name: "Lex" +infosys_lex_core_ip: http://{{ network_alias_lex_core_service }}:{{ service_lex_core_port }} diff --git a/ansible_workspace_dir/roles/deploy-form-service/templates/form-service-env.j2 b/ansible_workspace_dir/roles/deploy-form-service/templates/form-service-env.j2 index 2edd424557007d191cec7eea6fcc4cce841e66f2..1756a49bd9681799bb8ee3f3166000e4314c7302 100755 --- a/ansible_workspace_dir/roles/deploy-form-service/templates/form-service-env.j2 +++ b/ansible_workspace_dir/roles/deploy-form-service/templates/form-service-env.j2 @@ -22,6 +22,10 @@ es.fs.interactions.index.name=fs-interactions es.forms.fail.records.index.name=form-failure-records es.forms.fail.records.index.type=formfailurerecords +es.fs.state.index.name=fs-forms-state +es.fs.statematrix.index.name=fs-forms-state-matrix +es.fs.workflowlog.index.name=fs-forms-workflow-log + file.config.path=/ file.config.name=FormConfig.yml @@ -56,3 +60,4 @@ azure_storage_key={{ storage_key }} azure_storage_secret={{ storage_secret }} azure_storage_container={{ container_name }} +user.routes.host.url=http://{{ service_user_service }}:{{ service_user_port }} diff --git a/ansible_workspace_dir/roles/deploy-gateway-service/templates/gateway-service-env.j2 b/ansible_workspace_dir/roles/deploy-gateway-service/templates/gateway-service-env.j2 index 0a4163e79991acd86157e4852da12ebc1b61cbce..666e2bc039bdf66b229e9256eaa327c67c55e7f2 100755 --- a/ansible_workspace_dir/roles/deploy-gateway-service/templates/gateway-service-env.j2 +++ b/ansible_workspace_dir/roles/deploy-gateway-service/templates/gateway-service-env.j2 @@ -16,7 +16,7 @@ zuul.routes.ingest.url=http://localhost:8097/ zuul.routes.analytics.path=/dashboard/** zuul.routes.analytics.stripPrefix=false -zuul.routes.analytics.url=http://localhost:8091/ +zuul.routes.analytics.url=http://{{ service_analytics_service }}:{{ service_analytics_port }}/ zuul.routes.form.path=/forms/** zuul.routes.form.stripPrefix=false @@ -30,7 +30,9 @@ retail.user-info-header=x-user-info #retail.open-endpoints-whitelist=/login,/forms/saveFormSubmit,/forms/getFormById,/forms/uploadData,/forms/getApplicationsById,/forms/getAllApplications,/forms/v1/saveFormSubmit,/user/requestOTP,/signIn -retail.open-endpoints-whitelist=/login,/forms/saveFormSubmit,/forms/getFormById,/forms/uploadData,/user/requestOTP,/signIn + +retail.open-endpoints-whitelist=/login,/forms/saveFormSubmit,/forms/getFormById,/forms/uploadData,/user/requestOTP,/signIn,/user/generatePin,/forms/getAllFormStatus,/forms/v1/savePlainForm,/forms/getAllPlainForms,/forms/getPlainFormById + retail.mixed-mode-endpoints-whitelist= spring.http.multipart.max-file-size=100MB spring.http.multipart.max-request-size=100MB diff --git a/ansible_workspace_dir/vars/main.yml b/ansible_workspace_dir/vars/main.yml index d6bc0d9b9eec2d843c4337e27718ac1b1ad6e8d1..9e69ee1c572ed4d75f0c9d40fa58bced6c0635c0 100644 --- a/ansible_workspace_dir/vars/main.yml +++ b/ansible_workspace_dir/vars/main.yml @@ -4,22 +4,25 @@ service_form_service: form-service service_gateway_service: gateway-service service_user_service: user-service service_web_service: web-service - +service_analytics_service: analytics-service service_form_port: 8099 service_gateway_port: 8080 service_user_port: 8081 service_web_port: 3000 +service_analytics_port: 8089 network_alias_form_service: form-service network_alias_gateway_service: gateway-service network_alias_user_service: user-service network_alias_web_service: web-service +network_alias_analytics_service: analytics-service image_form_service: smf-form-service image_gateway_service: smf-gateway-service image_user_service: smf-user-service image_web_service: smf-web-service +image_analytics_service: smf-analytics-service proxy_site_key: "{{ core_vault_proxy_site_key }}" proxy_site_crt: "{{ core_vault_proxy_site_crt }}"