Skip to content

Commit

Permalink
Added templates
Browse files Browse the repository at this point in the history
  • Loading branch information
directdevops committed Jan 27, 2021
1 parent 651b288 commit 836aa10
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Jan21/cookbooks/qttomcatserver/attributes/default.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
default['qttomcatserver']['tomcat_download_url'] = 'https://mirrors.estointernet.in/apache/tomcat/tomcat-9/v9.0.41/bin/apache-tomcat-9.0.41.tar.gz' default['qttomcatserver']['tomcat_download_url'] = 'https://mirrors.estointernet.in/apache/tomcat/tomcat-9/v9.0.41/bin/apache-tomcat-9.0.41.tar.gz'
default['qttomcatserver']['tomcat_download_location'] = "/tmp/apache-tomcat-9.0.41.tar.gz" default['qttomcatserver']['tomcat_download_location'] = "/tmp/apache-tomcat-9.0.41.tar.gz"
default['qttomcatserver']['tomcat_location'] = '/opt/tomcat' default['qttomcatserver']['tomcat_location'] = '/opt/tomcat'
default['qttomcatserver']['java_home'] = '/usr/lib/jvm/java-1.8.0-openjdk-amd64'
default['qttomcatserver']['catalina_opts']='-Xms256M -Xmx512M -server -XX:+UseParallelGC'
13 changes: 13 additions & 0 deletions Jan21/cookbooks/qttomcatserver/recipes/ubuntu_tomcat.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@
subscribes :run, 'execute[untartomcat]', :immediate subscribes :run, 'execute[untartomcat]', :immediate
end end


template '/etc/systemd/system/tomcat.service' do
source 'tomcat.service.erb'
owner user_name
group groupname
mode '0755'
action :create
notifies :restart, 'service[tomcat]', :immediate
end

service 'tomcat' do
action :enable
end







Expand Down
25 changes: 25 additions & 0 deletions Jan21/cookbooks/qttomcatserver/templates/tomcat.service.erb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,25 @@
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target

[Service]
Type=forking

Environment=JAVA_HOME=<%= node['qttomcatserver']['java_home'] %>
Environment=CATALINA_PID=<%= node['qttomcatserver']['homedir'] %>/temp/tomcat.pid
Environment=CATALINA_HOME=<%= node['qttomcatserver']['homedir'] %>
Environment=CATALINA_BASE=<%= node['qttomcatserver']['homedir'] %>
Environment='CATALINA_OPTS= <%= node['qttomcatserver']['catalina_opts'] %>'
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=<%= node['qttomcatserver']['username'] %>
Group=<%= node['qttomcatserver']['groupname'] %>
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

0 comments on commit 836aa10

Please sign in to comment.