Configuration Management
- Need:
- As part of CI/CD we need to create various environments, To create environments we need servers
- Once the servers are available we need to perform technology specific and application specific operations/commands to run the application.
- sample techonology specifics:
#
java application
=> linux server (ubuntu/centos)
=> installing java
=> application server to be configured
(tomcat/jboss/whatever)
=> copy the package into some location
=> restart the app server
=> database server changes if required
.net application
=> windows server
=> configure IIS
=> copy the package built into some folder
python application
=> Linux Server
=> Python
=> install django/flask
=> configure apache/nginx server to run python code
* Application Specific configurations
# some app specific configurations
Create environment variables
create/Delete some folders
Add database urls in some file
- Possibilities:
-
Manual: Not an Option
-
Shell/Powershell Scripting:
- Procedural
- Pros: Stable technology & lot of knowledge around in existing teams
- Cons:
- Not Readable or Consistent among users.
- Has assumptions and it is not guarnteed to give same results upon multiple executions.
- Eg:
# install tomcat # approach find and use commands sudo apt-get update && sudo apt-get install tomcat8 -y sudo systemctl enable tomcat8 sudo yum update && sudo yum install tomcat8 sudo systemctl enable tomcat8 sudo systemctl start tomcat8
-
Configuration Management:
- Declarative
- Simple to Learn
- script should give same results upon multiple executions
- Scripts should be Readable & Maintainable
- Eg:
# approach ensure packages are up to date enusure tomcat8 is installed enable and start tomcat8
-
Terms
- Idempotance: When you run the script n times and are expected to get the same result , then the script is idempotent.