Tomcat 9 with open JDK 8 using Chef
- Manual Steps are
1. sudo apt update
2. sudo apt-cache search openjdk
3. sudo apt install openjdk-8-jdk -y
4. java -version
5. sudo groupadd tomcat
6. sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
7. cd /tmp/
8. wget https://mirrors.estointernet.in/apache/tomcat/tomcat-9/v9.0.46/bin/apache-tomcat-9.0.46.tar.gz
9. sudo mkdir /opt/tomcat
10. sudo tar xzvf apache-tomcat-*tar.gz -C /opt/tomcat --strip-components=1
11. cd /opt/tomcat
12. sudo chgrp -R tomcat /opt/tomcat
13. sudo chmod -R g+r conf
14. sudo chmod g+x conf
15. sudo chown -R tomcat webapps/ work/ temp/ logs/
16. sudo nano /etc/systemd/system/tomcat.service
17. sudo systemctl daemon-reload
18. sudo systemctl start tomcat
19. sudo systemctl status tomcat
-
In chef we can make a resource execute as an event
- notifies
- subscribes
-
Refer Here for the changes made in the cookbook to make it work for both ubuntu and redhat flavours to install tomcat 9 with jdk 8
-
Refer Here to view the changes to deploy a war file to tomcat server.
Exercises
- Deploy an asp.net core application on ubuntu Linux using chef
- Deploy a spring boot application to ubuntu Linux using chef
- Approach:
- Execute the manual steps
- Ensure manual steps are working
- Start writing the cookbook step by step and checking with test kitchen at every step.
