Created
September 29, 2010 18:33
-
-
Save tbatchelli/603273 to your computer and use it in GitHub Desktop.
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
user> (use 'pallet.maven) | |
(use 'org.jclouds.compute) | |
(use 'pallet.compute) | |
(require 'webapp-nodes.nodes) | |
(def service (compute-service-from-settings)) | |
#'user/service | |
user> (pallet.core/converge {webapp-nodes.nodes/proxied 2 webapp-nodes.nodes/haproxy 1} :compute service :phase :deploy) | |
==== add-target-keys :haproxy :bootstrap nil | |
==== add-target-keys :proxied :bootstrap nil | |
==== add-target-keys :haproxy :configure us-east-1/i-9d303bf7 | |
==== add-target-keys :proxied :configure us-east-1/i-7d353e17 | |
==== add-target-keys :proxied :configure us-east-1/i-73353e19 | |
==== add-target-keys :proxied :deploy us-east-1/i-7d353e17 | |
==== add-target-keys :proxied :deploy us-east-1/i-73353e19 | |
**** apply-phase :haproxy :pre-configure [us-east-1/i-9d303bf7] | |
==== apply-phase-to-node :haproxy :pre-configure us-east-1/i-9d303bf7 | |
==== add-target-keys :haproxy :pre-configure us-east-1/i-9d303bf7 | |
==== build-commands :haproxy :pre-configure us-east-1/i-9d303bf7 | |
==== execute-with-local-sh :haproxy :pre-configure us-east-1/i-9d303bf7 | |
**** apply-phase :proxied :pre-configure [us-east-1/i-7d353e17 us-east-1/i-73353e19] | |
==== apply-phase-to-node :proxied :pre-configure us-east-1/i-7d353e17 | |
==== add-target-keys :proxied :pre-configure us-east-1/i-7d353e17 | |
==== build-commands :proxied :pre-configure us-east-1/i-7d353e17 | |
==== execute-with-local-sh :proxied :pre-configure us-east-1/i-7d353e17 | |
==== apply-phase-to-node :proxied :pre-configure us-east-1/i-73353e19 | |
==== add-target-keys :proxied :pre-configure us-east-1/i-73353e19 | |
==== build-commands :proxied :pre-configure us-east-1/i-73353e19 | |
==== execute-with-local-sh :proxied :pre-configure us-east-1/i-73353e19 | |
**** apply-phase :haproxy :configure [us-east-1/i-9d303bf7] | |
==== apply-phase-to-node :haproxy :configure us-east-1/i-9d303bf7 | |
==== add-target-keys :haproxy :configure us-east-1/i-9d303bf7 | |
==== build-commands :haproxy :configure us-east-1/i-9d303bf7 | |
==== execute-with-local-sh :haproxy :configure us-east-1/i-9d303bf7 | |
---> SSH exec on us-east-1/i-9d303bf7 : echo "Packages..." | |
{ { debconf-set-selections <<EOF | |
debconf debconf/frontend select noninteractive | |
debconf debconf/frontend seen false | |
EOF | |
} && aptitude install -q -y haproxy && aptitude show haproxy; } || { echo Packages failed ; exit 1 ; } >&2 | |
echo "...done" | |
echo "remote-file /etc/haproxy/haproxy.cfg..." | |
{ { cat > /etc/haproxy/haproxy.cfg.new <<'EOFpallet' | |
global | |
log 127.0.0.1 local0 | |
log 127.0.0.1 local1 notice | |
maxconn 4096 | |
user haproxy | |
group haproxy | |
daemon | |
defaults | |
log global | |
mode http | |
option httplog | |
option dontlognull | |
option redispatch | |
retries 3 | |
maxconn 2000 | |
contimeout 5000 | |
clitimeout 50000 | |
srvtimeout 50000 | |
listen app1 0.0.0.0:80 | |
server QytL9K0WhWk9-qlzmUNWzA 184.72.80.35:8080 maxconn 50 weight 1 check | |
server 4_5jtxMF5P0k-1q97bFbAg 174.129.114.224:8080 maxconn 50 weight 1 check | |
balance roundrobin | |
EOFpallet | |
} && md5diff= | |
if [ \( -e /etc/haproxy/haproxy.cfg -a -e /etc/haproxy/haproxy.cfg.md5 \) ]; then | |
md5sum --quiet --check /etc/haproxy/haproxy.cfg.md5 | |
md5diff=$? | |
fi | |
contentdiff= | |
if [ \( -e /etc/haproxy/haproxy.cfg -a -e /etc/haproxy/haproxy.cfg.new \) ]; then | |
diff -u /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.new | |
contentdiff=$? | |
fi | |
if [ \( "${md5diff}" == "1" \) ]; then | |
echo Existing content did not match md5: | |
exit 1 | |
fi | |
if [ \( "${contentdiff}" != "0" \) ]; then | |
mv -f --backup=numbered /etc/haproxy/haproxy.cfg.new /etc/haproxy/haproxy.cfg | |
fi | |
if [ ! -e /etc/haproxy/haproxy.cfg ]; then | |
mv /etc/haproxy/haproxy.cfg.new /etc/haproxy/haproxy.cfg | |
fi && md5sum /etc/haproxy/haproxy.cfg > /etc/haproxy/haproxy.cfg.md5 && echo MD5 sum is $(cat /etc/haproxy/haproxy.cfg.md5) && ls -t /etc/haproxy/haproxy.cfg.~[0-9]*~ | tail -n +6 | xargs rm -f; } || { echo remote-file /etc/haproxy/haproxy.cfg failed ; exit 1 ; } >&2 | |
echo "...done" | |
if [ ! -e /etc/default/haproxy.orig ]; then cp /etc/default/haproxy /etc/default/haproxy.orig;fi | |
echo "remote-file /etc/default/haproxy..." | |
{ { cat > /etc/default/haproxy.new <<EOFpallet | |
ENABLED=1 | |
EOFpallet | |
} && md5diff= | |
if [ \( -e /etc/default/haproxy -a -e /etc/default/haproxy.md5 \) ]; then | |
md5sum --quiet --check /etc/default/haproxy.md5 | |
md5diff=$? | |
fi | |
contentdiff= | |
if [ \( -e /etc/default/haproxy -a -e /etc/default/haproxy.new \) ]; then | |
diff -u /etc/default/haproxy /etc/default/haproxy.new | |
contentdiff=$? | |
fi | |
if [ \( "${md5diff}" == "1" \) ]; then | |
echo Existing content did not match md5: | |
exit 1 | |
fi | |
if [ \( "${contentdiff}" != "0" \) ]; then | |
mv -f --backup=numbered /etc/default/haproxy.new /etc/default/haproxy | |
fi | |
if [ ! -e /etc/default/haproxy ]; then | |
mv /etc/default/haproxy.new /etc/default/haproxy | |
fi && chown root:root /etc/default/haproxy && chmod 644 /etc/default/haproxy && md5sum /etc/default/haproxy > /etc/default/haproxy.md5 && echo MD5 sum is $(cat /etc/default/haproxy.md5) && ls -t /etc/default/haproxy.~[0-9]*~ | tail -n +6 | xargs rm -f; } || { echo remote-file /etc/default/haproxy failed ; exit 1 ; } >&2 | |
echo "...done" | |
**** apply-phase :proxied :configure [us-east-1/i-7d353e17 us-east-1/i-73353e19] | |
==== apply-phase-to-node :proxied :configure us-east-1/i-7d353e17 | |
==== add-target-keys :proxied :configure us-east-1/i-7d353e17 | |
==== build-commands :proxied :configure us-east-1/i-7d353e17 | |
==== execute-with-local-sh :proxied :configure us-east-1/i-7d353e17 | |
---> SSH exec on us-east-1/i-7d353e17 : echo "Packages..." | |
{ { debconf-set-selections <<EOF | |
debconf debconf/frontend select noninteractive | |
debconf debconf/frontend seen false | |
EOF | |
} && aptitude install -q -y openjdk-6-jdk && aptitude show openjdk-6-jdk && aptitude install -q -y tomcat6 && aptitude show tomcat6; } || { echo Packages failed ; exit 1 ; } >&2 | |
echo "...done" | |
==== apply-phase-to-node :proxied :configure us-east-1/i-73353e19 | |
==== add-target-keys :proxied :configure us-east-1/i-73353e19 | |
==== build-commands :proxied :configure us-east-1/i-73353e19 | |
==== execute-with-local-sh :proxied :configure us-east-1/i-73353e19 | |
---> SSH exec on us-east-1/i-73353e19 : echo "Packages..." | |
{ { debconf-set-selections <<EOF | |
debconf debconf/frontend select noninteractive | |
debconf debconf/frontend seen false | |
EOF | |
} && aptitude install -q -y openjdk-6-jdk && aptitude show openjdk-6-jdk && aptitude install -q -y tomcat6 && aptitude show tomcat6; } || { echo Packages failed ; exit 1 ; } >&2 | |
echo "...done" | |
**** apply-phase :haproxy :after-configure [us-east-1/i-9d303bf7] | |
==== apply-phase-to-node :haproxy :after-configure us-east-1/i-9d303bf7 | |
==== add-target-keys :haproxy :after-configure us-east-1/i-9d303bf7 | |
==== build-commands :haproxy :after-configure us-east-1/i-9d303bf7 | |
==== execute-with-local-sh :haproxy :after-configure us-east-1/i-9d303bf7 | |
**** apply-phase :proxied :after-configure [us-east-1/i-7d353e17 us-east-1/i-73353e19] | |
==== apply-phase-to-node :proxied :after-configure us-east-1/i-7d353e17 | |
==== add-target-keys :proxied :after-configure us-east-1/i-7d353e17 | |
==== build-commands :proxied :after-configure us-east-1/i-7d353e17 | |
==== execute-with-local-sh :proxied :after-configure us-east-1/i-7d353e17 | |
==== apply-phase-to-node :proxied :after-configure us-east-1/i-73353e19 | |
==== add-target-keys :proxied :after-configure us-east-1/i-73353e19 | |
==== build-commands :proxied :after-configure us-east-1/i-73353e19 | |
==== execute-with-local-sh :proxied :after-configure us-east-1/i-73353e19 | |
**** apply-phase :haproxy :pre-deploy [us-east-1/i-9d303bf7] | |
==== apply-phase-to-node :haproxy :pre-deploy us-east-1/i-9d303bf7 | |
==== add-target-keys :haproxy :pre-deploy us-east-1/i-9d303bf7 | |
==== build-commands :haproxy :pre-deploy us-east-1/i-9d303bf7 | |
==== execute-with-local-sh :haproxy :pre-deploy us-east-1/i-9d303bf7 | |
**** apply-phase :proxied :pre-deploy [us-east-1/i-7d353e17 us-east-1/i-73353e19] | |
==== apply-phase-to-node :proxied :pre-deploy us-east-1/i-7d353e17 | |
==== add-target-keys :proxied :pre-deploy us-east-1/i-7d353e17 | |
==== build-commands :proxied :pre-deploy us-east-1/i-7d353e17 | |
==== execute-with-local-sh :proxied :pre-deploy us-east-1/i-7d353e17 | |
==== apply-phase-to-node :proxied :pre-deploy us-east-1/i-73353e19 | |
==== add-target-keys :proxied :pre-deploy us-east-1/i-73353e19 | |
==== build-commands :proxied :pre-deploy us-east-1/i-73353e19 | |
==== execute-with-local-sh :proxied :pre-deploy us-east-1/i-73353e19 | |
**** apply-phase :haproxy :deploy [us-east-1/i-9d303bf7] | |
==== apply-phase-to-node :haproxy :deploy us-east-1/i-9d303bf7 | |
==== add-target-keys :haproxy :deploy us-east-1/i-9d303bf7 | |
==== build-commands :haproxy :deploy us-east-1/i-9d303bf7 | |
==== execute-with-local-sh :haproxy :deploy us-east-1/i-9d303bf7 | |
**** apply-phase :proxied :deploy [us-east-1/i-7d353e17 us-east-1/i-73353e19] | |
==== apply-phase-to-node :proxied :deploy us-east-1/i-7d353e17 | |
==== add-target-keys :proxied :deploy us-east-1/i-7d353e17 | |
==== build-commands :proxied :deploy us-east-1/i-7d353e17 | |
==== execute-with-local-sh :proxied :deploy us-east-1/i-7d353e17 | |
---> Trasfer to /var/lib/tomcat6/webapps/ROOT.war.new : ../mini-webapp/mini-webapp-1.0.0-SNAPSHOT.war | |
---> SSH exec on us-east-1/i-7d353e17 : echo "remote-file /var/lib/tomcat6/webapps/ROOT.war..." | |
{ md5diff= | |
if [ \( -e /var/lib/tomcat6/webapps/ROOT.war -a -e /var/lib/tomcat6/webapps/ROOT.war.md5 \) ]; then | |
md5sum --quiet --check /var/lib/tomcat6/webapps/ROOT.war.md5 | |
md5diff=$? | |
fi | |
contentdiff= | |
if [ \( -e /var/lib/tomcat6/webapps/ROOT.war -a -e /var/lib/tomcat6/webapps/ROOT.war.new \) ]; then | |
diff -u /var/lib/tomcat6/webapps/ROOT.war /var/lib/tomcat6/webapps/ROOT.war.new | |
contentdiff=$? | |
fi | |
if [ \( "${md5diff}" == "1" \) ]; then | |
echo Existing content did not match md5: | |
exit 1 | |
fi | |
if [ \( "${contentdiff}" != "0" \) ]; then | |
mv -f --backup=numbered /var/lib/tomcat6/webapps/ROOT.war.new /var/lib/tomcat6/webapps/ROOT.war | |
fi | |
if [ ! -e /var/lib/tomcat6/webapps/ROOT.war ]; then | |
mv /var/lib/tomcat6/webapps/ROOT.war.new /var/lib/tomcat6/webapps/ROOT.war | |
fi && chown tomcat6 /var/lib/tomcat6/webapps/ROOT.war && chgrp tomcat6 /var/lib/tomcat6/webapps/ROOT.war && chmod 600 /var/lib/tomcat6/webapps/ROOT.war && md5sum /var/lib/tomcat6/webapps/ROOT.war > /var/lib/tomcat6/webapps/ROOT.war.md5 && echo MD5 sum is $(cat /var/lib/tomcat6/webapps/ROOT.war.md5) && ls -t /var/lib/tomcat6/webapps/ROOT.war.~[0-9]*~ | tail -n +6 | xargs rm -f; } || { echo remote-file /var/lib/tomcat6/webapps/ROOT.war failed ; exit 1 ; } >&2 | |
echo "...done" | |
echo "directory /var/lib/tomcat6/webapps/ROOT..." | |
{ rm -r -f /var/lib/tomcat6/webapps/ROOT; } || { echo directory /var/lib/tomcat6/webapps/ROOT failed ; exit 1 ; } >&2 | |
echo "...done" | |
==== apply-phase-to-node :proxied :deploy us-east-1/i-73353e19 | |
==== add-target-keys :proxied :deploy us-east-1/i-73353e19 | |
==== build-commands :proxied :deploy us-east-1/i-73353e19 | |
==== execute-with-local-sh :proxied :deploy us-east-1/i-73353e19 | |
---> Trasfer to /var/lib/tomcat6/webapps/ROOT.war.new : ../mini-webapp/mini-webapp-1.0.0-SNAPSHOT.war | |
---> SSH exec on us-east-1/i-73353e19 : echo "remote-file /var/lib/tomcat6/webapps/ROOT.war..." | |
{ md5diff= | |
if [ \( -e /var/lib/tomcat6/webapps/ROOT.war -a -e /var/lib/tomcat6/webapps/ROOT.war.md5 \) ]; then | |
md5sum --quiet --check /var/lib/tomcat6/webapps/ROOT.war.md5 | |
md5diff=$? | |
fi | |
contentdiff= | |
if [ \( -e /var/lib/tomcat6/webapps/ROOT.war -a -e /var/lib/tomcat6/webapps/ROOT.war.new \) ]; then | |
diff -u /var/lib/tomcat6/webapps/ROOT.war /var/lib/tomcat6/webapps/ROOT.war.new | |
contentdiff=$? | |
fi | |
if [ \( "${md5diff}" == "1" \) ]; then | |
echo Existing content did not match md5: | |
exit 1 | |
fi | |
if [ \( "${contentdiff}" != "0" \) ]; then | |
mv -f --backup=numbered /var/lib/tomcat6/webapps/ROOT.war.new /var/lib/tomcat6/webapps/ROOT.war | |
fi | |
if [ ! -e /var/lib/tomcat6/webapps/ROOT.war ]; then | |
mv /var/lib/tomcat6/webapps/ROOT.war.new /var/lib/tomcat6/webapps/ROOT.war | |
fi && chown tomcat6 /var/lib/tomcat6/webapps/ROOT.war && chgrp tomcat6 /var/lib/tomcat6/webapps/ROOT.war && chmod 600 /var/lib/tomcat6/webapps/ROOT.war && md5sum /var/lib/tomcat6/webapps/ROOT.war > /var/lib/tomcat6/webapps/ROOT.war.md5 && echo MD5 sum is $(cat /var/lib/tomcat6/webapps/ROOT.war.md5) && ls -t /var/lib/tomcat6/webapps/ROOT.war.~[0-9]*~ | tail -n +6 | xargs rm -f; } || { echo remote-file /var/lib/tomcat6/webapps/ROOT.war failed ; exit 1 ; } >&2 | |
echo "...done" | |
echo "directory /var/lib/tomcat6/webapps/ROOT..." | |
{ rm -r -f /var/lib/tomcat6/webapps/ROOT; } || { echo directory /var/lib/tomcat6/webapps/ROOT failed ; exit 1 ; } >&2 | |
echo "...done" | |
**** apply-phase :haproxy :after-deploy [us-east-1/i-9d303bf7] | |
==== apply-phase-to-node :haproxy :after-deploy us-east-1/i-9d303bf7 | |
==== add-target-keys :haproxy :after-deploy us-east-1/i-9d303bf7 | |
==== build-commands :haproxy :after-deploy us-east-1/i-9d303bf7 | |
==== execute-with-local-sh :haproxy :after-deploy us-east-1/i-9d303bf7 | |
**** apply-phase :proxied :after-deploy [us-east-1/i-7d353e17 us-east-1/i-73353e19] | |
==== apply-phase-to-node :proxied :after-deploy us-east-1/i-7d353e17 | |
==== add-target-keys :proxied :after-deploy us-east-1/i-7d353e17 | |
==== build-commands :proxied :after-deploy us-east-1/i-7d353e17 | |
==== execute-with-local-sh :proxied :after-deploy us-east-1/i-7d353e17 | |
==== apply-phase-to-node :proxied :after-deploy us-east-1/i-73353e19 | |
==== add-target-keys :proxied :after-deploy us-east-1/i-73353e19 | |
==== build-commands :proxied :after-deploy us-east-1/i-73353e19 | |
==== execute-with-local-sh :proxied :after-deploy us-east-1/i-73353e19 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment