15
15
-DarchetypeGroupId=org.apache.syncope \
16
16
-DarchetypeArtifactId=syncope-archetype \
17
17
-DarchetypeRepository=http://repo1.maven.org/maven2 \
18
-DarchetypeVersion=1.1.5 \
18
-DarchetypeVersion=1.1.6 \
19
19
-DgroupId=net.tirasa.syncope \
20
20
-DartifactId=$PROJECT_NAME \
21
21
-Dversion=1.0-SNAPSHOT \
30
30
juju-log "Apache Syncope overlay project already present"
33
# 2. Download the configured JEE container and do some basic setup
36
if [ "$JEE_CONTAINER" == "glassfish" ]; then
37
juju-log "Go for Glassfish"
39
if [ "$JEE_CONTAINER" == "jboss" ]; then
40
juju-log "Go for JBoss"
42
TOMCAT_VERSION="7.0.52"
43
juju-log "Go for Tomcat $TOMCAT_VERSION under $TOMCAT_HOME"
45
if [ ! -d $TOMCAT_HOME ]; then
46
juju-log "Downloading Tomcat $TOMCAT_VERSION..."
49
wget_output=$(wget -qN https://archive.apache.org/dist/tomcat/tomcat-7/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz)
51
juju-log "Cannot download Tomcat $TOMCAT_VERSION: aborting"
54
wget_output=$(wget -qN https://archive.apache.org/dist/tomcat/tomcat-7/KEYS)
56
juju-log "Cannot download Tomcat KEYS: aborting"
59
wget_output=$(wget -qN https://archive.apache.org/dist/tomcat/tomcat-7/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz.asc)
61
juju-log "Cannot download Tomcat $TOMCAT_VERSION ASC: aborting"
64
wget_output=$(wget -qN https://archive.apache.org/dist/tomcat/tomcat-7/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz.md5)
66
juju-log "Cannot download Tomcat $TOMCAT_VERSION MD5: aborting"
70
# Verify the downloaded archive
71
md5sum --status -c apache-tomcat-$TOMCAT_VERSION.tar.gz.md5
73
juju-log "$TOMCAT_VERSION MD5 verification failed: aborting"
76
gpg_output=$(gpg --import KEYS)
77
gpg_output=$(gpg --verify apache-tomcat-$TOMCAT_VERSION.tar.gz.asc)
79
juju-log "$TOMCAT_VERSION ASC verification failed: aborting"
83
# Install Tomcat and perform basic configuration
85
tar xvzf /tmp/apache-tomcat-$TOMCAT_VERSION.tar.gz
86
ln -s apache-tomcat-$TOMCAT_VERSION apache-tomcat
88
cp $TOMCAT_HOME/conf/server.xml $TOMCAT_HOME/conf/server.xml.orig
89
sed -i "s/8080/$HTTP_PORT/g" $TOMCAT_HOME/conf/server.xml
91
cat > $TOMCAT_HOME/bin/setenv.sh <<EOF
92
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8
93
-server -Xms1536m -Xmx1536m
94
-XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC
95
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m
96
-XX:MaxPermSize=512m -XX:+DisableExplicitGC"
99
chmod 755 $TOMCAT_HOME/bin/setenv.sh
101
cat > /etc/init.d/apache-tomcat <<EOF
103
# Provides: apache-tomcat
104
# Required-Start: \$local_fs \$remote_fs \$network
105
# Required-Stop: \$local_fs \$remote_fs \$network
106
# Should-Start: \$named
107
# Should-Stop: \$named
108
# Default-Start: 2 3 4 5
109
# Default-Stop: 0 1 6
110
# Short-Description: Start Tomcat.
111
# Description: Start the Tomcat servlet engine.
117
sh $TOMCAT_HOME/bin/startup.sh
121
sh $TOMCAT_HOME/bin/shutdown.sh
125
sh $TOMCAT_HOME/bin/shutdown.sh
126
sh $TOMCAT_HOME/bin/startup.sh
133
chmod 755 /etc/init.d/apache-tomcat
134
update-rc.d apache-tomcat defaults
136
juju-log "Tomcat already set up under $TOMCAT_HOME"
142
# Make it publicly visible, once the syncope service is exposed
143
open-port $HTTP_PORT/tcp