Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create setup for datapackage developement #12

Merged
merged 17 commits into from
Jun 14, 2024
Merged
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
3 changes: 2 additions & 1 deletion .devcontainer/.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
# Docker sets placeholders using a pre-context (e.g. shell or the .env-file).
# However, placeholders in this file will be used when variables are missing.

DEBUG=True

# only use http in dev mode
HTTP_HOST=${SITE_HOST_NAME}
SITEURL="http://172.18.0.1:8001/"
# behinde the nginx
# behind the nginx
GEONODE_LB_HOST_IP="django"
GEONODE_LB_PORT="8001"

Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/_vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"configurations": [
{
"name": "Python: Django",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "./manage.py",
"args": [
Expand All @@ -15,7 +15,7 @@
},
{
"name": "Python: Celery",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "/usr/local/bin/celery",
"args": [
Expand All @@ -39,7 +39,7 @@
},
{
"name": "Django Test",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
Expand Down
11 changes: 3 additions & 8 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
version: '3.4'

services:
django:
env_file:
- .devcontainer/.env.local
restart: "no"
volumes:
#- ./.devcontainer/docker/geonode/custom_entrypoint.sh:/usr/src/geonode/custom_entrypoint.sh
#- ../geonode:/usr/src/geonode
- ./.devcontainer/_gitignore:/usr/src/geonode/.gitignore
- ./.devcontainer/_vscode:/usr/src/geonode/.vscode
ports:
- "8001:8001"
#command: /usr/src/geonode/custom_entrypoint.sh
command: sleep infinity

celery:
Expand All @@ -20,8 +17,6 @@ services:
restart: "no"
depends_on:
- django
# volumes:
# - './src:/usr/src/geonode'

geonode:
env_file:
Expand All @@ -36,7 +31,7 @@ services:
context: ./.devcontainer/docker/geoserver
dockerfile: Dockerfile
args:
- BASE_IMAGE_VERSION=${GEONODE_VERSION}
- BASE_IMAGE_VERSION=${GEOSERVER_BASE_IMAGE_VERSION}
environment:
- OAUTH2_CLIENT_ID=${OAUTH2_CLIENT_ID}
- OAUTH2_CLIENT_SECRET=${OAUTH2_CLIENT_SECRET}
Expand All @@ -48,6 +43,6 @@ services:
context: ./.devcontainer/docker/postgresql
dockerfile: Dockerfile
args:
- BASE_IMAGE_VERSION=${GEONODE_VERSION}
- BASE_IMAGE_VERSION=${POSTGRES_BASE_IMAGE_VERSION}
ports:
- "5432:5432"
2 changes: 1 addition & 1 deletion .devcontainer/docker/geoserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_IMAGE_VERSION
FROM 52north/geonode-geoserver:${BASE_IMAGE_VERSION}
FROM geonode/geoserver:${BASE_IMAGE_VERSION}

# ENV GEOSERVER_DATA_DIR="/geoserver_data/data"

Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/docker/postgresql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_IMAGE_VERSION
FROM 52north/geonode-postgis:${BASE_IMAGE_VERSION}
FROM geonode/postgis:${BASE_IMAGE_VERSION}

COPY ./prepare-testdb.sh /docker-entrypoint-initdb.d/prepare-testdb.sh
RUN chmod +x /docker-entrypoint-initdb.d/prepare-testdb.sh
7 changes: 4 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "geonode/externalapplications"]
path = geonode/apps/externalapplications
url = https://github.com/GeoNodeUserGroup-DE/contrib_externalapplications.git
[submodule "docker/geonode/geonode-mapstore-client"]
path = docker/geonode/geonode-mapstore-client
url = https://github.com/GeoNodeUserGroup-DE/geonode-mapstore-client/
branch = datapackage_tabular-data
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ All needed components are available as [Docker](https://www.docker.com/) images
The whole setup is based on the [Docker Blueprint for a GeoNode Installation](https://github.com/GeoNodeUserGroup-DE/geonode-blueprint-docker).
The blueprint is an opnionated GeoNode setup, but helps to keep everything necessary in one place to develop the datapackage feature which adds changes on multiple repositories:

- https://github.com/GeoNodeUserGroup-DE/geonode/
- [GeoNodeUserGroup-DE/geonode/](https://github.com/GeoNodeUserGroup-DE/geonode/tree/datapackage_tabular-data) (branch `datapackage_tabular-data`)
- [GeoNodeUserGroup-DE/geonode-mapstore-client/](https://github.com/GeoNodeUserGroup-DE/geonode-mapstore-client/tree/datapackage_tabular-data) (Branch `datapackage_tabular-data`)
- https://github.com/GeoNodeUserGroup-DE/geonode-importer/
- https://github.com/GeoNodeUserGroup-DE/geonode-mapstore-client/
- https://github.com/GeoNodeUserGroup-DE/importer-datapackage/

Under `./.devcontainer` you find a configuration to run and debug the project as [`devcontainer`](https://containers.dev/).
Expand All @@ -22,11 +22,11 @@ For detailed background information about the genesis of the blueprint and how t

Make sure you have installed `git`, `Docker` and `docker compose`.

Clone the [repository containing a GeoNode Docker setup]( https://github.com/GeoNodeUserGroup-DE/geonode-blueprint-docker) and change directory your local working copy:
Clone the [repository containing a GeoNode Docker setup]( https://github.com/GeoNodeUserGroup-DE/geonode-dev-datapackage) and change directory your local working copy:

```
git clone --recurse-submodules https://github.com/GeoNodeUserGroup-DE/geonode-blueprint-docker geonode
cd geonode
git clone --recurse-submodules https://github.com/GeoNodeUserGroup-DE/geonode-dev-datapackage geonode-dev-datapackage
cd geonode-dev-datapackage
```

## Configuration
Expand All @@ -35,7 +35,7 @@ cd geonode
>
> Settings (e.g. geodatabase parameters) are mainly configured in the `.env` file.
> To review in-built default settings of an image, run the `env` command on an image.
> For example `docker run 52north/geonode-geoserver env | sort`.
> For example `docker run geonode/geoserver env | sort`.
>
> For a complete set of available options take the [GeoNode Settings](https://docs.geonode.org/en/master/basic/settings/index.html#settings) documentation as a reference.

Expand Down
14 changes: 6 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
version: '3.4'

# Common Django template for GeoNode and Celery services below
x-common-django:
&default-common-django
image: ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}${COMPOSE_PROJECT_NAME}_django:${GEONODE_VERSION}-${PROJECT_VERSION}
image: ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}${COMPOSE_PROJECT_NAME}_django:${GEONODE_BASE_IMAGE_VERSION}-${PROJECT_VERSION}
build:
context: ./docker/geonode
dockerfile: Dockerfile
args:
- BASE_IMAGE_VERSION=${GEONODE_VERSION}
- BASE_IMAGE_VERSION=${GEONODE_BASE_IMAGE_VERSION}
restart: no
env_file:
- .env
Expand Down Expand Up @@ -71,7 +69,7 @@ services:
context: ./docker/nginx
dockerfile: Dockerfile
args:
- BASE_IMAGE_VERSION=${GEONODE_VERSION}
- BASE_IMAGE_VERSION=${NGINX_BASE_IMAGE_VERSION}
container_name: nginx4${COMPOSE_PROJECT_NAME}
env_file: ./.env
environment:
Expand Down Expand Up @@ -99,7 +97,7 @@ services:
context: ./docker/geoserver
dockerfile: Dockerfile
args:
- BASE_IMAGE_VERSION=${GEONODE_VERSION}
- BASE_IMAGE_VERSION=${GEOSERVER_BASE_IMAGE_VERSION}
container_name: geoserver4${COMPOSE_PROJECT_NAME}
env_file: ./.env
healthcheck:
Expand Down Expand Up @@ -128,7 +126,7 @@ services:
context: ./docker/geoserver_data
dockerfile: Dockerfile
args:
- BASE_IMAGE_VERSION=${GEONODE_VERSION}
- BASE_IMAGE_VERSION=${GEOSERVER_DATA_BASE_IMAGE_VERSION}
container_name: gsconf4${COMPOSE_PROJECT_NAME}
entrypoint: sleep infinity
volumes:
Expand All @@ -145,7 +143,7 @@ services:
context: ./docker/postgresql
dockerfile: Dockerfile
args:
- BASE_IMAGE_VERSION=${GEONODE_VERSION}
- BASE_IMAGE_VERSION=${POSTGRES_BASE_IMAGE_VERSION}
command: postgres -c "max_connections=${POSTGRES_MAX_CONNECTIONS}"
container_name: db4${COMPOSE_PROJECT_NAME}
env_file: ./.env
Expand Down
13 changes: 11 additions & 2 deletions docker/geonode/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
ARG BASE_IMAGE_VERSION
FROM 52north/geonode:${BASE_IMAGE_VERSION}
FROM geonode/geonode:${BASE_IMAGE_VERSION}

# we override geonode from base image here
# FIXME a submodule fails to build (error -> cannot replace directory .git to file)
RUN git remote add usergroup https://github.com/GeoNodeUserGroup-DE/geonode.git \
&& git fetch usergroup \
&& git stash save \
&& git switch datapackage_tabular-data \
&& git stash pop

COPY ./requirements.txt /usr/src/more_requirements.txt
RUN yes w | pip install --src /usr/src -r /usr/src/more_requirements.txt

#RUN rm .env*
COPY ./geonode-mapstore-client /usr/src/django_geonode_mapstore_client_dev
RUN yes w | pip install -e /usr/src/django_geonode_mapstore_client_dev
1 change: 1 addition & 0 deletions docker/geonode/geonode-mapstore-client
1 change: 1 addition & 0 deletions docker/geonode/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-e git+https://github.com/GeoNodeUserGroup-DE/importer-datapackage.git@7_support-geonode-430#egg=importer_datapackage
2 changes: 1 addition & 1 deletion docker/geoserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_IMAGE_VERSION
FROM 52north/geonode-geoserver:${BASE_IMAGE_VERSION}
FROM geonode/geoserver:${BASE_IMAGE_VERSION}

## GeoServer plugins
#
Expand Down
2 changes: 1 addition & 1 deletion docker/geoserver_data/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_IMAGE_VERSION
FROM 52north/geonode-geoserver_data:${BASE_IMAGE_VERSION}
FROM geonode/geoserver_data:${BASE_IMAGE_VERSION}

# configure logging
RUN sed 's|<stdOutLogging>false</stdOutLogging>|<stdOutLogging>true</stdOutLogging>|' -i "/geoserver_data/data/logging.xml"
2 changes: 1 addition & 1 deletion docker/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_IMAGE_VERSION
FROM 52north/geonode-nginx:${BASE_IMAGE_VERSION}
FROM geonode/nginx:${BASE_IMAGE_VERSION}

COPY ./cert.pem /geonode-certificates/autoissued/fullchain.pem
COPY ./key.pem /geonode-certificates/autoissued/privkey.pem
Expand Down
2 changes: 1 addition & 1 deletion docker/postgresql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ARG BASE_IMAGE_VERSION
FROM 52north/geonode-postgis:${BASE_IMAGE_VERSION}
FROM geonode/postgis:${BASE_IMAGE_VERSION}
32 changes: 0 additions & 32 deletions geonode/apps/customizations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,32 +0,0 @@
import os
from django.apps import AppConfig


def run_setup_hooks(*args, **kwargs):
from django.conf import settings
from django.conf.urls import url
from django.views.generic import TemplateView
from geonode.urls import urlpatterns

LOCAL_ROOT = os.path.abspath(os.path.dirname(__file__))
template_dir = os.path.join(LOCAL_ROOT, "templates")
settings.TEMPLATES[0]["DIRS"].insert(0, template_dir)

urlpatterns += [
url(r'^legal_notice/$',
TemplateView.as_view(template_name='legal-notice.html'),
name='legal-notice'),
url(r'^accessibility/$',
TemplateView.as_view(template_name='accessibility.html'),
name='accessibility'),
]


class CustomizationsAppConfig(AppConfig):
name = 'customizations'

def ready(self):
super().ready()
run_setup_hooks()

default_app_config = 'customizations.CustomizationsAppConfig'
32 changes: 32 additions & 0 deletions geonode/apps/customizations/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os
from django.apps import AppConfig


def run_setup_hooks(*args, **kwargs):
from django.conf import settings
from django.urls import re_path
from django.views.generic import TemplateView
from geonode.urls import urlpatterns

LOCAL_ROOT = os.path.abspath(os.path.dirname(__file__))
template_dir = os.path.join(LOCAL_ROOT, "templates")
settings.TEMPLATES[0]["DIRS"].insert(0, template_dir)

urlpatterns += [
re_path(r'^legal_notice/$',
TemplateView.as_view(template_name='legal-notice.html'),
name='legal-notice'),
re_path(r'^accessibility/$',
TemplateView.as_view(template_name='accessibility.html'),
name='accessibility'),
]


class CustomizationsAppConfig(AppConfig):
name = 'customizations'

def ready(self):
super().ready()
run_setup_hooks()

default_app_config = 'customizations.CustomizationsAppConfig'
Loading