Skip to content
Snippets Groups Projects
Commit 30447f81 authored by Eike Cochu's avatar Eike Cochu
Browse files

added tomcat to vm

parent 66015ccd
No related branches found
No related tags found
No related merge requests found
.vagrant/ .vagrant/
vm/webapps/
\ No newline at end of file
...@@ -15,6 +15,7 @@ Vagrant.configure(2) do |config| ...@@ -15,6 +15,7 @@ Vagrant.configure(2) do |config|
master.vm.network :forwarded_port, guest: 8001, host: 8001 # Spark MasterUI master.vm.network :forwarded_port, guest: 8001, host: 8001 # Spark MasterUI
master.vm.network :forwarded_port, guest: 8002, host: 8002 # Spark WorkerUI master.vm.network :forwarded_port, guest: 8002, host: 8002 # Spark WorkerUI
master.vm.network :forwarded_port, guest: 7077, host: 7077 # Spark master.vm.network :forwarded_port, guest: 7077, host: 7077 # Spark
master.vm.network :forwarded_port, guest: 8080, host: 8000 # Tomcat
master.vm.network :forwarded_port, guest: 9200, host: 9200 # ElasticSearch REST API master.vm.network :forwarded_port, guest: 9200, host: 9200 # ElasticSearch REST API
master.vm.provision :shell, path: 'vm/bootstrap.sh' master.vm.provision :shell, path: 'vm/bootstrap.sh'
end end
......
tmbs-frontend @ 9030211f
Subproject commit 9030211fb41c825b175a45d77131b669f2acc963
#!/bin/sh #!/bin/sh
VMDIR=/vagrant/vm
DATA=$VMDIR/data
CONFIG=$VMDIR/config
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# add repos # add repos
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
...@@ -26,17 +30,17 @@ wget http://mirror.netcologne.de/apache.org/spark/spark-1.5.2/spark-1.5.2-bin-ha ...@@ -26,17 +30,17 @@ wget http://mirror.netcologne.de/apache.org/spark/spark-1.5.2/spark-1.5.2-bin-ha
tar zxf spark-1.5.2-bin-hadoop2.6.tgz tar zxf spark-1.5.2-bin-hadoop2.6.tgz
rm spark-1.5.2-bin-hadoop2.6.tgz rm spark-1.5.2-bin-hadoop2.6.tgz
mv spark-1.5.2-bin-hadoop2.6 spark mv spark-1.5.2-bin-hadoop2.6 spark
ln -sf /vagrant/vm/config/spark-env.sh /home/vagrant/spark/conf/spark-env.sh ln -sf $CONFIG/spark-env.sh /home/vagrant/spark/conf/spark-env.sh
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# install mongodb # install mongodb
apt-get install -y mongodb-org apt-get install -y mongodb-org
# copy configuration # copy configuration
ln -sf /vagrant/vm/config/master-mongod.conf /etc/mongod.conf ln -sf $CONFIG/master-mongod.conf /etc/mongod.conf
# disable hugepages (https://docs.mongodb.org/manual/tutorial/transparent-huge-pages/) # disable hugepages (https://docs.mongodb.org/manual/tutorial/transparent-huge-pages/)
cp /vagrant/vm/config/disable-transparent-hugepages /etc/init.d/ cp $CONFIG/disable-transparent-hugepages /etc/init.d/
chmod 755 /etc/init.d/disable-transparent-hugepages chmod 755 /etc/init.d/disable-transparent-hugepages
update-rc.d disable-transparent-hugepages defaults update-rc.d disable-transparent-hugepages defaults
echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled
...@@ -46,14 +50,37 @@ echo 'never' > /sys/kernel/mm/transparent_hugepage/defrag ...@@ -46,14 +50,37 @@ echo 'never' > /sys/kernel/mm/transparent_hugepage/defrag
service mongod restart service mongod restart
# import mongodb data # import mongodb data
mongoimport --db test --collection articles --file /vagrant/vm/data/data.json --jsonArray mongoimport --db test --collection articles --file $DATA/data.json --jsonArray
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# install mongo express # install mongo express
apt-get install npm libkrb5-dev apt-get install npm libkrb5-dev
ln -sf $(which nodejs) /bin/node ln -sf $(which nodejs) /bin/node
npm install -g mongo-express forever npm install -g mongo-express forever
ln -sf /vagrant/vm/config/mongo-express.config.js /usr/local/lib/node_modules/mongo-express/config.js ln -sf $CONFIG/mongo-express.config.js /usr/local/lib/node_modules/mongo-express/config.js
# -----------------------------------------------------------------------------
# install tomcat
wget http://mirror.netcologne.de/apache.org/tomcat/tomcat-8/v8.0.30/bin/apache-tomcat-8.0.30.tar.gz
tar zxf apache-tomcat-8.0.30.tar.gz
mv apache-tomcat-8.0.30 /usr/share/tomcat8
ln -s /usr/share/tomcat /usr/share/tomcat8
# setup server config
rm /usr/share/tomcat/conf/server.xml /usr/share/tomcat/conf/tomcat-users.xml
ln -s $CONFIG/tomcat-server.xml /usr/share/tomcat/conf/server.xml
ln -s $CONFIG/tomcat-users.xml /usr/share/tomcat/conf/tomcat-users.xml
# set permissions
chown -R vagrant:vagrant /usr/share/tomcat8
chmod +x /usr/share/tomcat/bin/*.sh
# setup startup script
cp $CONFIG/initd-tomcat /etc/init.d/tomcat
chmod 755 /etc/init.d/tomcat
update-rc.d tomcat defaults
# move webapps dir
mv /usr/share/tomcat/webapps $VMDIR/webapps
ln -s $VMDIR/webapps /usr/share/tomcat/webapps
# start tomcat
service tomcat start
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# install maven # install maven
...@@ -62,20 +89,19 @@ tar zxf apache-maven-3.3.9-bin.tar.gz ...@@ -62,20 +89,19 @@ tar zxf apache-maven-3.3.9-bin.tar.gz
mv apache-maven-3.3.9-bin maven mv apache-maven-3.3.9-bin maven
rm apache-maven-3.3.9-bin.tar.gz rm apache-maven-3.3.9-bin.tar.gz
# -----------------------------------------------------------------------------
# set environment
cat /vagrant/vm/config/environment >> /etc/environment
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# install mahout # install mahout
git clone https://github.com/apache/mahout.git mahout git clone https://github.com/apache/mahout.git mahout
cd mahout mvn -DskipTests -X clean -f ./mahout install
mvn -DskipTests -X clean install
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# disable firewall # disable firewall
ufw disable ufw disable
# -----------------------------------------------------------------------------
# set environment
cat $CONFIG/environment >> /etc/environment
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# cleanup # cleanup
apt-get autoremove -y apt-get autoremove -y
......
# Java # Java
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
JAVA_TOOL_OPTIONS="-Xmx2048m -XX:MaxPermSize=1024m -Xms1024m" JAVA_TOOL_OPTIONS="-Xmx2048m -XX:MaxPermSize=1024m -Xms1024m"
# Spark # Spark
......
#!/bin/bash
### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/Stop Tomcat server
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
start() {
/bin/su - tomcat -c /usr/share/tomcat/bin/startup.sh
}
stop() {
/bin/su - tomcat -c /usr/share/tomcat/bin/shutdown.sh
}
case $1 in
start|stop) $1;;
restart) stop; start;;
*) echo "Run as $0 <start|stop|restart>"; exit 1;;
esac
\ No newline at end of file
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
This connector uses the NIO implementation that requires the JSSE
style configuration. When using the APR/native implementation, the
OpenSSL style configuration is required as described in the APR/native
documentation -->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
</Host>
</Engine>
</Service>
</Server>
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.
-->
<!--
NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.
-->
<!--
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
-->
</tomcat-users>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment