Last active
August 29, 2015 14:01
-
-
Save steinwaywhw/6caba7d75266717f3894 to your computer and use it in GitHub Desktop.
Gist for ats-pad deployment provisioning.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files: | |
- /var/log/tomcat7/* | |
- /home/vagrant/server/*log* | |
destination: | |
host: logs.papertrailapp.com | |
port: 20895 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "updating apt-get" | |
apt-get update | |
apt-get upgrade | |
echo "installing utilities" | |
apt-get install -y git curl wget ruby build-essential ruby1.9.1-dev | |
echo "installing remote syslog" | |
gem install remote_syslog | |
curl https://gist.githubusercontent.com/steinwaywhw/6caba7d75266717f3894/raw/6e2d82e7d46e7ead074305307a11e2edd7272ea0/remote_syslog > /etc/init.d/remote_syslog | |
curl https://gist.githubusercontent.com/steinwaywhw/6caba7d75266717f3894/raw/eb67e02a4a5977656fbb4c42fa6ec98e033fa96e/log_files.yml > /etc/log_files.yml | |
chmod 755 /etc/init.d/remote_syslog | |
echo "installing tomcat" | |
apt-get install -y tomcat7 tomcat7-admin | |
mv /var/lib/tomcat7/webapps/ROOT /var/lib/tomcat7/webapps/oldroot | |
echo "installing docker" | |
apt-get install -y docker.io | |
ln -sf /usr/bin/docker.io /usr/bin/docker | |
gpasswd -a vagrant docker | |
gpasswd -a tomcat7 docker | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: remote_syslog | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start and Stop | |
# Description: Runs remote_syslog | |
### END INIT INFO | |
# /etc/init.d/remote_syslog | |
# | |
# Starts the remote_syslog daemon | |
# | |
# chkconfig: 345 90 5 | |
# description: Runs remote_syslog | |
# | |
# processname: remote_syslog | |
prog="remote_syslog" | |
config="/etc/log_files.yml" | |
pid_dir="/var/run" | |
EXTRAOPTIONS="" | |
pid_file="$pid_dir/$prog.pid" | |
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH | |
RETVAL=0 | |
is_running(){ | |
[ -e $pid_file ] | |
} | |
start(){ | |
echo -n $"Starting $prog: " | |
unset HOME MAIL USER USERNAME | |
$prog -c $config --pid-file $pid_file $EXTRAOPTIONS | |
RETVAL=$? | |
echo | |
return $RETVAL | |
} | |
stop(){ | |
echo -n $"Stopping $prog: " | |
if (is_running); then | |
kill `cat $pid_file` | |
RETVAL=$? | |
echo | |
return $RETVAL | |
else | |
echo "$pid_file not found" | |
fi | |
} | |
status(){ | |
echo -n $"Checking for $pid_file: " | |
if (is_running); then | |
echo "found" | |
else | |
echo "not found" | |
fi | |
} | |
reload(){ | |
restart | |
} | |
restart(){ | |
stop | |
start | |
} | |
condrestart(){ | |
is_running && restart | |
return 0 | |
} | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status | |
;; | |
restart) | |
restart | |
;; | |
reload) | |
reload | |
;; | |
condrestart) | |
condrestart | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" | |
RETVAL=1 | |
esac | |
exit $RETVAL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"> | |
<!-- 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" /> | |
--> | |
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> | |
<Listener className="org.apache.catalina.core.JasperListener" /> | |
<!-- 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 HTTP/1.1 Connector on port 8080 | |
--> | |
<Connector port="80" protocol="HTTP/1.1" | |
connectionTimeout="20000" | |
URIEncoding="UTF-8" | |
redirectPort="443" /> | |
<!-- A "Connector" using the shared thread pool--> | |
<!-- | |
<Connector executor="tomcatThreadPool" | |
port="8080" protocol="HTTP/1.1" | |
connectionTimeout="20000" | |
redirectPort="8443" /> | |
--> | |
<!-- Define a SSL HTTP/1.1 Connector on port 8443 | |
This connector uses the JSSE configuration, when using APR, the | |
connector should be using the OpenSSL style configuration | |
described in the APR documentation --> | |
<!-- | |
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" | |
maxThreads="150" 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 "%r" %s %b" /> | |
</Host> | |
</Engine> | |
</Service> | |
</Server> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run Tomcat as this user ID. Not setting this or leaving it blank will use the | |
# default of tomcat7. | |
TOMCAT7_USER=tomcat7 | |
# Run Tomcat as this group ID. Not setting this or leaving it blank will use | |
# the default of tomcat7. | |
TOMCAT7_GROUP=tomcat7 | |
# The home directory of the Java development kit (JDK). You need at least | |
# JDK version 1.5. If JAVA_HOME is not set, some common directories for | |
# OpenJDK, the Sun JDK, and various J2SE 1.5 versions are tried. | |
#JAVA_HOME=/usr/lib/jvm/openjdk-6-jdk | |
# You may pass JVM startup parameters to Java here. If unset, the default | |
# options will be: -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC | |
# | |
# Use "-XX:+UseConcMarkSweepGC" to enable the CMS garbage collector (improved | |
# response time). If you use that option and you run Tomcat on a machine with | |
# exactly one CPU chip that contains one or two cores, you should also add | |
# the "-XX:+CMSIncrementalMode" option. | |
JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC" | |
# To enable remote debugging uncomment the following line. | |
# You will then be able to use a java debugger on port 8000. | |
#JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n" | |
# Java compiler to use for translating JavaServer Pages (JSPs). You can use all | |
# compilers that are accepted by Ant's build.compiler property. | |
#JSP_COMPILER=javac | |
# Use the Java security manager? (yes/no, default: no) | |
#TOMCAT7_SECURITY=no | |
# Number of days to keep logfiles in /var/log/tomcat7. Default is 14 days. | |
#LOGFILE_DAYS=14 | |
# Whether to compress logfiles older than today's | |
#LOGFILE_COMPRESS=1 | |
# Location of the JVM temporary directory | |
# WARNING: This directory will be destroyed and recreated at every startup ! | |
#JVM_TMP=/tmp/tomcat7-temp | |
# If you run Tomcat on port numbers that are all higher than 1023, then you | |
# do not need authbind. It is used for binding Tomcat to lower port numbers. | |
# NOTE: authbind works only with IPv4. Do not enable it when using IPv6. | |
# (yes/no, default: no) | |
AUTHBIND=yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment