Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 26 additions & 58 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,75 +1,43 @@
FROM ubuntu:14.04
FROM ubuntu:16.04

# This is where mginstallubuntu.sh downloads packages into
ENV TEMPDIR /tmp/install_mapguide
ENV URL_HOST "https://download.osgeo.org"
ENV URL_RELPATH "/mapguide/releases"
ENV FDOVER_MAJOR=4
ENV FDOVER_MINOR=1
ENV FDOVER_MAJOR_MINOR=${FDOVER_MAJOR}.${FDOVER_MINOR}
ENV FDOVER_POINT=0
ENV FDOVER_MAJOR_MINOR_REV=${FDOVER_MAJOR_MINOR}.${FDOVER_POINT}
ENV FDOBUILD=7814
ENV FDOARCH=amd64
ENV FDOVER=${FDOVER_MAJOR_MINOR_REV}-${FDOBUILD}_${FDOARCH}
ENV MGVER_MAJOR=3
ENV MGVER_MINOR=1
ENV MGVER_MAJOR_MINOR=${MGVER_MAJOR}.${MGVER_MINOR}
ENV MGVER_POINT=2
ENV MGVER_MAJOR_MINOR_REV=${MGVER_MAJOR_MINOR}.${MGVER_POINT}
ENV MGRELEASELABEL=Final
ENV MGBUILD=9484
ENV MGARCH=amd64
ENV MGVER=${MGVER_MAJOR_MINOR_REV}-${MGBUILD}_${MGARCH}
ENV TEMPDIR=/tmp/install_mapguide
ENV FDOVER_MAJOR_MINOR_REV=4.2.0
ENV MGVER_MAJOR_MINOR_REV=4.0.0
ENV MG_PATH=/usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}
ENV MGLOG_PATH=${MG_PATH}/server/Logs
ENV MGAPACHE_LOG=${MG_PATH}/webserverextensions/apache2/logs
ENV MGTOMCAT_LOG=${MG_PATH}/webserverextensions/tomcat/logs
ENV ADMIN_USER=Administrator
ENV ADMIN_PASSWORD=admin
ENV URL_MAPGUIDE_RUN=http://download.osgeo.org/mapguide/releases/4.0.0/Preview2/mapguideopensource-4.0.0.9740-ubuntu16-install.run

ENV URL_ROOT "${URL_HOST}/${URL_RELPATH}/${MGVER_MAJOR_MINOR_REV}/${MGRELEASELABEL}"
ENV URL_PART ubuntu14_x64
ENV URL "$URL_ROOT/$URL_PART"

ENV DEFAULT_SERVER_IP "0.0.0.0"
ENV DEFAULT_ADMIN_PORT 2810
ENV DEFAULT_CLIENT_PORT 2811
ENV DEFAULT_SITE_PORT 2812
ENV DEFAULT_HTTPD_PORT 8008
# ENV DEFAULT_TOMCAT_PORT 8009

RUN mkdir -p ${TEMPDIR}
WORKDIR ${TEMPDIR}

# RUN INSTALLER SCRIPT IN HEADLESS MODE
RUN apt-get update \
&& apt-get -y install wget \
&& wget ${URL}/mginstallubuntu.sh \
&& chmod +x mginstallubuntu.sh \
&& ./mginstallubuntu.sh --headless --no-service-install --no-mgserver-start \
--no-tomcat-start --no-httpd-start --with-sdf --with-shp --with-sqlite --with-gdal \
--with-ogr --with-wfs --admin-port ${DEFAULT_ADMIN_PORT} --client-port ${DEFAULT_CLIENT_PORT} \
--site-port ${DEFAULT_SITE_PORT} --httpd-port ${DEFAULT_HTTPD_PORT} --server-ip ${DEFAULT_SERVER_IP} \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/apt/archives/*
COPY utilities/ .
RUN apt-get update && apt-get -y install wget \
&& wget ${URL_MAPGUIDE_RUN}
RUN chmod +x mapguideopensource-4.0.0.9740-ubuntu16-install.run && apt-get update \
&& ./mapguideopensource-4.0.0.9740-ubuntu16-install.run --noexec --nox11 --target . && apt-get update \
&& ./install-with-rdbms.sh --headless --with-rdbms --no-service-install --no-mgserver-start \
--no-tomcat-start --no-httpd-start --with-sdf --with-shp --with-sqlite --with-gdal \
--with-ogr --with-wfs \
&& apt-get install unzip -y \
&& mkdir /usr/share/fonts/truetype/msttcorefonts && unzip msttcorefonts.zip -d /usr/share/fonts/truetype/msttcorefonts \
&& apt-get remove unzip -y \
&& apt-get install openjdk-8-jdk -y

WORKDIR ${MG_PATH}

# UPDATING CONFIGURATION FILES
# SETTING UP PERMISSION
RUN chmod 777 webserverextensions/www/TempDir
RUN sed -i 's/AJP\/1\.3/HTTP\/1\.1/g' webserverextensions/tomcat/conf/server.xml
RUN chmod a+rw ${MG_PATH}/webserverextensions/www/fusion/lib/tcpdf/cache/

#REMOVE TEMP FILES
RUN rm -rf ${TEMPDIR}

# Log Files
RUN ln -sf /dev/stdout ${MGLOG_PATH}/{Access,Admin,Authentication}.log; \
ln -sf /dev/stderr ${MGLOG_PATH}/Error.log; \
ln -sf /dev/stdout ${MGAPACHE_LOG}/{access_,mod_jk.}log; \
ln -sf /dev/stderr ${MGAPACHE_LOG}/error_log

COPY ./entrypoint.sh /
RUN chmod a+x /entrypoint.sh; \
chmod a+rw ${MG_PATH}/webserverextensions/www/fusion/lib/tcpdf/cache/
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

EXPOSE 2810 2811 2812 8008 8009
EXPOSE 8008 2810 2811 2812 8080 8000

ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
Mapguide Open Source
===
#### Versions
# Mapguide Open Source

brucepc/mapguide:latest
## Versions

brucepc/mapguide:latest
[![](https://images.microbadger.com/badges/image/brucepc/mapguide.svg)](https://microbadger.com/images/brucepc/mapguide "Get your own image badge on microbadger.com")

brucepc/mapguide:2.6
brucepc/mapguide:2.6
[![](https://images.microbadger.com/badges/image/brucepc/mapguide:2.6.svg)](https://microbadger.com/images/brucepc/mapguide:2.6 "Get your own image badge on microbadger.com")

How to use
===
## How to use

```bash
docker pull brucepc/mapguide:[version]
docker run -ti -d brucepc/mapguide:[version]
```
Entrypoint params
===
+ --no-tomcat ``doesn't start tomcat server``
+ --no-apache ``doesn't start the apache server``

## Entrypoint params

+ --no-tomcat ``doesn't start tomcat server``
+ --no-apache ``doesn't start the apache server``
+ --only-mapguide ``start only mapguide server``
+ --crash-time ``time to start mapguide after crash``
+ --reset-password ``reset admin password``
+ --no-setup-log-link ``doesn't setup link for log files``

```bash
docker run -ti brucepc/mapguide --no-tomcat
```
Exposed ports
===

## Exposed ports

+ 8008 Apache server
+ 8009 Tomcat server

Need help ???
===
## Need help ???

[![Join the chat at https://gitter.im/mapguide-container](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gitterHQ/gitter)
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3'
services:
mapguide:
build: .
image: mg:4.0.0.9740
container_name: mapguide
volumes:
- "mapguide4:/usr/local/mapguideopensource-4.0.0/server/Repositories/Library"
ports:
- "8008:8008"
- "8009:8009"

volumes:
mapguide4:
47 changes: 42 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ set -e

export PATH=${MG_PATH}/server/bin:$PATH
export MENTOR_DICTIONARY_PATH=${MG_PATH}/share/gis/coordsys
export LD_LIBRARY_PATH=/usr/local/fdo-${FDOVER}/lib:"$LD_LIBRARY_PATH"
export NLSPATH=/usr/local/fdo-${FDOVER}/nls/%N:"$NLSPATH"
export LD_LIBRARY_PATH=/usr/local/fdo-${FDOVER_MAJOR_MINOR_REV}/lib64:${MG_PATH}/webserverextensions/lib64:${MG_PATH}/lib64:${MG_PATH}/server/lib64:$LD_LIBRARY_PATH
export NLSPATH=/usr/local/fdo-${FDOVER_MAJOR_MINOR_REV}/nls/%N:"$NLSPATH"
mkdir -p /var/lock/mgserver
ln -sf ${MG_PATH}/server/bin/mapguidectl /usr/local/bin/mapguidectl

SLEEPTIME=1
NO_APACHE=0
NO_TOMCAT=0
RESET_PASSWORD=0
NO_SETUP_LOG_LINK=0
MG_PIDFILE=/var/run/mapguide.pid

start_apache(){
Expand All @@ -32,6 +34,22 @@ start_mg(){
$MG_PATH/server/bin/mapguidectl status | perl -pe 's/\D//g' | tee $MG_PIDFILE
}

setup_admin_password() {
cd ${MG_PATH}/server/bin
./mgserver setpwd ${ADMIN_USER} ${ADMIN_PASSWORD}
}

#SETUP LINK FOR LOG
setup_log_link() {
for log_file in Access Admin Authentication; do
ln -sf /dev/stdout "${MGLOG_PATH}/${log_file}.log"
done
ln -sf /dev/stderr ${MGLOG_PATH}/Error.log
ln -sf /dev/stdout ${MGAPACHE_LOG}/access_log &
ln -sf /dev/stdout ${MGAPACHE_LOG}/mod_jk.log
ln -sf /dev/stderr ${MGAPACHE_LOG}/error_log
}

stop_all(){
if [ $NO_APACHE -eq 0 ]; then
echo "Stopping Apache server..."
Expand All @@ -50,12 +68,15 @@ stop_all(){
./mapguidectl stop
}

print_help(){
print_help() {
echo "Help: "
echo ""
echo ""
echo "--stop-all\t\tstop all the service"
echo "--only-mapguide\t\tstart only mapguide server"
echo "--no-apache\t\tdon't start apache server"
echo "--no-tomcat\t\tdon't start tomcat server"
echo "--reset-password\t\treset admin password"
echo "--no-setup-log-link\t\tdon't setup link for log files"
echo "--crash-time\t1\tSeconds to sleep before restart, after crash"
echo "--help show this help"
}
Expand All @@ -79,6 +100,14 @@ while test $# -gt 0; do
shift
NO_TOMCAT=1
;;
--reset-password)
shift
RESET_PASSWORD=1
;;
--no-setup-log-link)
shift
NO_SETUP_LOG_LINK=1
;;
--crash-time)
shift
if ! [ $1 =~'^[0-9]+$' ];then
Expand All @@ -100,6 +129,14 @@ trap stop_all SIGINT SIGTERM

start_mg

if [ $RESET_PASSWORD -eq 1 ]; then
setup_admin_password
fi

if [ $NO_SETUP_LOG_LINK -eq 0 ]; then
setup_log_link
fi

if [ $NO_APACHE -eq 0 ]; then
start_apache
fi
Expand All @@ -112,7 +149,7 @@ while true; do
sleep $SLEEPTIME
pid=$(cat ${MG_PIDFILE})
if [ ! -e /proc/$pid -a /proc/$pid/exe ]; then
echo "Mapguide foi parado inesperadamente e sera reiniciando..."
echo "Mapguide was stopped unexpectedly and will be restarting..."
start_mg
fi
done
Loading