-
Notifications
You must be signed in to change notification settings - Fork 368
Sunbird easy installation
Make the sunbird installation initial setup more easy, reliable and efficient.
Concerns it is going to address
- To reduce the complexity involved in setting up Sunbird in medium scale deployment(6weeks -> 3days -> 1.5hr) .This is achieved by below two key features:
2)Make documentation simple and place in right order.
3)Scaling - Flexible to increase Ram, Replication .
4)Customized documentation for setting any service on VM.
5)SSL certs copying.
6)Backup and restore scripts.
-
It is a single global configuration file (YML) which will be used in the Sunbird Setup Script (SSS). It is passed as an external config to all the ansible-playbook command using
--extra-vars "@some_file.yml"
. All the variables in this config file are more generalized without any duplication. Variables mentioned in<implementation-name>-devops/ansible/inventories/<environment-name>/group_vars/<environment-name>
file will be overridden by the values set in the main configuration file. -
Purpose of doing this way is to reduce the effort of updating the repetitive values of the variables in the group_vars and to maintain idempotency. Explained in detail below with an example.
Example:
- Problem Statement: Currently, on the medium scale deployment for sunbird, all the databases are running on the same machine. Sunbird consumer should update the group_vars file with the private ip of DB's (ex: 10.10.0.1) in many places as listed below.
cassandra_host: 10.10.0.1
elasticsearch_host: 10.10.0.1
postgresql_host: 10.10.0.1
mongodb_host: 10.10.0.1
- Solution: Using Main Config File (MCF) we can overcome the problem. We will create a new variable inside the MCF.
-cassandra_host: 10.10.0.1
-elasticsearch_host: 10.10.0.1
-postgresql_host: 10.10.0.1
-mongodb_host: 10.10.0.1
-proxy_site_key: +|
- -----BEGIN PRIVATE KEY-----
- MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDWOp0w86dZCGpV
- kY3BtoBQXUehV5t0mWsh8RP9FAQV/ei8+YRkkoI9qdIrmW9j41QY2qdzIvuTtKO7
- V0/2I1UT7pVRlfCO1sQnkmfs1Oy/btPhm0Nqcu5mneHCULVvJoLvF1QKc7DXrXP9
- cWS/dSG2bV7zWsxNK2aUkavXjQG3rZJj1tmiPQ1GLkBDEzuqQI06ejONyGs7CLPN
- uqaTPnKMGhiSRb2VPr61ocTIeRWBp7sJ5xjxoMbB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xnKurZiJzirlF7Tga4tZLjzVcv+SL
- HPaUFN6C9+4KjSrDzZCf1/6UJ/2HiAkIoZZNGdJHUKyqPzOQGbt4B+R5331ZzV88
- iedhULT7ub1d1uw=
- -----END CERTIFICATE-----
+db_ip: 10.10.0.1
+proxy_site_key: /home/rajesh/certs/key.pem
+proxy_site_cert: /home/rajesh/certs/site.crt
(for ex: db_ip: 10.10.0.1
) and it will get updated in the group_var file.
Below example describes how the MCF is configured.
Suppose, inside the MCF we assigned a new variable which is db_ip: 10.10.0.1
. And the group_vars file will look like
cassandra_host: "{{db_ip}}"
elasticsearch_host: "{{db_ip}}"
postgresql_host: "{{db_ip}}"
mongodb_host: "{{db_ip}}"
Conclusion: Whenever we run the ansible-playbook command both MCF and group_var file is used. All the variables in MCF are injected into the group_var file.
It is a Master shell script which will internally call and execute many other shell scripts to set up the sunbird. Sunbird consumer will be running only Sunbird Setup Script (SSS) and the deploy-core.sh (not part of SSS) scripts to bring the entire environment up and running. SSS reads the implementation-name
and <env>
from the Main Config File (MCF) and passes as Command Line arguments to the other shell scripts inside the Sunbird Setup Script (SSS). Sample SSS looks like below.
Example
imp=`awk '/implementation_name/{print $NF}'`
env=`awk '/env/{print $NF}'`
implementation=$imp"-devops"
./geneate_config.sh $imp $env
./deploy-apis.sh $implementation/ansible/inventories/$env
Options For SSS:
╰─$ ./sunbird_install.sh -h
Usage: ./sunbird_install.sh [ -s {config|dbs|apis|proxy|keycloak} ]
Once Sunbird Setup Script (SSS) is executed successfully, following items will be installed and configured.
generate_config.sh (Create a configuration folder on app server)
install-depth.sh (Install docker, Ansible, and other prerequisites)
install-dbs.sh (Install Cassandra,elasticsearch and postgress databases)
init-dbs.sh (Initialize databases)
deploy-api.sh (provision api-manger, deploy api-manager, onboard consumers and API's). Make sure JWT
token copied to a seperate file.
deploy_proxy.sh (setup nginx)
provision-keycloak.sh (Install keycloak)
deploy-keycloak-vm.sh (Deploy keycloak jar file )
Keycloak realm import, SSO user creation, and deploy-core.sh are pending manual steps after successful completion of executing the Sunbird Setup Script (SSS).
- Create Main Config File (MCF).
- Update the group_vars and hosts files.
- Create Sunbird Setup Script (SSS).
- Use getopts inside the SSS script to read arguments.
- Ansible installation fixes.
- JWT token copying to the file.
- Logging of each subtask.