Commit 533572da authored by Hermann Mayer's avatar Hermann Mayer

Initial commit.

parents
FROM maoo/alfresco-allinone-community:latest
MAINTAINER Hermann Mayer <hermann.mayer92@gmail.com>
COPY . /app
RUN chmod 755 /app/bin/*
RUN /app/bin/install
EXPOSE 80 8080
ENTRYPOINT ["/app/bin/init"]
CMD ["app:start"]
# Commands and Paths
SHELL=/bin/bash
CONTAINER_VERSION := 5.0.a
CONTAINER_REGISTRY := e5.lan:5000
CONTAINER_NAME := alfresco
CONTAINER_URI := $(CONTAINER_REGISTRY)/$(CONTAINER_NAME):$(CONTAINER_VERSION)
QUICKSTART_CONTAINER := alfresco-quickstart
.PHONY: all \
build-image rebuild-image clean-image start-image start-bash-image stop-image image-logs
all: help
help:
##### Docker Image Development #####
# build-image Build the docker container
# rebuild-image Full test cycle, clean, build, start and show logs
# clean-image Remove the builded image
#
##### Docker Image Process control #####
# start-image Start the builded container
# start-bash-image Start a bash shell on the builded container
# stop-image Stop and remove the builded container
# image-logs Show the logs of the container
#####################################
# Docker Image Development
#####################################
build-image:
time docker build -t "$(CONTAINER_URI)" .
start-image: stop-image
docker run --name='$(QUICKSTART_CONTAINER)' -d \
-v "`pwd`/data/contentstore:/var/lib/tomcat7/alf_data/contentstore" \
-v "`pwd`/data/solrhome:/var/lib/tomcat7/alf_data/solrhome" \
-e 'ALFRESCO_HOST=alfresco.e5.lan' \
-e 'ALFRESCO_PORT=80' \
-e 'SHARE_HOST=docs.jity.de' \
-e 'SHARE_PORT=80' \
-e 'DB_HOST=10.0.0.140' \
-e 'DB_DBNAME=alfresco' \
-e 'DB_USERNAME=alfresco' \
-e 'DB_PASSWORD=alfresco' \
-p 18080:80 \
"$(CONTAINER_URI)"
start-bash-image:
docker run -i --name='$(QUICKSTART_CONTAINER)-bash' \
-v "`pwd`/data/contentstore:/var/lib/tomcat7/alf_data/contentstore" \
-v "`pwd`/data/solrhome:/var/lib/tomcat7/alf_data/solrhome" \
-e 'ALFRESCO_HOST=alfresco.e5.lan' \
-e 'ALFRESCO_PORT=80' \
-e 'SHARE_HOST=docs.jity.de' \
-e 'SHARE_PORT=80' \
-e 'DB_HOST=10.0.0.140' \
-e 'DB_DBNAME=alfresco' \
-e 'DB_USERNAME=alfresco' \
-e 'DB_PASSWORD=alfresco' \
-p 18080:80 \
"$(CONTAINER_URI)" /bin/bash
stop-image:
docker stop '$(QUICKSTART_CONTAINER)' || exit 0
docker stop '$(QUICKSTART_CONTAINER)-bash' || exit 0
docker rm '$(QUICKSTART_CONTAINER)' || exit 0
docker rm '$(QUICKSTART_CONTAINER)-bash' || exit 0
clean-image: stop-image
docker rmi "$(CONTAINER_URI)" || exit 0
rebuild-image: clean-image build-image start-image image-logs
image-logs:
docker logs -f '$(QUICKSTART_CONTAINER)'
![Alfresco Connector](docs/logo-project.png)
This is a repack of [maoo/alfresco-allinone-community](https://registry.hub.docker.com/u/maoo/alfresco-allinone-community/).
With the ability to easily change config values without hours of setting up a
build environment and the build process.
- [Requirements](#requirements)
- [Production](#production)
- [Development](#development)
- [Deployment](#deployment)
- [Quick Start](#quick-start)
- [Available Configuration Parameters](#available-configuration-parameters)
- [Data Volumes](#data-volumes)
- [Development](#development-1)
## Requirements
### Production
* A running MySQL server
### Development
* A running MySQL server, as well
## Deployment
This application is able to be deployed with the help of docker.
The next sections will help you building a shipable image of the app.
### Quick Start
```bash
# Run the container
$ docker run -d \
-v "`pwd`/data/contentstore:/var/lib/tomcat7/alf_data/contentstore" \
-v "`pwd`/data/solrhome:/var/lib/tomcat7/alf_data/solrhome" \
-e 'ALFRESCO_HOST=alfresco.e5.lan' \
-e 'ALFRESCO_PORT=80' \
-e 'SHARE_HOST=docs.jity.de' \
-e 'SHARE_PORT=80' \
-e 'DB_HOST=10.0.0.140' \
-e 'DB_DBNAME=alfresco' \
-e 'DB_USERNAME=alfresco' \
-e 'DB_PASSWORD=alfresco' \
-p 18080:80 \
"e5.lan:5000/alfresco:5.0.a"
```
### Available Configuration Parameters
- **SERVER_ADMIN**: Server administrator email address. Defaults to `root@jiy.de`.
- **ALFRESCO_HOST**: Repository hostname. Defaults to `localhost`.
- **ALFRESCO_PORT**: Repository port. Defaults to `8080`.
- **SHARE_HOST**: Share hostname. Defaults to `localhost`.
- **SHARE_PORT**: Share port. Defaults to `8080`.
- **DB_DRIVER**: JDBC driver. Defaults to `org.gjt.mm.mysql.Driver`.
- **DB_PREFIX**: JDBC protocol prefix. Defaults to `mysql`.
- **DB_HOST**: Database hostname. Defaults to `db.lan`.
- **DB_PORT**: Database port. Defaults to `3306`.
- **DB_DBNAME**: Database name. Defaults to `alfresco`.
- **DB_USERNAME**: Database username. Defaults to `alfresco`.
- **DB_PASSWORD**: Database password. Defaults to `alfresco`.
- **MAIL_PROTOCOL**: E-Mail server protocol. Defaults to `smtp`.
- **MAIL_HOST**: E-Mail server hostname. Defaults to `mail.lan`.
- **MAIL_PORT**: E-Mail server port. Defaults to `25`.
- **MAIL_USERNAME**: E-Mail server username.
- **MAIL_PASSWORD**: E-Mail server password.
- **MAIL_ENCODING**: E-Mail encoding. Defaults to `UTF-8`.
- **MAIL_FROM_DEFAULT**: E-Mail from address. Defaults to `alfresco@docs.jity.de`.
- **MAIL_SMTP_AUTH**: Switch to enable SMTP auth. Defaults to `false`.
- **MAIL_SMTPS_STARTTLS_ENABLE**: Switch to enable STARTTLS for SMTPS. Defaults to `false`.
- **MAIL_SMTPS_AUTH**: Switch to enable SMTPS auth. Defaults to `false`.
### Data Volumes
In order to kick off a docker container which does not loose runtime data you
need to specify data volumes. These data volumes should be host bind mounts
for this application, but if you like to store outputs on a docker container
volume its fine, too. Anyways the following examples are host bind mounts.
Alfresco puts all uploaded content to `/var/lib/tomcat7/alf_data/contentstore`.
This directory needs to be mounted. See the [Quick Start](#quick-start) section above.
Solr puts its search index files to `/var/lib/tomcat7/alf_data/solrhome`.
It is usefull to mount this directory, too. So Solr do not need to rebuild it's
indexes after a container reboot.
### Development
```bash
# Build the container
$ make build-image
# Start the builded container (quickstart)
$ make start-image
# Stop the container
$ make stop-image
# Purge the build - so you could start over with
# another build
$ make clean-image
# See logs for the running container
$ make image-logs
# Start a bash session on the builded container for debugging.
# This command need **clean** or **stop** like the normal **start**.
$ make start-bash-image
```
#!/bin/bash
set -e
SERVER_ADMIN=${SERVER_ADMIN:-'root@jiy.de'}
ALFRESCO_HOST=${ALFRESCO_HOST:-'localhost'}
ALFRESCO_PORT=${ALFRESCO_PORT:-'8080'}
SHARE_HOST=${SHARE_HOST:-'localhost'}
SHARE_PORT=${SHARE_PORT:-'8080'}
DB_DRIVER=${DB_DRIVER:-'org.gjt.mm.mysql.Driver'}
DB_PREFIX=${DB_PREFIX:-'mysql'}
DB_HOST=${DB_HOST:-'db.lan'}
DB_PORT=${DB_PORT:-'3306'}
DB_DBNAME=${DB_DBNAME:-'alfresco'}
DB_USERNAME=${DB_USERNAME:-'alfresco'}
DB_PASSWORD=${DB_PASSWORD:-'alfresco'}
MAIL_PROTOCOL=${MAIL_PROTOCOL:-'smtp'}
MAIL_HOST=${MAIL_HOST:-'mail.lan'}
MAIL_PORT=${MAIL_PORT:-'25'}
MAIL_USERNAME=${MAIL_USERNAME:-}
MAIL_PASSWORD=${MAIL_PASSWORD:-}
MAIL_ENCODING=${MAIL_ENCODING:-'UTF-8'}
MAIL_FROM_DEFAULT=${MAIL_FROM_DEFAULT:-'alfresco@docs.jity.de'}
MAIL_SMTP_AUTH=${MAIL_SMTP_AUTH:-'false'}
MAIL_SMTPS_STARTTLS_ENABLE=${MAIL_SMTPS_STARTTLS_ENABLE:-'false'}
MAIL_SMTPS_AUTH=${MAIL_SMTPS_AUTH:-'false'}
CONFIG_FILE='/var/lib/tomcat7/shared/classes/alfresco-global.properties'
function setOption {
if grep --quiet "$1" "$CONFIG_FILE"; then
# replace option
echo "replacing option $1=$2 in $CONFIG_FILE"
sed -i "s#^\($1\s*=\s*\).*\$#\1$2#" $CONFIG_FILE
if (( $? )); then
echo "setOption failed (replacing option $1=$2 in $CONFIG_FILE)"
exit 1
fi
else
# add option if it does not exist
echo "adding option $1=$2 in $CONFIG_FILE"
echo "$1=$2" >> $CONFIG_FILE
fi
}
# Setup environemnt
touch /var/log/tomcat7/catalina.out
setOption 'alfresco.host' "$ALFRESCO_HOST"
setOption 'alfresco.port' "$ALFRESCO_PORT"
setOption 'share.host' "$SHARE_HOST"
setOption 'share.port' "$SHARE_PORT"
setOption 'db.driver' "$DB_DRIVER"
setOption 'db.prefix' "$DB_PREFIX"
setOption 'db.host' "$DB_HOST"
setOption 'db.port' "$DB_PORT"
setOption 'db.dbname' "$DB_DBNAME"
setOption 'db.username' "$DB_USERNAME"
setOption 'db.password' "$DB_PASSWORD"
setOption 'db.url' "jdbc:$DB_PREFIX://$DB_HOST:$DB_PORT/$DB_DBNAME"
setOption 'mail.protocol' "$MAIL_PROTOCOL"
setOption 'mail.host' "$MAIL_HOST"
setOption 'mail.port' "$MAIL_PORT"
setOption 'mail.username' "$MAIL_USERNAME"
setOption 'mail.password' "$MAIL_PASSWORD"
setOption 'mail.encoding' "$MAIL_ENCODING"
setOption 'mail.from.default' "$MAIL_FROM_DEFAULT"
setOption 'mail.from.enabled' 'false'
setOption 'mail.smtp.auth' "$MAIL_SMTP_AUTH"
setOption 'mail.smtps.starttls.enable' "$MAIL_SMTPS_STARTTLS_ENABLE"
setOption 'mail.smtps.auth' "$MAIL_SMTPS_AUTH"
(
while IFS= read LINE; do
eval 'printf "%s\\n" "'"$LINE"'"'
done < /etc/apache2/sites-enabled/alfresco.conf.dist
) > /etc/apache2/sites-enabled/alfresco.conf
rm /etc/apache2/sites-enabled/alfresco.conf.dist
appStart () {
/etc/init.d/apache2 start || true
/etc/init.d/tomcat7 start || true
exec tail -f /var/log/tomcat7/catalina.out
}
appHelp () {
echo "Available options:"
echo " app:start - Start the application"
echo " app:help - Displays the help"
echo " [command] - Execute the specified linux command eg. bash."
}
case "$1" in
app:start)
appStart
;;
app:help)
appHelp
;;
*)
if [ -x $1 ]; then
$1
else
prog=$(which $1)
if [ -n "${prog}" ] ; then
shift 1
$prog $@
else
appHelp
fi
fi
;;
esac
exit 0
#!/bin/bash
set -e
# Set some defaults for apt
export DEBIAN_FRONTEND=noninteractive
# Install apache
apt-get --no-install-recommends -qy install apache2
# Enable mod_proxy
a2enmod rewrite
a2enmod proxy
a2enmod proxy_http
# Copy apache vhost config
cp /app/var/config/apache.vhost.conf \
/etc/apache2/sites-enabled/alfresco.conf.dist
# Manually deploy share.war to fix some css styles
unzip -d /var/lib/tomcat7/webapps/share /var/lib/tomcat7/webapps/share.war
chown tomcat7:tomcat7 -R /var/lib/tomcat7/webapps/share
# Fix alfresco community footer css - set it invisible
cat >> /var/lib/tomcat7/webapps/share/components/footer/footer.css <<EOF
.footer > span.copyright {
display: none;
}
.footer-com, .footer-ent, .footer-team {
padding: 24px !important;
}
EOF
chown root:root /var/lib/tomcat7/webapps/share/components/footer
{
"builders": [
{
"type": "docker",
"image": "maoo/alfresco-repo-base:latest",
"export_path": "alfresco-allinone-community.tar"
}
],
"provisioners": [
{
"type": "shell",
"inline": ["apt-get -qq update"]
},
{
"json": {
"alfresco": {
"components" : ["repo"],
"properties": {
"db.driver": "org.gjt.mm.mysql.Driver",
"db.prefix": "mysql",
"db.host": "db.lan",
"db.port": 3306,
"db.dbname": "alfresco",
"db.username": "alfresco",
"db.password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"mail.protocol": "smtp",
"mail.host": "mail.lan",
"mail.port": "25",
"mail.username": "",
"mail.password": "",
"mail.encoding": "UTF-8",
"mail.from.default": "alfresco@docs.jity.de",
"mail.smtp.auth": false,
"mail.smtps.starttls.enable": false,
"mail.smtps.auth": false
}
},
"tomcat" : {
"base_version": 7
}
},
"cookbook_paths": [
"../../../../common/vendor-cookbooks"
],
"data_bags_path": "../../../../common/data_bags",
"run_list": [
"alfresco::default"
],
"prevent_sudo": false,
"skip_install": false,
"type": "chef-solo"
}
]
}
<VirtualHost *:80>
ServerAdmin ${SERVER_ADMIN}
ServerName ${SHARE_HOST}
ErrorLog \\${APACHE_LOG_DIR}/error.log
CustomLog \\${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteRule ^/$ http://%{SERVER_NAME}/share/ [L,R]
ProxyPass /share http://localhost:8080/share
ProxyPassReverse /share http://localhost:8080/share
</VirtualHost>
<VirtualHost *:80>
ServerAdmin ${SERVER_ADMIN}
ServerName ${ALFRESCO_HOST}
ErrorLog \\${APACHE_LOG_DIR}/error.log
CustomLog \\${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteRule ^/$ http://%{SERVER_NAME}/alfresco/ [L,R]
ProxyPass /alfresco http://localhost:8080/alfresco
ProxyPassReverse /alfresco http://localhost:8080/alfresco
</VirtualHost>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment