Skip to content

Commit

Permalink
[Fixes #153] Feature: append code to settings.py (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwallschlaeger authored Mar 6, 2024
1 parent ac7efe4 commit 7dd9dd8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions charts/geonode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Helm Chart for Geonode. Supported versions: Geonode: 4.1.3, Geoserver: 2.23.0, p
| geonode.general.ogc_request_timeout | int | `600` | OGC_REQUEST_TIMEOUT |
| geonode.general.publishing.admin_moderate_uploads | bool | `false` | ADMIN_MODERATE_UPLOADS When this variable is set to True, every uploaded resource must be approved before becoming visible to the public users. Until a resource is in PENDING APPROVAL state, only the superusers, owner and group members can access it, unless specific edit permissions have been set for other users or groups. A Group Manager can approve the resource, but he cannot publish it whenever the setting RESOURCE_PUBLISHING is set to True. Otherwise, if RESOURCE_PUBLISHING (helm: resource_publishing_by_staff) is set to False, the resource becomes accessible as soon as it is approved. |
| geonode.general.publishing.resource_publishing_by_staff | bool | `false` | RESOURCE_PUBLISHING By default, the GeoNode application allows GeoNode staff members to publish/unpublish resources. By default, resources are published when created. When this setting is set to True the staff members will be able to unpublish a resource (and eventually publish it back). |
| geonode.general.settings_additions | string | `""` | add additional settings to the settings py. This code will be appended to the end of the geonode settings.py |
| geonode.general.settings_module | string | `"geonode.settings"` | the settings module to load |
| geonode.haystack.enabled | bool | `false` | enable hystack |
| geonode.haystack.engine_index_name | string | `"haystack"` | hystack index name |
Expand Down
18 changes: 16 additions & 2 deletions charts/geonode/templates/geonode/geonode-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ spec:
checksum/geonode-env: {{ include (print $.Template.BasePath "/geonode/geonode-env.yaml") . | sha256sum }}
checksum/geonode-secret: {{ include (print $.Template.BasePath "/geonode/geonode-secret.yaml") . | sha256sum }}
checksum/geonode-local-settings: {{ include (print $.Template.BasePath "/geonode/geonode-local-settings.yaml") . | sha256sum }}
checksum/geonode-settings-additions: {{ include (print $.Template.BasePath "/geonode/geonode-settings-additions.yaml") . | sha256sum }}
checksum/geonode-uwsig: {{ include (print $.Template.BasePath "/geonode/geonode-uwsgi-ini-conf.yaml") . | sha256sum }}
spec:
terminationGracePeriodSeconds: 3
Expand All @@ -50,7 +51,6 @@ spec:
# This is the django app server
- name: {{ .Values.geonode.container_name }}
image: "{{ .Values.geonode.image.name }}:{{ .Values.geonode.image.tag }}"

command:
- bash
- -c
Expand All @@ -71,6 +71,7 @@ spec:
# Add config overrides
cat /usr/src/geonode/geonode/geonode-k8s-settings.py >> /usr/src/geonode/geonode/settings.py
cat /usr/src/geonode/geonode/geonode-k8s-settings-additions.py >> /usr/src/geonode/geonode/settings.py
# Setup
touch /usr/src/geonode/invoke.log
Expand Down Expand Up @@ -142,6 +143,9 @@ spec:
- name: geonode-k8s-settings-py
mountPath: "/usr/src/geonode/geonode/geonode-k8s-settings.py"
subPath: geonode-k8s-settings.py
- name: geonode-k8s-settings-additions-py
mountPath: "/usr/src/geonode/geonode/geonode-k8s-settings-additions.py"
subPath: geonode-k8s-settings-additions.py
readOnly: true
{{ if .Values.geonodeFixtures }}
- name: geonode-fixtures
Expand Down Expand Up @@ -184,7 +188,7 @@ spec:
# Add config overrides
cat /usr/src/geonode/geonode/geonode-k8s-settings.py >> /usr/src/geonode/geonode/settings.py
cat /usr/src/geonode/geonode/geonode-k8s-settings-additions.py >> /usr/src/geonode/geonode/settings.py
# Setup
touch /var/log/celery.log
dockerize -stdout /var/log/celery.log /usr/src/geonode/entrypoint.sh celery-cmd
Expand Down Expand Up @@ -248,6 +252,9 @@ spec:
- name: geonode-k8s-settings-py
mountPath: "/usr/src/geonode/geonode/geonode-k8s-settings.py"
subPath: geonode-k8s-settings.py
- name: geonode-k8s-settings-additions-py
mountPath: "/usr/src/geonode/geonode/geonode-k8s-settings-additions.py"
subPath: geonode-k8s-settings-additions.py
readOnly: true
{{ if .Values.geonodeFixtures }}
- name: geonode-fixtures
Expand Down Expand Up @@ -294,6 +301,13 @@ spec:
items:
- key: geonode-k8s-settings.py
path: "geonode-k8s-settings.py"
- name: geonode-k8s-settings-additions-py
configMap:
name: {{ .Release.Name }}-geonode-k8s-settings-additions-py
defaultMode: 0744
items:
- key: geonode-k8s-settings-additions.py
path: "geonode-k8s-settings-additions.py"
{{- if .Values.geonodeFixtures }}
- name: geonode-fixtures
configMap:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-geonode-k8s-settings-additions-py
data:
geonode-k8s-settings-additions.py: {{- .Values.geonode.general.settings_additions | toYaml | indent 1 }}

2 changes: 2 additions & 0 deletions charts/geonode/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ geonode:
debug_static: False
# -- the settings module to load
settings_module: geonode.settings
# -- add additional settings to the settings py. This code will be appended to the end of the geonode settings.py
settings_additions: ""

# -- FREETEXT_KEYWORDS_READONLY Make Free-Text Keywords writable from users. Or read-only when set to False.
freetext_keywords_readonly: false
Expand Down

0 comments on commit 7dd9dd8

Please sign in to comment.