Last active
August 31, 2016 10:19
-
-
Save ict4eo/8401848 to your computer and use it in GitHub Desktop.
Dockerfile: geoserver+geonode+postgresql+52NSOS
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
# GeoNode / GeoServer install for Docker | |
# Save file as Dockerbuild; run sudo | |
# VERSION 0.0.1 | |
# TEST = 'foo' | |
FROM ubuntu | |
MAINTAINER Derek Hohls <dhohls@csir.co.za> | |
# make sure the package repository is up to date | |
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list | |
RUN apt-get update | |
# install core software | |
RUN apt-get install -y python-support python-dev python-virtualenv openjdk-6-jre tomcat7 postgresql-9.1 postgresql-contrib-9.1 gcc patch zip python-imaging gdal-bin libgeos-$ | |
# TEMP CHANGE | |
RUN apt-get install -y nano | |
# download code from github | |
RUN git clone https://github.com/GeoNode/geonode.git | |
# install support software | |
RUN apt-get install -y language-pack-en-base net-tools iputils-ping | |
# configure support software | |
RUN /bin/bash -c 'source /root/.bashrc; update-locale LANG=en_ZA.UTF-8 LC_MESSAGES=POSIX' | |
# remove any old geonode DB | |
RUN /bin/bash -c 'source /root/.bashrc; service postgresql restart; su - postgres -c "psql -U postgres -d postgres -c \"DROP DATABASE IF EXISTS geonode;\""' | |
# installs django etc. and downloads geoserver.war | |
RUN /bin/bash -c 'source /root/.bashrc; cd geonode; pip install -e .; paver setup' | |
# edit the Apache conf to prevent the error: | |
# Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName" | |
RUN /bin/bash -c 'source /root/.bashrc; sed -i "$ a\ServerName localhost" /etc/apache2/apache2.conf' | |
#NOW: http://docs.geonode.org/en/latest/tutorials/admin/install/complete_install.html | |
# configure to work with apache... | |
RUN /bin/bash -c 'source /root/.bashrc; service postgresql restart; cd geonode/package; ./install.sh support/config-ubuntu.sh' | |
RUN /bin/bash -c 'source /root/.bashrc; cd geonode; cp downloaded/geoserver.war /var/lib/tomcat7/webapps' | |
# create the IP address to your address | |
#RUN /bin/bash -c 'source /root/.bashrc; sed -i 's/\/usr\/share\/geoserver\/data\//\/geonode\/geoserver\/geoserver\/data\//g' /usr/sbin/geonode-updateip cd geonode; geonode-$ | |
# show existing roles | |
RUN /bin/bash -c 'source /root/.bashrc; service postgresql restart; su - postgres -c "psql -U postgres -d postgres -c \"select rolname from pg_roles;\""' | |
# update geonode password (NB must be wrapped in single quotes) in PG and GeoNode | |
RUN /bin/bash -c 'source /root/.bashrc; service postgresql restart; GEOPASS="'\''geonode'\''"; su - postgres -c "psql -U postgres -d postgres -c \"alter user geonode with pa$ | |
# create geonode superuser | |
#RUN /bin/bash -c 'source /root/.bashrc; service postgresql restart; cd geonode; geonode createsuperuser --username=root --email=dhohls@csir.co.za --noinput' | |
# ================================================================== | |
# SOS Install | |
# ================================================================== | |
# Fake a fuse install (https://github.com/dotcloud/docker/issues/514) | |
RUN apt-get -y install libfuse2 | |
RUN cd /tmp ; apt-get -y download fuse | |
RUN cd /tmp ; dpkg-deb -x fuse_* . | |
RUN cd /tmp ; dpkg-deb -e fuse_* | |
RUN cd /tmp ; rm fuse_*.deb | |
RUN cd /tmp ; echo -en '#!/bin/bash\nexit 0\n' > DEBIAN/postinst | |
RUN cd /tmp ; dpkg-deb -b . /fuse.deb | |
RUN cd /tmp ; dpkg -i /fuse.deb | |
# java | |
RUN apt-get -y install openjdk-7-jdk | |
# maven | |
RUN apt-get -y install maven | |
# maven config | |
RUN apt-get install -y wget | |
RUN /bin/bash -c 'source /root/.bashrc; cd /etc/maven; wget https://gist.github.com/ict4eo/8399932/raw/e537ce92c743fa85e5b575d87cc4356f1a469d53/profile.xml; sed -i "/ <pro$ | |
# get SOS files | |
RUN /bin/bash -c 'source /root/.bashrc; mkdir downloads; cd downloads; wget http://52north.org/downloads/sensor-web/sos/52n-sensorweb-sos-3-2-0/download -O 52N-SOS-3.2.0.zip; unzip 52N-SOS-3.$ | |
# setup database | |
RUN /bin/bash -c 'source /root/.bashrc; service postgresql restart; su - postgres -c "createuser -d -a -s smartgreen"; su - postgres -c "createdb -O smartgreen -E UTF8 -T template0 sosdb"; su$ | |
# alter owner of the tables | |
RUN /bin/bash -c 'source /root/.bashrc; SCHEMA="'public'"; service postgresql restart; su - postgres -c "for tbl in `psql -c \"select tablename from pg_tables where schemaname = $SCHEMA;\" so$ | |
# get WAR file | |
RUN /bin/bash -c 'source /root/.bashrc; cd downloads; wget http://52north.org/downloads/sensor-web/sos/52n-sensorweb-sos-3-2-0-binary/download -O 52N-SOS-3.2.0.binary.zip; unzip 52N-SOS-3.2.0$ | |
# create web app | |
RUN /bin/bash -c 'source /root/.bashrc; SOS="HOUSE_SOS"; cd /var/lib/tomcat7/webapps; mkdir $SOS; cd $SOS; unzip /downloads/52n-sensorweb-sos-3.2.0-binary/52nSOSv3_WAR.war' | |
# edit configuration | |
RUN /bin/bash -c 'source /root/.bashrc; cd /var/lib/tomcat7/webapps/HOUSE_SOS/WEB-INF/conf; sed -i "s/CONNECTIONSTRING=jdbc:postgresql:\/\/localhost:5432\/SosDatabase/CONNECTIONSTRING=jdbc:po$ | |
# edit service | |
RUN /bin/bash -c 'source /root/.bashrc; cd /var/lib/tomcat7/webapps/HOUSE_SOS/WEB-INF/conf/capabilities; sed -i "/<ows:Title>/d" serviceIdentification.xml; sed -i "/<ows:Abstract>/d" serviceI$ | |
# add provider | |
RUN /bin/bash -c 'source /root/.bashrc; cd /var/lib/tomcat7/webapps/HOUSE_SOS/WEB-INF/conf/capabilities; wget -N https://gist.github.com/ict4eo/8418656/raw/0ea1588390cf7f337711d756a91110c243c$ | |
# update address | |
RUN /bin/bash -c 'source /root/.bashrc; cd /var/lib/tomcat7/webapps/HOUSE_SOS/WEB-INF/; sed -i "s/http:\/\/localhost:8080/52nSOSv3\/sos/http:\/\/smartgreen.dhcp.meraka.csir.co.za:8080\/HOUSE_$ | |
# ================================================================== | |
# FINALLY! | |
# ================================================================== | |
# setup a start script | |
RUN /bin/bash -c 'source /root/.bashrc; touch startup.sh; echo "#!/bin/bash" >> startup.sh; echo "service apache2 restart" >> startup.sh; echo "service tomcat7 restart" >> s$ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment