-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudentdata_3tier.txt
95 lines (95 loc) · 4.08 KB
/
studentdata_3tier.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
--------------------------------------------------------------------------------------------------------------------------
**********************Install & Configure Web Server to connect to Application*******************centos
---------------------------------------------------------------------------------------------------------------------------
bash "install_configure_web_server" do
code <<-EOH
sudo -i
yum install update
yum install httpd httpd-devel -y
service httpd enable
service httpd start
cd /root
wget http://mirrors.fibergrid.in/apache/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.46-src.tar.gz
tar xf tomcat-connectors-1.2.46-src.tar.gz
cd tomcat-connectors-1.2.46-src/native
yum install gcc -y
abc=`find / -name apxs`
./configure --with-apxs=$abc
make
make install
cd /etc/httpd/conf.d
echo "LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf.d/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /student tomcatA
JkMount /student/* tomcatA" > modjk.conf
echo "### Define workers
worker.list=tomcatA
### Set properties
worker.tomcatA.type=ajp13
worker.tomcatA.host=10.128.0.5 ## change the host
worker.tomcatA.port=8009" > workers.properties
service httpd restart
EOH
end
--------------------------------------------------------------------------------------------------------------------------------
*********Install Tomcat from Binary Disribution, Download required war and jar files**************************** ubuntu 16.04
--------------------------------------------------------------------------------------------------------------------------------
bash "install tomcat" do
code <<-EOH
sudo -i
apt-get install update
cd /root
sudo add-apt-repository ppa:webupd8team/java
sudo dpkg --configure -a
sudo apt update; sudo apt install oracle-java8-installer
javac -version
wget http://mirrors.estointernet.in/apache/tomcat/tomcat-9/v9.0.12/bin/apache-tomcat-9.0.12.tar.gz
tar -zxvf apache-tomcat-9.0.12.tar.gz
mv apache-tomcat-9.0.12 tomcat
cd tomcat
cd webapps/
rm -rf *
wget https://github.com/devops2k18/DevOpsDecember/raw/master/APPSTACK/student.war
cd ../lib
wget https://github.com/devops2k18/DevOpsDecember/raw/master/APPSTACK/mysql-connector-java-5.1.40.jar
cd ../bin
sh startup.sh
echo "<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000"
username="student" password="student@1" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://10.128.0.6:3306/studentapp"/>" > /root/tomcat/conf/context.xml ##change the host
/root/tomcat/bin/shutdown.sh
/root/tomcat/bin/startup.sh
EOH
end
--------------------------------------------------------------------------------------------------------------------------------
***********************************MariaDB Server Setup******************************************linux
------------------------------------------------------------------------------------------------------------------------------
execute "MariaDB setup" do
code <<-EOH
sudo -i
yum install update
yum install mariadb mariadb-server -y
systemctl enable mariadb
systemctl start mariadb
echo "create database studentapp;
use studentapp;
CREATE TABLE Students(student_id INT NOT NULL AUTO_INCREMENT,
student_name VARCHAR(100) NOT NULL,
student_addr VARCHAR(100) NOT NULL,
student_age VARCHAR(3) NOT NULL,
student_qual VARCHAR(20) NOT NULL,
student_percent VARCHAR(10) NOT NULL,
student_year_passed VARCHAR(10) NOT NULL,
PRIMARY KEY (student_id)
);
grant all privileges on studentapp.* to 'student'@'10.128.0.5' identified by 'student@1';" > studentapp.sql
mysql <studentapp.sql
EOH
end
--------------------------------------------------------------------------------------------------------------------------------