From a8e2a86c9d889df38e64a4b50dc30f19b933f091 Mon Sep 17 00:00:00 2001 From: Florian Heigl Date: Wed, 9 Sep 2015 15:27:35 +0200 Subject: [PATCH 1/6] fix incorrect wrapper path --- ansible/templates/ec2ExistRclocal.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/templates/ec2ExistRclocal.template b/ansible/templates/ec2ExistRclocal.template index ad29854..c18bd1d 100644 --- a/ansible/templates/ec2ExistRclocal.template +++ b/ansible/templates/ec2ExistRclocal.template @@ -9,5 +9,5 @@ EXIST_HOME={{ existLn }} echo 'Starting the eXist native XML database from within /etc/rc.d/rc.local ...' grep 'jetty.port' $EXIST_HOME/tools/jetty/etc/jetty.xml echo 'Stating with the following max memory (MB)' -grep 'wrapper.java.maxmemory' $EXIST_HOME/tools/wrapper/wrapper.conf -/etc/init.d/exist start \ No newline at end of file +grep 'wrapper.java.maxmemory' $EXIST_HOME/tools/wrapper/conf/wrapper.conf +/etc/init.d/exist start From 1801049f409d9e023d9e781a67b986dd090710a4 Mon Sep 17 00:00:00 2001 From: Florian Heigl Date: Wed, 9 Sep 2015 15:29:51 +0200 Subject: [PATCH 2/6] Update ec2ExistRclocal.template --- ansible/templates/ec2ExistRclocal.template | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ansible/templates/ec2ExistRclocal.template b/ansible/templates/ec2ExistRclocal.template index c18bd1d..4addbb8 100644 --- a/ansible/templates/ec2ExistRclocal.template +++ b/ansible/templates/ec2ExistRclocal.template @@ -10,4 +10,10 @@ echo 'Starting the eXist native XML database from within /etc/rc.d/rc.local ...' grep 'jetty.port' $EXIST_HOME/tools/jetty/etc/jetty.xml echo 'Stating with the following max memory (MB)' grep 'wrapper.java.maxmemory' $EXIST_HOME/tools/wrapper/conf/wrapper.conf -/etc/init.d/exist start +# start as service user +su svcexist -c /etc/init.d/exist start + +# add nat rule to forward 8080 to 80. 8080 also accessible with this config. +iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT +iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT +iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 From 1726e2edfeb0b3eed63b2003c46be9b46e0692b6 Mon Sep 17 00:00:00 2001 From: Florian Heigl Date: Wed, 9 Sep 2015 15:34:48 +0200 Subject: [PATCH 3/6] Update installExist.yml blah i hate github --- ansible/playbooks/installExist.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ansible/playbooks/installExist.yml b/ansible/playbooks/installExist.yml index 0f6e2de..7e0cde0 100644 --- a/ansible/playbooks/installExist.yml +++ b/ansible/playbooks/installExist.yml @@ -14,7 +14,6 @@ # add inet.d startup # change sudoer file # sudoer changes -# change port to 80 or make firewall change # memory settings # WHAT ELSE? # @@ -25,7 +24,7 @@ existLn: /usr/local/existlatest existShLn: /usr/local/exist #java_home: /usr/lib/jvm/java - existJettyPort: 80 + existJettyPort: 8080 jettyConfFile: /usr/local/existlatest/tools/jetty/etc/jetty.xml wrapperConfFile: /usr/local/existlatest/tools/wrapper/conf/wrapper.conf # MBytes @@ -49,6 +48,9 @@ - name: test debug: msg="test is successful" when_string: ${buildSuccess.stdout} != 'BUILD SUCCESSFUL' + + - name: add user svcexist + user: name=svcexist - name: install java-1.7.0-openjdk latest version action: yum pkg=java-1.7.0-openjdk state=latest @@ -68,6 +70,12 @@ action: command svn checkout ${existSvnUrl} ${existDir} when_string: ${buildSuccess.stdout} != 'BUILD SUCCESSFUL' + - name: add missing directories + file: dest={{ item }} state=directory + with_items: + - {{ existDir }}/lib/extensions + - {{ existDir }}/extensions/modules/lib + - name: build existdb with javac in this location ${existDir} action: script ../../bash/buildExistdb.sh ${existDir} when_string: ${buildSuccess.stdout} != 'BUILD SUCCESSFUL' @@ -121,4 +129,4 @@ - name: set the jetty wrapper port for http to ${existJettyPort} action: lineinfile backup="yes" dest="${jettyConfFile}" state=present line='' regexp=' Date: Wed, 9 Sep 2015 15:38:05 +0200 Subject: [PATCH 4/6] switch to git as used by exist now --- ansible/playbooks/installExist.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ansible/playbooks/installExist.yml b/ansible/playbooks/installExist.yml index 7e0cde0..3d1591d 100644 --- a/ansible/playbooks/installExist.yml +++ b/ansible/playbooks/installExist.yml @@ -19,7 +19,7 @@ # - hosts: naked-existdb vars: - existSvnUrl: svn://svn.code.sf.net/p/exist/code/stable/eXist-2.0.x + existgitUrl: https://github.com/eXist-db/exist.git existDir: /usr/local/exist2.0.x existLn: /usr/local/existlatest existShLn: /usr/local/exist @@ -62,13 +62,14 @@ action: yum pkg=ant state=latest when_string: ${buildSuccess.stdout} != 'BUILD SUCCESSFUL' - - name: install svn - action: yum pkg=svn state=present + - name: install git + action: yum pkg=git state=present when_string: ${buildSuccess.stdout} != 'BUILD SUCCESSFUL' - - name: checkout exist-db from svn at ${existSvnUrl} - action: command svn checkout ${existSvnUrl} ${existDir} - when_string: ${buildSuccess.stdout} != 'BUILD SUCCESSFUL' + - git: repo={{ existgitUrl }} + dest={{ existDir }} + version=eXist-2.0.x + when: buildSuccess.stdout != 'BUILD SUCCESSFUL' - name: add missing directories file: dest={{ item }} state=directory From ac1c8f1d75143c1d0be21f886d4017974fd1a96c Mon Sep 17 00:00:00 2001 From: Florian Heigl Date: Wed, 9 Sep 2015 15:45:30 +0200 Subject: [PATCH 5/6] cleanup 1 --- ansible/playbooks/installExist.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ansible/playbooks/installExist.yml b/ansible/playbooks/installExist.yml index 3d1591d..9cf4685 100644 --- a/ansible/playbooks/installExist.yml +++ b/ansible/playbooks/installExist.yml @@ -36,7 +36,7 @@ tasks: - name: find out of build of exist has already been successful - action: shell cat ${existDir}/buildExist.log | grep "BUILD SUCCESSFUL" + action: shell grep "BUILD SUCCESSFUL" ${existDir}/buildExist.log ignore_errors: True register: buildSuccess @@ -47,7 +47,7 @@ # this works leave this here till be make use this code elsewhere - name: test debug: msg="test is successful" - when_string: ${buildSuccess.stdout} != 'BUILD SUCCESSFUL' + when: buildSuccess.stdout != 'BUILD SUCCESSFUL' - name: add user svcexist user: name=svcexist @@ -60,11 +60,11 @@ - name: install ant lastest version action: yum pkg=ant state=latest - when_string: ${buildSuccess.stdout} != 'BUILD SUCCESSFUL' + when: buildSuccess.stdout != 'BUILD SUCCESSFUL' - name: install git action: yum pkg=git state=present - when_string: ${buildSuccess.stdout} != 'BUILD SUCCESSFUL' + when: buildSuccess.stdout != 'BUILD SUCCESSFUL' - git: repo={{ existgitUrl }} dest={{ existDir }} @@ -79,7 +79,7 @@ - name: build existdb with javac in this location ${existDir} action: script ../../bash/buildExistdb.sh ${existDir} - when_string: ${buildSuccess.stdout} != 'BUILD SUCCESSFUL' + when: buildSuccess.stdout != 'BUILD SUCCESSFUL' # wonky alert - these debug messages let the ln -s get created - name: debug 1 From b43849b8ecf8d0a462489b10b43b457155006aca Mon Sep 17 00:00:00 2001 From: Florian Heigl Date: Wed, 9 Sep 2015 15:50:07 +0200 Subject: [PATCH 6/6] Update installExist.yml --- ansible/playbooks/installExist.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ansible/playbooks/installExist.yml b/ansible/playbooks/installExist.yml index 9cf4685..c565d52 100644 --- a/ansible/playbooks/installExist.yml +++ b/ansible/playbooks/installExist.yml @@ -53,17 +53,17 @@ user: name=svcexist - name: install java-1.7.0-openjdk latest version - action: yum pkg=java-1.7.0-openjdk state=latest + yum: pkg=java-1.7.0-openjdk state=latest - name: set alternatives up for java 1.7 openJdk - action: script ../../bash/javaAlternatives.sh + script: ../../bash/javaAlternatives.sh - name: install ant lastest version - action: yum pkg=ant state=latest + yum: pkg=ant state=latest when: buildSuccess.stdout != 'BUILD SUCCESSFUL' - name: install git - action: yum pkg=git state=present + yum: pkg=git state=present when: buildSuccess.stdout != 'BUILD SUCCESSFUL' - git: repo={{ existgitUrl }} @@ -86,19 +86,19 @@ action: debug msg="1" - name: create a symbolic link for $EXIST_HOME as ${existLn} - action: file src="${existDir}" dest="${existLn}" state=link + file: src="${existDir}" dest="${existLn}" state=link ignore_errors: True - name: create a link to the exist.sh file - action: file src="${existDir}/tools/wrapper/bin/exist.sh" dest="${existShLn}" state=link + file: src="${existDir}/tools/wrapper/bin/exist.sh" dest="${existShLn}" state=link ignore_errors: True - name: create a symbolic link to the exist.sh script for other uses - action: file src="${existLn}/tools/wrapper/bin/exist.sh" dest="/usr/local/bin/exist" state=link + file: src="${existLn}/tools/wrapper/bin/exist.sh" dest="/usr/local/bin/exist" state=link ignore_errors: True - name: create a symbolic link to the exist.sh script for init.d - action: file src="${existLn}/tools/wrapper/bin/exist.sh" dest="/etc/init.d/exist" state=link + file: src="${existLn}/tools/wrapper/bin/exist.sh" dest="/etc/init.d/exist" state=link ignore_errors: True # wonky alert - these debug messages let the ln -s get created @@ -106,28 +106,28 @@ action: debug msg="2" name: get the value of $JAVA_HOME for use later - action: shell source /etc/profile; echo $JAVA_HOME + shell: source /etc/profile; echo $JAVA_HOME register: actualJavaHome - name: echo JAVA_HOME for debugging purposes action: debug msg=${actualJavaHome.stdout} - name: add EXIST_HOME to /etc/profile - action: lineinfile backup="yes" dest="/etc/profile" insertafter="EOF" state=present line="source /home/ec2-user/ec2ExistEnv.sh" regexp="^source /home/ec2-user/ec2ExistEnv\.sh$" + lineinfile: backup="yes" dest="/etc/profile" insertafter="EOF" state=present line="source /home/ec2-user/ec2ExistEnv.sh" regexp="^source /home/ec2-user/ec2ExistEnv\.sh$" - name: add templated ec2ExistEnv.sh to ec2-user home - action: template src=../templates/ec2ExistEnv.template dest=/home/ec2-user/ec2ExistEnv.sh mode=0555 + template: src=../templates/ec2ExistEnv.template dest=/home/ec2-user/ec2ExistEnv.sh mode=0555 - name: source /etc/profile so some env values get created - action: shell source /etc/profile + shell: source /etc/profile ignore_errors: True - name: create a /etc/rc.d/rc.local file with -rwxr-xr-x file permissions (this file starts exist on reboot) - action: template backup=yes src=../templates/ec2ExistRclocal.template dest=/etc/rc.d/rc.local mode=0755 + template" backup=yes src=../templates/ec2ExistRclocal.template dest=/etc/rc.d/rc.local mode=0755 - name: set the wrapper max memory to ${existWrapperMaxMem} MB - action: lineinfile backup="yes" dest="${wrapperConfFile}" state=present line="wrapper.java.maxmemory=${existWrapperMaxMem}" regexp="^wrapper.java.maxmemory=\d+" + lineinfile: backup="yes" dest="${wrapperConfFile}" state=present line="wrapper.java.maxmemory=${existWrapperMaxMem}" regexp="^wrapper.java.maxmemory=\d+" - name: set the jetty wrapper port for http to ${existJettyPort} - action: lineinfile backup="yes" dest="${jettyConfFile}" state=present line='' regexp='