Skip to content

Commit

Permalink
Update docker image to Python 3.10, Geonode to 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Coop56 committed Oct 3, 2022
1 parent de328ff commit c305097
Show file tree
Hide file tree
Showing 39 changed files with 8,563 additions and 1,399 deletions.
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
path = deps/django-mailer
url = https://github.com/pinax/django-mailer.git
branch = master
[submodule "deps/django-osgeo-importer"]
path = deps/django-osgeo-importer
url = https://github.com/GeoNode/django-osgeo-importer.git
branch = angular-1.6.5
[submodule "deps/django-maploom"]
path = deps/django-maploom
url = https://github.com/MapStory/django-maploom.git
Expand Down
54 changes: 37 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8.11
FROM python:3.10.2-buster

ENV MEDIA_ROOT /var/lib/mapstory/media
ENV STATIC_ROOT /var/lib/mapstory/static
Expand Down Expand Up @@ -26,12 +26,42 @@ RUN set -ex \
unzip \
&& rm -rf /var/lib/apt/lists/*

# Install WSGI server and python tools
# To get GDAL 3.2.1 to fix this issue https://github.com/OSGeo/gdal/issues/1692
# TODO: The following line should be removed if base image upgraded to Bullseye
RUN echo "deb http://deb.debian.org/debian/ bullseye main contrib non-free" | tee /etc/apt/sources.list.d/debian.list

# This section is borrowed from the official Django image but adds GDAL and others
RUN apt-get update -y && apt-get upgrade -y

# Prepraing dependencies
RUN apt-get install -y \
libgdal-dev libpq-dev libxml2-dev \
libxml2 libxslt1-dev zlib1g-dev libjpeg-dev \
libmemcached-dev libldap2-dev libsasl2-dev libffi-dev

RUN apt-get install -y --no-install-recommends \
gcc zip gettext geoip-bin cron \
postgresql-client-13 \
sqlite3 spatialite-bin libsqlite3-mod-spatialite \
python3-all-dev python3-dev \
python3-gdal python3-psycopg2 python3-ldap \
python3-pip python3-pil python3-lxml python3-pylibmc \
uwsgi uwsgi-plugin-python3 \
firefox-esr

RUN apt-get install -y devscripts build-essential debhelper pkg-kde-tools sharutils
# RUN git clone https://salsa.debian.org/debian-gis-team/proj.git /tmp/proj
# RUN cd /tmp/proj && debuild -i -us -uc -b && dpkg -i ../*.deb

# Install pip packages
RUN pip3 install uwsgi \
&& pip install pip --upgrade \
&& pip install pygdal==$(gdal-config --version).* flower==0.9.4

# Install python tools
RUN set -ex \
&& pip install --no-cache-dir \
coveralls \
gunicorn \
paver \
pycodestyle \
pylint \
pylint-django \
Expand All @@ -48,15 +78,6 @@ RUN set -ex \
libspatialite-dev \
&& rm -rf /var/lib/apt/lists/*

# Install phantomjs
ENV QT_QPA_PLATFORM minimal
RUN set -ex \
&& echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
phantomjs \
&& rm -rf /var/lib/apt/lists/*

# Install Node and related tools
RUN set -ex \
&& curl -sL https://deb.nodesource.com/setup_lts.x | /bin/bash - \
Expand Down Expand Up @@ -89,10 +110,10 @@ COPY --chown=mapstory:mapstory deps ./deps
# Install dependencies from requirements.txt
COPY --chown=mapstory:mapstory requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY epsg_extra /usr/local/lib/python3.8/dist-packages/pyproj/data/
COPY epsg_extra /usr/local/lib/python3.10/dist-packages/pyproj/data/
# The httplib2 python library uses its own CA certificates.
# Add the system and self-signed CAs.
RUN cat /etc/ssl/certs/ca-certificates.crt >> /usr/local/lib/python3.8/site-packages/httplib2/cacerts.txt
RUN cat /etc/ssl/certs/ca-certificates.crt >> /usr/local/lib/python3.10/site-packages/httplib2/cacerts.txt

# Copy in the code
COPY --chown=mapstory:mapstory mapstory ./mapstory
Expand All @@ -112,8 +133,7 @@ WORKDIR $APP_PATH/mapstory/static
RUN set -ex \
&& /opt/run.sh --collect-static \
&& yarn cache clean \
&& rm -rf ~/.cache/bower \
&& rm -rf /tmp/phantomjs
&& rm -rf ~/.cache/bower

WORKDIR $APP_PATH
VOLUME $STATIC_ROOT
Expand Down
2 changes: 1 addition & 1 deletion deps/django-mailer
Submodule django-mailer updated 46 files
+1 −0 .gitattributes
+100 −0 .github/workflows/build.yml
+0 −37 .travis.yml
+3 −0 AUTHORS
+87 −2 CHANGES.rst
+1 −1 CONTRIBUTING.rst
+9 −7 MANIFEST.in
+53 −19 README.rst
+6 −6 RELEASE.rst
+109 −44 docs/usage.rst
+0 −15 mailer/backend.py
+0 −201 mailer/engine.py
+0 −16 mailer/management/commands/purge_mail_log.py
+0 −78 mailer/south_migrations/0001_initial.py
+0 −52 mailer/south_migrations/0002_auto__chg_field_dontsendentry_to_address.py
+0 −0 mailer/south_migrations/__init__.py
+12 −0 release.sh
+2 −0 requirements-dev.txt
+2 −0 requirements-test.txt
+11 −23 runtests.py
+7 −0 setup.cfg
+19 −6 setup.py
+28 −25 src/mailer/__init__.py
+0 −0 src/mailer/admin.py
+6 −0 src/mailer/apps.py
+19 −0 src/mailer/backend.py
+275 −0 src/mailer/engine.py
+44 −0 src/mailer/locale/ja/LC_MESSAGES/django.po
+0 −0 src/mailer/locale/ru/LC_MESSAGES/django.po
+0 −0 src/mailer/management/__init__.py
+0 −0 src/mailer/management/commands/__init__.py
+28 −0 src/mailer/management/commands/purge_mail_log.py
+8 −7 src/mailer/management/commands/retry_deferred.py
+17 −0 src/mailer/management/commands/runmailer.py
+8 −7 src/mailer/management/commands/send_mail.py
+0 −0 src/mailer/management/helpers.py
+0 −0 src/mailer/migrations/0001_initial.py
+0 −0 src/mailer/migrations/0002_auto_20150720_1433.py
+0 −0 src/mailer/migrations/0003_messagelog_message_id.py
+28 −0 src/mailer/migrations/0004_auto_20190920_1512.py
+28 −0 src/mailer/migrations/0005_id_bigautofield.py
+0 −0 src/mailer/migrations/__init__.py
+51 −36 src/mailer/models.py
+31 −0 tests/__init__.py
+129 −96 tests/test_mailer.py
+31 −31 tox.ini
1 change: 0 additions & 1 deletion deps/django-osgeo-importer
Submodule django-osgeo-importer deleted from 4e1fe4
2 changes: 1 addition & 1 deletion deps/geonode
Submodule geonode updated 1358 files
4 changes: 2 additions & 2 deletions mapstory/activities/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.urls import reverse
from django.test import TestCase

from geonode.maps.models import Layer
from geonode.maps.models import Dataset
from geonode.people.models import Profile
from icon_commons.models import Collection, Icon
from mapstory.tests import utils as test_utils
Expand Down Expand Up @@ -64,7 +64,7 @@ def setUp(self):

def test_user_actions_stream(self):
# Register the things
registry.register(Layer)
registry.register(Dataset)
registry.register(Comment)
registry.register(Profile)

Expand Down
10 changes: 5 additions & 5 deletions mapstory/admin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django import forms
from django.contrib import admin

from geonode.layers.admin import LayerAdmin
from geonode.layers.models import Layer
from geonode.layers.admin import DatasetAdmin
from geonode.layers.models import Dataset
from geonode.people.admin import ProfileAdmin as UserAdmin
from mapstory.export import export_via_model
from mapstory.flag import admin as flag_admin
Expand Down Expand Up @@ -146,7 +146,7 @@ class MapStoryAdmin(admin.ModelAdmin):
list_filter = ('featured', )


class ExtendedLayerAdmin(LayerAdmin):
class ExtendedDatasetAdmin(DatasetAdmin):
list_display_links = ('id',)
list_display = (
'id',
Expand Down Expand Up @@ -177,8 +177,8 @@ def has_add_permission(self, request, obj=None):
model = BaselayerDefault


admin.site.unregister(Layer)
admin.site.register(Layer, ExtendedLayerAdmin)
admin.site.unregister(Dataset)
admin.site.register(Dataset, ExtendedDatasetAdmin)
admin.site.register(MapStory, MapStoryAdmin)
admin.site.register(GetPage, GetPageAdmin)
admin.site.register(GetPageContent, GetPageContentAdmin)
Expand Down
2 changes: 1 addition & 1 deletion mapstory/api/resourcebase_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from geonode.api.authorization import GeoNodeAuthorization
from geonode.base.models import ResourceBase
from geonode.documents.models import Document
from geonode.layers.models import Layer
from geonode.layers.models import Dataset
from mapstory.mapstories.models import Map, MapStory

if settings.HAYSTACK_SEARCH:
Expand Down
2 changes: 1 addition & 1 deletion mapstory/audit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from geonode.base.models import ContactRole
from geonode.documents.models import Document
from geonode.layers.models import Layer
from geonode.layers.models import Dataset
from geonode.maps.models import Map

from .settings import AUDIT_LOGFILE_LOCATION
Expand Down
2 changes: 1 addition & 1 deletion mapstory/context_processors_favorite.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re

from geonode.layers.models import Layer
from geonode.layers.models import Dataset
from geonode.favorite.utils import \
get_favorite_info as geonode_get_favorite_info
from mapstory.mapstories.models import Map, MapStory
Expand Down
2 changes: 1 addition & 1 deletion mapstory/flag/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.test import Client

from geonode.base.models import TopicCategory
from geonode.layers.models import Layer
from geonode.layers.models import Dataset
from mapstory.mapstories.models import Map
from mapstory.tests.MapStoryTestMixin import MapStoryTestMixin
from mapstory.tests.populate_test_data import create_models
Expand Down
57 changes: 0 additions & 57 deletions mapstory/import_handlers.py

This file was deleted.

139 changes: 0 additions & 139 deletions mapstory/importers.py

This file was deleted.

Loading

0 comments on commit c305097

Please sign in to comment.