DevOps Classroom Series – 07/Sept/2020

tomcat installation contd

  • Created a template ‘tomcat.service.erb’
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target

[Service]
Type=forking

Environment=JAVA_HOME=<%= node['tomcat9']['JAVA_HOME']  %>
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target
  • Added a new attribute to attributes file
if platform?('ubuntu')
  default['tomcat9']['java'] = 'openjdk-11-jdk'
  default['tomcat9']['JAVA_HOME']= '/usr/lib/jvm/java-1.11.0-openjdk-amd64'
 
elsif platform?('centos')
  default['tomcat9']['java']= 'java-11-openjdk-devel'
  default['tomcat9']['JAVA_HOME']= '/usr/lib/jvm/java-11-openjdk-11.0.8.10-0.el7_8.x86_64'
end

default['tomcat9']['service_file_location'] = '/etc/systemd/system/tomcat.service'
default['tomcat9']['group'] = 'tomcat'
default['tomcat9']['user'] = 'tomcat'
default['tomcat9']['downloadurl'] = 'http://apachemirror.wuchna.com/tomcat/tomcat-9/v9.0.37/bin/apache-tomcat-9.0.37.tar.gz'
default['tomcat9']['downloadlocation'] = '/tmp/tomcat9.tar.gz'
default['tomcat9']['tomcat_location'] = '/opt/tomcat'
default['tomcat9']['permission_directories'] = ['/opt/tomcat', '/opt/tomcat/conf', '/opt/tomcat/webapps/', '/opt/tomcat/work', '/opt/tomcat/temp/', '/opt/tomcat/logs/']
default['tomcat9']['tomcat-users-location'] = '/opt/tomcat/conf/tomcat-users.xml'
default['tomcat9']['manager-context'] = '/opt/tomcat/webapps/manager/META-INF/context.xml'
default['tomcat9']['hostmanager-context'] = '/opt/tomcat/webapps/manager/META-INF/context.xml'

default['tomcat9']['sampleappurl'] = 'https://referenceappkhaja.s3-us-west-2.amazonaws.com/gameoflife.war'
default['tomcat9']['sampleapplocation'] = '/opt/tomcat/webapps/gameoflife.war'
default['tomcat9']['adminuser'] = 'admin'
default['tomcat9']['adminpassword'] = 'password'
default['tomcat9']['adminroles'] = 'manager-gui,admin-gui'

  • Now verify this cookbook

  • Refer here for tomcat cookbook

  • Exercise-1:

    • Install mongo db on centos7 using the documentation over here
    • Use community edition
  • Next Steps:

    • Understanding Super Market
    • Understanding Custom Resources
    • Attributes, Roles and Environments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube