Skip to content

Commit

Permalink
Add alpha version 1
Browse files Browse the repository at this point in the history
  • Loading branch information
reihsr committed Oct 12, 2016
1 parent cb776e5 commit 94e2351
Show file tree
Hide file tree
Showing 10 changed files with 1,324 additions and 0 deletions.
828 changes: 828 additions & 0 deletions config/functions

Large diffs are not rendered by default.

167 changes: 167 additions & 0 deletions config/liferay
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: liferay
# Required-Start:
# Should-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: liferay
# Description: Start Liferay Server
### END INIT INFO

#
# description: This script is a program to control \
# this Tomcat instance. To stop the instance\
# the program will be checked and stopped. \
# If this was not successfull, than a kill will \
# be executed and after that a kill -9 signal send.
#
# processname: tc_msaccmgrtest
#

# Source function library.
. /etc/init.d/functions

SCRIPT_VERSION=1.0.1
RUN_USER=liferay
TOMCAT_DIR=/opt/liferay
TOMCAT_INSTANCE=TOMCAT_INSTANCE_VERSION_NUMBER
CATALINA_HOME=$TOMCAT_DIR/$TOMCAT_INSTANCE
EXEC_PATH=$CATALINA_HOME/bin #insert the path of the executing programm
EXEC_PRG=$EXEC_PATH/catalina.sh #executing program
EXEC_VERSION=$EXEC_PATH/version.sh #executing program
PRG_START=start #choose the executing option to start the program
PRG_STOP=stop #choose the executing option to stop the program

RETVAL=0

# function to check the PID`s
checker () {
GREP_VAR1=java
GREP_VAR2=$CATALINA_HOME
GREP_VAR3=org.apache.catalina.startup.Bootstrap

PID=`ps -ef | grep -v grep | grep $GREP_VAR1 | grep $GREP_VAR2 | grep $GREP_VAR3 | awk '{print($2)}'`
PID_COUNT=`ps -ef | grep -v grep | grep $GREP_VAR1 | grep $GREP_VAR2 | grep -c $GREP_VAR3`
}

# function to start the program
# with a check whether the system starts correctly
start () {
checker
if [ $PID_COUNT -eq 0 ]
then
echo -n "Start of Tomcat instance $TOMCAT_INSTANCE"
sleep 1
su $RUN_USER -c "cd $CATALINA_HOME/bin;$EXEC_PRG $PRG_START" > /dev/null
RETVAL=$?
if [ $RETVAL -eq 0 ]
then
success
else
failure
fi
echo

else
echo -n $"Tomcat already running"
failure
RETVAL=1
echo
fi
}

# Stop function to deactivate program
# With 2 checks whether the program is, stopped via catalina in the 1st check and
# in the 2nd check whether it`s killed correctly
stop () {
checker
if [ $PID_COUNT -gt 0 ] #checking the PID_COUNT for the 1st time
then
echo -n "Stopping Tomcat instance $TOMCAT_INSTANCE"
su $RUN_USER -c "$EXEC_PRG $PRG_STOP" > /dev/null
echo
sleep 5
PID_COUNT=`ps -ef | grep -v grep | grep $GREP_VAR1 | grep $GREP_VAR2 | grep -c $GREP_VAR3`
if [ $PID_COUNT -gt 0 ] #checking the PID_COUNT a 2nd time
then
echo -n "Tomcat instance $TOMCAT_INSTANCE stopped"
failure
echo
kill $PID
sleep 2
PID_COUNT=`ps -ef | grep -v grep | grep $GREP_VAR1 | grep $GREP_VAR2 | grep -c $GREP_VAR3`
if [ $PID_COUNT -gt 0 ] #checking the PID_COUNT a 3rd time
then
echo -n "Kill Tomcat instance $TOMCAT_INSTANCE"
sleep 2
kill -9 $PID
PID_COUNT=`ps -ef | grep -v grep | grep $GREP_VAR1 | grep $GREP_VAR2 | grep -c $GREP_VAR3`
if [ $PID_COUNT -gt 0 ] #checking the PID_COUNT after kill -9
then
failure
RETVAL=1
else
success
fi
echo
else
echo -n "Tomcat instance $TOMCAT_INSTANCE stopped"
success
echo
fi
else
echo -n "Tomcat instance $TOMCAT_INSTANCE stopped"
success
echo
fi
else
echo -n $"Tomcat instance $TOMCAT_INSTANCE is stopped"
failure
RETVAL=1
echo
fi
}

# function to check the status
status () {
checker
if [ $PID_COUNT -ge 1 ]
then
echo -n "Tomcat instance $TOMCAT_INSTANCE is running"
sleep 1
success
echo
else [ $PID_COUNT -eq 0 ]
echo -n "Tomcat instance $TOMCAT_INSTANCE is stopped"
failure
RETVAL=1
echo
fi
}

# function to check the cersion of Catalina
version () {
su $RUN_USER -c "$EXEC_VERSION"
RETVAL=$?
}

# main program entry
case "$1" in

start) start
;;
status) status
;;
stop) stop
;;
restart) stop
sleep 3
start
;;
version) version
;;
*) echo "Usage: tc_$TOMCAT_INSTANCE {start|stop|restart|status|version}";
esac
exit $RETVAL
38 changes: 38 additions & 0 deletions config/portal-ext.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#Don't show portlet errors when not configured or user has no permission
layout.show.portlet.inactive=false
layout.show.portlet.access.denied=false

#No cleartext passwords in ldap please!
ldap.auth.password.encryption.algorithm=

#Disable reminder query at user creation
users.reminder.queries.enabled=false

#Allow all domains for redirects
redirect.url.security.mode=domain
redirect.url.domains.allowed=

#Disable Captcha (user creation)
captcha.check.portal.create_account=false
captcha.max.challenges=-1

#Autogenerate screenName at user creation
field.editable.com.liferay.portal.model.User.screenName=user

#No terms of use at registration
terms.of.use.required=false

#Disable private/public pages for all users
layout.user.private.layouts.enabled=false
layout.user.public.layouts.enabled=false

freemarker.engine.restricted.classes=
freemarker.engine.restricted.variables=
freemarker.engine.restricted.packages=
velocity.engine.restricted.classes=
velocity.engine.restricted.variables=
velocity.engine.restricted.packages=

auth.token.ignore.portlets=49

#Last line (Due to a LR bug, last line of properties File is not read. This is a placeholder)
10 changes: 10 additions & 0 deletions config/portal-setup-wizard.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
admin.email.from.address[email protected]
admin.email.from.name=Test
company.default.name=Liferay
default.admin.first.name=BIBBOX
jdbc.default.driverClassName=org.postgresql.Driver
jdbc.default.password=DATABASEPASSWORD
jdbc.default.url=jdbc:postgresql://liferay-db:5432/lportal
jdbc.default.username=liferay
liferay.home=/opt/liferay
setup.wizard.enabled=false
38 changes: 38 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '2'
services:
liferay-application-§§INSTANCE:
image: bibbox/liferay-application
container_name: liferay-application-§§INSTANCE
volumes_from:
- liferay-data-§§INSTANCE
links:
- liferay-db-§§INSTANCE
ports:
- §§PORT:8080
environment:
- POSTGRES_PASSWORD=§§SET_PGSETUP_POSTGRES_PASSWORD
depends_on:
- liferay-data-§§INSTANCE
- liferay-db-§§INSTANCE
liferay-db-§§INSTANCE:
image: postgres:9.5
container_name: liferay-db-§§INSTANCE
environment:
- POSTGRES_PASSWORD=§§SET_PGSETUP_POSTGRES_PASSWORD
- POSTGRES_USER=liferay
- PGDATA=/var/lib/postgresql/data/pgdata
- POSTGRES_DB=lportal
volumes_from:
- liferay-data-§§INSTANCE
depends_on:
- liferay-data-§§INSTANCE
liferay-data-§§INSTANCE:
image: bibbox/liferay-data
container_name: liferay-data-§§INSTANCE
volumes:
- §§FOLDER/config/functions:/etc/init.d/functions
- §§FOLDER/config/liferay:/opt/config/liferay
- §§FOLDER/config/portal-ext.properties:/opt/liferay/portal-ext.properties
- §§FOLDER/config/portal-setup-wizard.properties:/opt/config/portal-setup-wizard.properties
- §§FOLDER/liferay/data:/opt/liferay/data
- §§FOLDER/postgresql/data/pgdata:/var/lib/postgresql/data/pgdata
34 changes: 34 additions & 0 deletions image/liferay-application/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Liferay 6.2 GA6 application container
#
# VERSION 0.0.1
#
# 0.0.1 : initial creation of image with Liferay and Data from RD-Connect

FROM debian:jessie

MAINTAINER Robert Reihs <[email protected]>

RUN apt-get update \
&& apt-get install -y wget unzip \
&& echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections \
&& echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list \
&& echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 \
&& apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install oracle-java7-installer \
&& apt-get -y install oracle-java7-set-default

WORKDIR /opt

RUN wget -O liferay-portal-tomcat-6.2-ce-ga6.zip http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.2.5%20GA6/liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip \
&& unzip liferay-portal-tomcat-6.2-ce-ga6.zip \
&& rm liferay-portal-tomcat-6.2-ce-ga6.zip \
&& mv liferay-portal-6.2-ce-ga6 liferay \
&& useradd -r liferay

ADD scripts /opt/scripts
WORKDIR /opt/scripts
RUN chmod a+x *.sh

ENTRYPOINT ["/opt/scripts/entrypoint.sh"]
27 changes: 27 additions & 0 deletions image/liferay-application/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
echo "Starting Liferay Application Container!"

file="/opt/liferay/setup.done"
tomcat="tomcat-7.0.62"

#Config
if [[ ! -f "$file" ]]; then

cat << EOF > $file
Liferay 0.0.1 installed
EOF

cp /opt/config/liferay /etc/init.d/liferay
cp /opt/config/portal-setup-wizard.properties /opt/liferay/portal-setup-wizard.properties
sed -i "s/DATABASEPASSWORD/${POSTGRES_PASSWORD}/g" /opt/liferay/portal-setup-wizard.properties
sed -i "s/TOMCAT_INSTANCE_VERSION_NUMBER/$tomcat/g" /etc/init.d/liferay

chown -R liferay:liferay /opt/liferay
chmod +x /etc/init.d/functions
chmod +x /etc/init.d/liferay

fi

#Startu Up
service liferay start
tail -f /opt/liferay/$tomcat/logs/catalina.out
15 changes: 15 additions & 0 deletions image/liferay-data/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Liferay Data Container
#
# VERSION 0.0.1
#
# 0.0.1 : initial creation of image for the liferay data container with config for postgres

FROM debian:jessie

MAINTAINER Robert Reihs <[email protected]>

ADD init-config.sh /usr/local/bin/init-config.sh

# Keep container from shutting down until explicitly stopped
ENTRYPOINT ["/bin/sh"]
CMD ["/usr/local/bin/init-config.sh"]
3 changes: 3 additions & 0 deletions image/liferay-data/init-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

tail -f /dev/null
Loading

0 comments on commit 94e2351

Please sign in to comment.