Skip to content

Instantly share code, notes, and snippets.

@francbartoli
Forked from ict4eo/docker_geonode
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francbartoli/0cd26caf1e72e2cacd4e to your computer and use it in GitHub Desktop.
Save francbartoli/0cd26caf1e72e2cacd4e to your computer and use it in GitHub Desktop.
# GeoNode / GeoServer install for Docker
# Save file as Dockerbuild; sudo docker build -t ubuntu/testgeo3 .
# VERSION 1.0.0
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-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=dhohls@csir.co.za --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