Created
March 28, 2018 12:43
-
-
Save Karm/f220076e435124f60256f29ceca9826f to your computer and use it in GitHub Desktop.
Start PostgreSQL and Tomcat for Narayana test
This file contains 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 | |
wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.4/bin/apache-tomcat-9.0.4.zip | |
unzip apache-tomcat-9.0.4.zip | |
export CATALINA_HOME=`pwd`/apache-tomcat-9.0.4/ | |
cat <<EOT >> ${CATALINA_HOME}/conf/logging.properties | |
org.apache.tomcat.tomcat-jdbc.level = ALL | |
org.h2.level = ALL | |
org.postgresql.level = ALL | |
javax.sql.level = ALL | |
org.apache.tomcat.tomcat-dbcp.level = ALL | |
com.arjuna.level = ALL | |
EOT | |
sed -i 's/<\/tomcat-users>/<user username="arquillian" password="arquillian" roles="manager-script"\/>\n<\/tomcat-users>/' ${CATALINA_HOME}/conf/tomcat-users.xml | |
cp test.war ${CATALINA_HOME}/webapps/ | |
docker -H=tcp://127.0.0.1:2375 run \ | |
-e POSTGRES_PASSWORD=narayana_pass \ | |
-e POSTGRES_USER=narayana_user \ | |
-e POSTGRES_DB=narayana_db \ | |
-p 127.0.0.1:5432:5432/tcp \ | |
-d \ | |
-i \ | |
--name narayana_db \ | |
postgres:10 \ | |
postgres \ | |
-c deadlock_timeout=1s \ | |
-c default_transaction_deferrable=off \ | |
-c default_transaction_isolation="read committed" \ | |
-c default_transaction_read_only=off \ | |
-c log_directory=/tmp \ | |
-c log_filename=db.log \ | |
-c log_line_prefix="%m transaction_id:%x" \ | |
-c log_statement=all \ | |
-c logging_collector=on \ | |
-c max_connections=20 \ | |
-c max_locks_per_transaction=64 \ | |
-c max_pred_locks_per_transaction=64 \ | |
-c max_prepared_transactions=50 | |
wget http://downloads.jboss.org/byteman/3.0.11/byteman-download-3.0.11-bin.zip | |
unzip byteman-download-3.0.11-bin.zip | |
export BYTEMAN_HOME=`pwd`/byteman-download-3.0.11/ | |
wget https://raw.githubusercontent.com/Karm/narayana/narayana-tomcat-ts/tomcat/tomcat-jta/src/test/resources/scripts.btm | |
export BTM_SCRIPT=`pwd`/scripts.btm | |
java -javaagent:$BYTEMAN_HOME/lib/byteman.jar=script:$BTM_SCRIPT \ | |
-Djava.security.egd=file:/dev/./urandom \ | |
-Djava.util.logging.config.file=$CATALINA_HOME/conf/logging.properties \ | |
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \ | |
-Djdk.tls.ephemeralDHKeySize=2048 \ | |
-Djava.protocol.handler.pkgs=org.apache.catalina.webresources \ | |
-Dignore.endorsed.dirs= \ | |
-classpath $CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/tomcat-juli.jar \ | |
-Dcatalina.base=$CATALINA_HOME \ | |
-Dcatalina.home=$CATALINA_HOME \ | |
-Djava.io.tmpdir=$CATALINA_HOME/temp org.apache.catalina.startup.Bootstrap start | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment