Created
January 8, 2014 12:32
-
-
Save ict4eo/8316151 to your computer and use it in GitHub Desktop.
Docker install script for GeoServer/GeoNode
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; sudo docker build -t ubuntu/testgeo3 . | |
# VERSION 1.0.0 | |
FROM ubuntu | |
MAINTAINER Derek Hohls <[email protected]> | |
# 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-dev python-urlgrabber python-pastescript gettext postgresql-contrib postgresql-9.1-postgis libpq-dev unzip libjpeg-dev libpng-dev python-gdal libproj-dev python-psycopg2 apache2 libapache2-mod-wsgi git-core gettext libxml2-dev libxslt-dev links | |
# 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 nano | |
# configure support software | |
RUN /bin/bash -c 'source /root/.bashrc; update-locale LANG=en_ZA.UTF-8 LC_MESSAGES=POSIX' | |
# installs django etc. and downloads geoserver.war | |
RUN /bin/bash -c 'source /root/.bashrc; cd geonode; sudo pip install -e .; sudo paver setup' | |
# setup geoserver | |
RUN /bin/bash -c 'source /root/.bashrc; cd geonode; sudo paver setup' | |
# setup a run script | |
RUN touch rungeo.sh | |
RUN echo "cd geonode" >> rungeo.sh | |
RUN echo "paver start" >> rungeo.sh | |
RUN chmod +x rungeo.sh | |
# 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' | |
#SEE: http://docs.geonode.org/en/latest/tutorials/admin/install/complete_install.html | |
# configure to work with apache | |
#RUN /bin/bash -c 'source /root/.bashrc; cd geonode; sed -i 's\GEONODE_SHARE=$TARGET_ROOT\/usr\/share\/geonode\GEONODE_SHARE=$TARGET_ROOT\/genonode\g' package/support/config-ubuntu.sh' | |
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; service postgresql restart; sed -i 's/\/usr\/share\/geoserver\/data\//\/geonode\/geoserver\/geoserver\/data\//g' /usr/sbin/geonode-updateip cd geonode; geonode-updateip 0.0.0.0' | |
# 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 password $GEOPASS;\""; cd geonode/geonode; sed -i "s/DATABASE_PASSWORD =/DATABASE_PASSWORD_OLD =/g" local_settings.py; sed -i "/DATABASE_PASSWORD_OLD/ a\DATABASE_PASSWORD = $GEOPASS" local_settings.py' | |
# create geonode superuser | |
RUN /bin/bash -c 'source /root/.bashrc; service postgresql restart; cd geonode; geonode createsuperuser --username=root [email protected] --noinput' | |
# 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" >> startup.sh; echo "service postgresql restart" >> startup.sh; echo "while true; do" >> startup.sh; echo "sleep 15m" >> startup.sh; echo "done" >> startup.sh;' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script assumes that you are using the Dockerfile script above, and storing it in the root of your VM. If not in root, then replace the '.' with the absolute path to the Dockerfile. Examples of such scripts are at http://docs.docker.io/en/latest/use/builder/#dockerbuilder