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

Deduplicates code by using composite action #736

Closed
wants to merge 70 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
530a44e
Honor DB username as set in env file (#11522)
etj Sep 22, 2023
20f8ec5
Bump django-filter from 23.2 to 23.3 (#11503)
dependabot[bot] Sep 25, 2023
101b89b
Bump django-grappelli from 3.0.7 to 3.0.8 (#11529)
dependabot[bot] Sep 25, 2023
10b936a
Bump drf-spectacular from 0.26.4 to 0.26.5 (#11525)
dependabot[bot] Sep 25, 2023
7775303
Bump google-cloud-storage from 2.10.0 to 2.11.0 (#11524)
dependabot[bot] Sep 25, 2023
64555c5
Bump jsonschema from 4.19.0 to 4.19.1 (#11527)
dependabot[bot] Sep 25, 2023
da1939d
Update numpy requirement from ==1.25.* to ==1.26.* (#11501)
dependabot[bot] Sep 25, 2023
b74e96e
Bump pathvalidate from 3.1.0 to 3.2.0 (#11504)
dependabot[bot] Sep 25, 2023
c36e976
Bump webdriver-manager from 4.0.0 to 4.0.1 (#11530)
dependabot[bot] Sep 25, 2023
401d4a5
Bump sqlalchemy from 2.0.20 to 2.0.21 (#11526)
dependabot[bot] Sep 25, 2023
5422fd3
Bump pillow from 10.0.0 to 10.0.1 (#11505)
dependabot[bot] Sep 25, 2023
ae6a48a
Bump boto3 from 1.28.46 to 1.28.53 (#11528)
dependabot[bot] Sep 25, 2023
a9afe17
Dehydrate organization field (#11498)
fvicent Sep 25, 2023
0248da5
Revert to Ubuntu 22.04 LTS (#11531)
giohappy Sep 26, 2023
6cd67df
[Fixes #11535] Return category description in API response (#11536)
giohappy Sep 27, 2023
bba8ceb
[Fixes #11533] Remote resources created by harvesters do not have rem…
giohappy Sep 28, 2023
8bc6132
Bump pymupdf from 1.22.5 to 1.23.1 (#11412)
dependabot[bot] Sep 28, 2023
93aa610
Bump pymupdf from 1.23.1 to 1.23.4 (#11540)
dependabot[bot] Sep 28, 2023
616645c
Test fix CircleCi test (#11560)
mattiagiupponi Oct 5, 2023
2ef2a50
Bump boto3 from 1.28.53 to 1.28.56 (#11539)
dependabot[bot] Oct 5, 2023
980189c
Bump django-mptt from 0.14.0 to 0.15.0 (#11541)
dependabot[bot] Oct 5, 2023
0438ff3
Bump django-storages from 1.14 to 1.14.1 (#11547)
dependabot[bot] Oct 5, 2023
ec0429a
Bump psycopg2 from 2.9.7 to 2.9.8 (#11550)
dependabot[bot] Oct 5, 2023
9f88645
Bump mistune from 3.0.1 to 3.0.2 (#11549)
dependabot[bot] Oct 5, 2023
e65f4a4
[Fixes #11554] Implement WMTS backgrounds for thumbnails (only 3857 t…
giohappy Oct 5, 2023
8fbad2c
Bump ipython from 8.15.0 to 8.16.1 (#11561)
dependabot[bot] Oct 5, 2023
dd66c76
Bump psycopg2 from 2.9.7 to 2.9.9 (#11562)
dependabot[bot] Oct 5, 2023
38c2c39
fix: requirements.txt to reduce vulnerabilities (#11558)
afabiani Oct 5, 2023
24d34cd
[Snyk] Security upgrade django from 3.2.21 to 3.2.22 (#11563)
afabiani Oct 5, 2023
0f26dd3
adding hostname to celery state db (#11557)
mattiagiupponi Oct 5, 2023
10c39c5
Fix requires bucket name for AWS tests (#11564)
giohappy Oct 5, 2023
8913d8e
issue#11566_pre-commit_hook_black_isnt_working_on_Ubuntu_22_04_3 (#11…
mwallschlaeger Oct 6, 2023
fbee36c
[Fixes #11494] Implement relations between resources (#11565)
etj Oct 10, 2023
912f845
updated changelog
giohappy Jun 7, 2023
e022610
changelog and fixes for packaging (#11355)
giohappy Aug 8, 2023
d58070f
Init workflow file
ridoo Aug 9, 2023
915fd64
Add docker container registry workflow
ridoo Aug 10, 2023
7ec8347
Update meta tags in workflow
ridoo Aug 10, 2023
9117e8d
Add version tag 4.1
ridoo Aug 10, 2023
fae80c9
Add further images to build
ridoo Aug 10, 2023
a5c84a0
Fix geoserver's context path
ridoo Aug 10, 2023
41ce5b7
Add tags for mayor, minor, and bugfix version
ridoo Aug 11, 2023
537ac90
BUmp to 4.1.x (#11371)
giohappy Aug 11, 2023
dd53272
Update geonode version to 4.1.2
ridoo Aug 11, 2023
75859d8
Clean up versions metadata
ridoo Aug 15, 2023
ae6c474
Push core images to dedicated repos
ridoo Aug 15, 2023
9f65048
Push geonode image to 52north/geonode
ridoo Aug 15, 2023
065aa07
Upload a dockerhub description
ridoo Aug 17, 2023
77cd1cf
Update dockerhub description workflow config
ridoo Aug 17, 2023
dcbd060
Update 52n readme
ridoo Aug 17, 2023
650cbb1
Fix image repository config
ridoo Aug 17, 2023
57e1064
Fix workflow name
ridoo Aug 17, 2023
76539f8
Link to 52n fork on github
ridoo Aug 17, 2023
a592ddb
Add a note to version 3 tags
ridoo Aug 17, 2023
2ea3b29
Add a note to version 3 tags
ridoo Aug 17, 2023
2206371
Update dockerhub readme
ridoo Aug 17, 2023
605a873
Do not use commit SHA for labels
ridoo Sep 4, 2023
649085b
Separates 4.1.x and a release builds
ridoo Sep 13, 2023
44095c3
Cancel running builds
ridoo Sep 13, 2023
afba6aa
Trigger release build on tag having -52n suffix
ridoo Sep 13, 2023
a169074
Fix dockerhub secret refs
ridoo Sep 13, 2023
4a50a9c
Failing action tested successfully
ridoo Sep 13, 2023
952f0bb
Adds release build jobs for nginx and geoserver
ridoo Sep 13, 2023
ebddab7
Add missing image tags in meta step
ridoo Sep 13, 2023
ba23dcd
Build latest from master
ridoo Oct 12, 2023
8d471c8
Remove path exclusions
ridoo Oct 12, 2023
e8f27b5
Rename workflow build
ridoo Oct 13, 2023
c315d45
Rename workflow file
ridoo Oct 13, 2023
cf80dce
Release are built from dedicated branches
ridoo Oct 13, 2023
3e7fdd4
Deduplicates code by using composite action
ridoo Oct 30, 2023
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
85 changes: 85 additions & 0 deletions .github/actions/build_and_push/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Builds and pushes Docker image
description: Action to build and push images to docker


inputs:
dockerfile:
description: Path to the Dockerfile
default: ./Dockerfile
required: false
dockercontext:
description: Path to the Docker context
default: ./
required: false
# image coordinates
image:
description: Name of the image to build
required: true
tags:
description: Image Tag(s)
required: false
default: latest
# OCI metadata annotations
oci_title:
description: Image Title (OCI annotation)
required: true
oci_description:
description: Image Description (OCI annotation)
required: true
# registry credentials
registry_username:
description: The username for Docker hub sign-in
required: true
registry_password:
description: The password for Docker hub sign-in
required: true


runs:
using: "composite"
steps:
-
name: Checkout
uses: actions/checkout@v3
-
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- '${{ inputs.dockercontext }}/**'
# -
# name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# -
# name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v4
# with:
# images: ${{ inputs.image }}
# labels: |
# "org.opencontainers.image.vendor=52°North GmbH"
# "org.opencontainers.image.authors=https://52North.org/"
# "org.opencontainers.image.source=https://github.com/52North/geonode"
# "org.opencontainers.image.description=${{ inputs.oci_description }}"
# "org.opencontainers.image.title=${{ inputs.oci_title }}"
# "org.opencontainers.image.licenses=GPL-3.0"
# tags: |
# ${{ inputs.tags }}
# -
# name: Login to Docker registry
# uses: docker/login-action@v2
# with:
# username: ${{ inputs.registry_username }}
# password: ${{ inputs.registry_password }}
# -
# name: Build and push
# uses: docker/build-push-action@v4
# with:
# context: .
# file: ${{ inputs.dockerfile }}
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# cache-from: type=registry,ref=${{ inputs.image }}:buildcache
# cache-to: type=registry,ref=${{ inputs.image }}:buildcache,mode=max
71 changes: 71 additions & 0 deletions .github/workflows/52n-build-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: "[52n-master -> latest] Builds GeoNode Docker Images"

concurrency:
group: "geonode_build_master"
cancel-in-progress: true

env:
TAG: latest

on:
push:
branches:
- "52n-master"

jobs:
build_and_push_geonode:
runs-on: ubuntu-22.04
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: build and push geonode
uses: ./.github/actions/build_and_push
with:
image: 52north/geonode
tags: ${{ env.TAG }}
oci_title: "52°North GeoNode image"
oci_description: "GeoNode built from 52n fork"
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_TOKEN_52N_MASTER }}

build_and_push_nginx:
runs-on: ubuntu-22.04
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: build and push nginx
uses: ./.github/actions/build_and_push
with:
dockerfile: ./scripts/docker/nginx/Dockerfile
dockercontext: ./scripts/docker/nginx/
image: 52north/geonode-nginx
tags: ${{ env.TAG }}
oci_title: "52°North Nginx image for GeoNode"
oci_description: "Nginx built for GeoNode from a 52n fork"
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_TOKEN_52N_MASTER }}

build_and_push_geoserver:
runs-on: ubuntu-22.04
env:
IMAGE: 52north/geonode-geoserver
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: build and push geoserver
uses: ./.github/actions/build_and_push
with:
dockerfile: ./scripts/docker/geoserver/Dockerfile
dockercontext: ./scripts/docker/geoserver/
image: 52north/geonode-geoserver
tags: ${{ env.TAG }}
oci_title: "52°North GeoServer image for GeoNode"
oci_description: "GeoServer built for GeoNode from a 52n fork"
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_TOKEN_52N_MASTER }}
23 changes: 23 additions & 0 deletions .github/workflows/dockerhub-description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Update Docker Hub Description
on:
push:
branches:
- 52n-master
paths:
- README_52n.md
- .github/workflows/dockerhub-description.yml
jobs:
dockerHubDescription:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN_52N_MASTER }}
repository: 52north/geonode
short-description: "Geospatial content management system"
readme-filepath: ./README_52n.md
enable-url-completion: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ scripts/spcgeonode/_volume_*
!hooks/*

.env

.secret
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ repos:
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 23.9.1
hooks:
- id: black
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
# Change Log

## [4.1.2](https://github.com/GeoNode/geonode/tree/4.1.2) (2023-08-11)
## Bug Fixes
- Upgrade to importer 1.0.5 which fixes the import with filenames longer then 63 chars
- Fixed parsing and rendering of ISO TC211 spatial representetion type
## [4.1.1](https://github.com/GeoNode/geonode/tree/4.1.1) (2023-06-05)
## Security and Bug Fixes
- Upgrade to Ubuntu 22.10
- Upgrade to Django 3.2.20
- Fixed direct download URL not working in some cases when local files are not available
- Fixed assignment of regions crossing the dateline
- Fixed harvesting of ArcGIS REST ImageServer services
- Fixed some italian translations
- Disabling of the (deprecated) Monitoring module
## [4.1.0](https://github.com/GeoNode/geonode/tree/4.1.0) (2023-06-05)
### New upload engine
GeoNode integrates a brand new importer module based on [GDAL/OGR](https://gdal.org/), which offers increased robustness and reliability to the upload UI and API services. GeoPackage (vector), GeoJSON, KML/KMZ formats and a new CSV handler have been implemented.

### Thesaurus faceting and date filtering
If thesaurus and thesaurus keywords are configured and assigned to resources, they will be available inside the filters panel, along with the number of associated resources.
Date filtering (from/top) has also been added.

### Time series configurable after the upload
The configuration of (potential) time series at upload time was confusing for users, and not very robust.
With the new importer, the optional configuration of vector time series can be done afterward, through the Settings tab inside the Metadata editing page
Only vector fomats that provide date(time) fields natively are supported. Conversion from string fields is not implemented.

### Related resources
This restore a functionality available in previous versions of GeoNode.
A tab inside the info panel has been added where relationships between datasets, maps and documents are reported.

### Vector dataset attributes
A tab inside the info panel has been added showing the attributes of vector datasets

### Remote documents
The API has been extended to permit the creation of document resources referencing remote URLs

### ISO-19115 XML upload via API
The API now supports the upload of a metadata XML file along with the resource data

### Software upgrades

- [Geoserver 2.23.0](https://geoserver.org/announcements/2023/04/05/geoserver-2-23-0-released.html) is now the reference version. This version includes Geofence WPS rules which are employed by GeoNode to strengthen the security of the OGC/WPS processes.
- [MapStore 2022.02.xx](https://github.com/geosolutions-it/MapStore2/tree/2022.02.xx)
- [Django 3.2.19](https://docs.djangoproject.com/en/4.2/releases/3.2.19/)
- PostgreSQL 13 and PostGIS 3.3.3


## Security and Bug Fixes
- [CVE-2023-26043](https://github.com/GeoNode/geonode/security/advisories/GHSA-mcmc-c59m-pqq8)
Fixed a vulnerability to XML External Entity (XXE) injection
- [CVE-2023-28442](https://github.com/GeoNode/geonode/security/advisories/GHSA-87mh-vw7c-5v6w)
Fixed information leak

You can see the **full list of closed issues [here](https://github.com/GeoNode/geonode/compare/4.1.0...4.0.3)**.

## System requirements
Python >3.9 is required to run GeoNode 4.1.0, since many of its dependencies have dropped support for older versions.

## [4.0.2](https://github.com/GeoNode/geonode/tree/4.0.2) (2022-12-20)

### Breaking Changes
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM geonode/geonode-base:latest-ubuntu-22.10
FROM geonode/geonode-base:latest-ubuntu-22.04
LABEL GeoNode development team

# add bower and grunt command
Expand Down
25 changes: 25 additions & 0 deletions README_52n.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 52°North Fork of GeoNode

This image is built from a fork of [Geonode](https://github.com/geonode/geonode).
[52°North GmbH](https://52north.org) maintains an own fork of GeoNode in order to make necessary adjustments within projects which are not part of GeoNode core.

However, we are interested to stay as close to upstream as possible, to benefit from ongoing development, but also to contribute features and fixes we develop in our projects.

Starting from version `4` this image is built from the `52n-master` branch of the [`52north/geonode` repository](https://github.com/52North/geonode/tree/52n-master).
The repository builds and publishes three images:

* [`52north/geonode`](https://hub.docker.com/r/52north/geonode) (this image)
* [`52north/geonode-nginx`](https://hub.docker.com/r/52north/geonode-nginx)
* [`52north/geonode-geoserver`](https://hub.docker.com/r/52north/geonode-geoserver)

The Dockerfiles can be found under the [`./scripts/docker` folder](https://github.com/52North/geonode/tree/52n-master/scripts/docker).

The official Docker configuration of [GeoServer for GeoNode](https://github.com/GeoNode/geoserver-docker) seems to be outdated.
Therefore, our fork adds a `./scripts/docker/geoserver` Docker config which is based on [the geonode-project](https://github.com/geonode/geonode-project) template.

Depending on our current project contexts we merge regularly from upstream, and create new pull requests based on this fork.

> **Note on version `3` tags**
>
> Images containing a `3.x` version tag were experimental and do have a different code base.
> These image are considered to be removed in the near future.
2 changes: 1 addition & 1 deletion celery-cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Luca Pasquali <[email protected]>
CELERY_BIN=${CELERY_BIN:-"$(which celery||echo celery)"}
CELERY_APP=${CELERY_APP:-"geonode.celery_app:app"}
CELERY__STATE_DB=${CELERY__STATE_DB:-"/mnt/volumes/statics/worker.state"}
CELERY__STATE_DB=${CELERY__STATE_DB:-"/mnt/volumes/statics/worker@%h.state"}
# expressed in KB
CELERY__MAX_MEMORY_PER_CHILD=${CELERY__MAX_MEMORY_PER_CHILD:-"200000"}
CELERY__AUTOSCALE_VALUES=${CELERY__AUTOSCALE_VALUES:-"15,10"}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.9'
# Common Django template for GeoNode and Celery services below
x-common-django:
&default-common-django
image: geonode/geonode:latest-ubuntu-22.10
image: geonode/geonode:latest-ubuntu-22.04
restart: unless-stopped
env_file:
- .env_test
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.9'
# Common Django template for GeoNode and Celery services below
x-common-django:
&default-common-django
image: geonode/geonode:latest-ubuntu-22.10
image: geonode/geonode:latest-ubuntu-22.04
restart: unless-stopped
env_file:
- .env
Expand Down
1 change: 1 addition & 0 deletions geonode/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ def dehydrate(self, bundle):
documents_count=bundle.data.get("documents_count", 0),
maps_count=bundle.data.get("maps_count", 0),
layers_count=bundle.data.get("layers_count", 0),
organization=bundle.data.get("organization", 0),
)
return bundle

Expand Down
40 changes: 39 additions & 1 deletion geonode/base/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from slugify import slugify
from urllib.parse import urljoin
import json
import warnings

from django.db.models import Q
from django.conf import settings
Expand Down Expand Up @@ -54,6 +55,7 @@
ThesaurusKeyword,
ThesaurusKeywordLabel,
ExtraMetadata,
LinkedResource,
)
from geonode.documents.models import Document
from geonode.geoapps.models import GeoApp
Expand Down Expand Up @@ -197,7 +199,7 @@ class SimpleTopicCategorySerializer(DynamicModelSerializer):
class Meta:
model = TopicCategory
name = "TopicCategory"
fields = ("identifier",)
fields = ("identifier", "gn_description")


class RestrictionCodeTypeSerializer(DynamicModelSerializer):
Expand Down Expand Up @@ -787,7 +789,43 @@ class Meta:


class SimpleResourceSerializer(DynamicModelSerializer):
warnings.warn("SimpleResourceSerializer is deprecated", DeprecationWarning, stacklevel=2)

class Meta:
name = "linked_resources"
model = ResourceBase
fields = ("pk", "title", "resource_type", "detail_url", "thumbnail_url")

def to_representation(self, instance: LinkedResource):
return {
"pk": instance.pk,
"title": f"{'>>>' if instance.is_target else '<<<'} {instance.title}",
"resource_type": instance.resource_type,
"detail_url": instance.detail_url,
"thumbnail_url": instance.thumbnail_url,
}


class LinkedResourceSerializer(DynamicModelSerializer):
def __init__(self, *kargs, serialize_source: bool = False, **kwargs):
super().__init__(*kargs, **kwargs)
self.serialize_target = not serialize_source

class Meta:
name = "linked_resources"
model = LinkedResource
fields = ("internal",)

def to_representation(self, instance: LinkedResource):
data = super().to_representation(instance)
item: ResourceBase = instance.target if self.serialize_target else instance.source
data.update(
{
"pk": item.pk,
"title": item.title,
"resource_type": item.resource_type,
"detail_url": item.detail_url,
"thumbnail_url": item.thumbnail_url,
}
)
return data
Loading
Loading