-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Helm chart for wagtail (#382)
* feat: Add Helm chart for wagtail * fix: Fix indentation issue in config map * chore: Set DJANGO_SETTINGS_MODULE to ietf.settings.dev * chore: Format local.py using Black * chore: Prepend new line before importing file prepends a new line * chore: Comment out livenessProbe * fix: Specify tag name for wagtail image * fix: Use correct port for wagtail service * chore: Expand ALLOWED_HOST to include 127.0.0.1 * chore: Use app user instead of superuser * docs: Add how to run K8s locally to CONTRIBUTING.md * chore: Pin wagtail_website image to v2.0.0 * chore: Use target port
- Loading branch information
Sangho Na
authored
Mar 21, 2024
1 parent
4dc2ec7
commit 09026b6
Showing
15 changed files
with
868 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v2 | ||
name: wagtail | ||
description: Helm chart for IETF Wagtail services | ||
maintainers: | ||
- name: IETF Tools Team | ||
email: [email protected] | ||
url: https://github.com/ietf-tools | ||
|
||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 1.0.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "1.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import os | ||
|
||
DEFAULT_FROM_EMAIL = "[email protected]" | ||
SERVER_EMAIL = "[email protected]" | ||
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" | ||
EMAIL_HOST = os.environ["EMAIL_HOST"] | ||
|
||
DATABASES = { | ||
"default": { | ||
"ENGINE": "django.db.backends.postgresql_psycopg2", | ||
"HOST": os.environ["DBHOST"], | ||
"NAME": os.environ["DBNAME"], | ||
"USER": os.environ["DBUSER"], | ||
"PASSWORD": os.environ["DBPASS"], | ||
"CONN_MAX_AGE": 600, # number of seconds database connections should persist for | ||
}, | ||
} | ||
|
||
SECRET_KEY = os.environ["SECRET_KEY"] | ||
|
||
FILE_UPLOAD_PERMISSIONS = 0o664 | ||
|
||
ALLOWED_HOSTS = os.environ["ALLOWED_HOSTS"].split(",") | ||
|
||
WAGTAILADMIN_BASE_URL = os.environ["WAGTAILADMIN_BASE_URL"] | ||
|
||
ADMINS = (("Django Server", "[email protected]"),) | ||
|
||
# Logging | ||
|
||
LOGGING = { | ||
"version": 1, | ||
"disable_existing_loggers": False, | ||
"handlers": { | ||
"mail_admins": { | ||
"level": "ERROR", | ||
"class": "django.utils.log.AdminEmailHandler", | ||
}, | ||
}, | ||
"loggers": { | ||
"django.request": { | ||
"handlers": ["mail_admins"], | ||
"level": "ERROR", | ||
"propagate": False, | ||
}, | ||
"django.security": { | ||
"handlers": ["mail_admins"], | ||
"level": "ERROR", | ||
"propagate": False, | ||
}, | ||
}, | ||
} | ||
|
||
MATOMO_DOMAIN_PATH = "analytics.ietf.org" | ||
MATOMO_SITE_ID = "1" | ||
MATOMO_DISABLE_COOKIES = True | ||
|
||
MEMCACHED_HOST = os.environ["MEMCACHED_SERVICE_HOST"] | ||
MEMCACHED_PORT = os.environ["MEMCACHED_SERVICE_PORT"] | ||
|
||
CACHES = { | ||
"default": { | ||
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache", | ||
"LOCATION": f"{MEMCACHED_HOST}:{MEMCACHED_PORT}", | ||
"KEY_PREFIX": "ietf", | ||
}, | ||
"sessions": { | ||
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache", | ||
"LOCATION": f"{MEMCACHED_HOST}:{MEMCACHED_PORT}", | ||
"KEY_PREFIX": "ietf", | ||
}, | ||
"dummy": {"BACKEND": "django.core.cache.backends.dummy.DummyCache"}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "wagtail.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "wagtail.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a fully qualified wagtail name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
*/}} | ||
{{- define "wagtail.wagtail.fullname" -}} | ||
{{- if .Values.wagtail.fullnameOverride -}} | ||
{{- .Values.wagtail.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- printf "%s-%s" .Release.Name .Values.wagtail.name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s-%s" .Release.Name $name .Values.wagtail.name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create a fully qualified memcached name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
*/}} | ||
{{- define "wagtail.memcached.fullname" -}} | ||
{{- if .Values.memcached.fullnameOverride -}} | ||
{{- .Values.memcached.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- printf "%s-%s" .Release.Name .Values.memcached.name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s-%s" .Release.Name $name .Values.memcached.name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "wagtail.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "wagtail.labels" -}} | ||
helm.sh/chart: {{ include "wagtail.chart" . }} | ||
{{ include "wagtail.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "wagtail.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "wagtail.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "wagtail.serviceAccountName.wagtail" -}} | ||
{{- if .Values.serviceAccounts.wagtail.create -}} | ||
{{ default (include "wagtail.wagtail.fullname" .) .Values.serviceAccounts.wagtail.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccounts.wagtail.name }} | ||
{{- end -}} | ||
{{- end }} | ||
|
||
{{- define "wagtail.serviceAccountName.celery" -}} | ||
{{- if .Values.serviceAccounts.celery.create -}} | ||
{{ default (include "wagtail.celery.fullname" .) .Values.serviceAccounts.celery.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccounts.celery.name }} | ||
{{- end -}} | ||
{{- end }} | ||
|
||
{{- define "wagtail.serviceAccountName.memcached" -}} | ||
{{- if .Values.serviceAccounts.memcached.create -}} | ||
{{ default (include "wagtail.memcached.fullname" .) .Values.serviceAccounts.memcached.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccounts.memcached.name }} | ||
{{- end -}} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: django-configmap | ||
data: | ||
local.py: |- | ||
{{ .Files.Get "local.py" | nindent 4 }} |
Oops, something went wrong.