Skip to content

Latest commit

 

History

History
 
 

django

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

django

Version: 0.2.2 AppVersion: 3.1

Generic chart for basic Django-based web app

Homepage: https://www.djangoproject.com/

Maintainers

Name Email Url
lucernae [email protected]

Source Code

Requirements

Repository Name Version
../../common/v1.0.1 common 1.0.1
../../postgis/v0.2.2 postgis 0.2.2

Long Description

This is Kartoza's base chart for Django app

This helm chart was intended to be the base chart for any Django-based deployment. The customization are provided via values.yml and pod environment.

How to Use

For helm:

helm install release-name kartoza/django

Intro

This chart bootstrap a Django web framework. Django is a web framework based on python programming language. It is a general purpose web framework. This helm chart is created as a base chart for you. It is supposed to be overrideable for you to provide your own Django image/app.

Django can be deployed as a standalone web app. In this chart, we deployed Django coupled with Nginx webserver with WSGI protocol and Postgis database backend.

What it can do

The default deployment install generic Django image coupled with Nginx webserver and Postgis RDBMS backend.

Optional customizations:

  • Enable/Disable Postgis RDBMS
  • Override entrypoint script of Django
  • Override python module requirements
  • Override Nginx config (if you want to use different staticfiles mapping or protocols)
  • Add extra configuration file
  • Add custom settings.py
  • Add custom urls.py
  • Override DJANGO_SETTINGS_MODULE
  • Toggle Debug mode

Values

Key Type Default Description

extraConfigMap

tpl/map

extraConfigMap: |
  # file_1: conf content

Define this for extra config map to be included in django-shared-config

extraPodEnv

tpl/array

+Expand
extraPodEnv: |
  - name: DJANGO_SETTINGS_MODULE
    value: "django.settings"
  - name: DEBUG
    value: {{ .Values.global.debug | quote }}
  - name: ROOT_URLCONF
    value: {{ .Values.global.rootURLConf | quote }}
  - name: MAIN_APP_NAME
    value: {{ .Values.global.mainAppName | quote }}

Define this for extra Django environment variables

extraPodSpec

tpl/object

extraPodSpec: |
  #  nodeSelector:
  #    a.label: value

This will be evaluated as pod spec

extraSecret

tpl/map

extraSecret: |
  #  key_1: value_1

Define this for extra secrets to be included in django-shared-secret secret

extraVolume

tpl/list

+Expand
extraVolume: |
  # You may potentially mount a config map/secret
  #  - name: custom-config
  #    configMap:
  #      name: geonode-config

Define this for extra volume (in pair with extraVolumeMounts)

extraVolumeMounts

tpl/list

+Expand
extraVolumeMounts: |
  # You may potentially mount a config map/secret
  #  - name: custom-config
  #    mountPath: /docker-entrypoint.sh
  #    subPath: docker-entrypoint.sh
  #    readOnly: true

Define this for extra volume mounts in the pod

global.adminEmail

string/email

admin@localhost

Default admin email sender

global.adminPassword

object/common.secret

+Expand
# -- (string) Specify this password value. If not, it will be autogenerated everytime chart upgraded
value:
valueFrom:
    secretKeyRef:
        name:
        key: admin-password

Secret structure for Admin Password

global.adminPassword.value

string

null

Specify this password value. If not, it will be autogenerated everytime chart upgraded

global.adminUser

string

"admin"

Default super user admin username

global.databaseHost

string

null

Django database host location. By default this chart can generate standard postgres chart. So you can leave it as default. If you use external backend, you must provide the value

global.databaseName

string

"django"

Django database name

global.databasePassword

object/common.secret

+Expand
# -- (string) Specify this password value. If not, it will be autogenerated everytime chart upgraded. If you use external backend, you must provide the value
value:
valueFrom:
    secretKeyRef:
        name:
        key: database-password

Secret structure for Database Password

global.databasePassword.value

string

null

Specify this password value. If not, it will be autogenerated everytime chart upgraded. If you use external backend, you must provide the value

global.databasePort

int

5432

Django database port. By default this chart can generate standard postgres chart. So you can leave it as default. If you use external backend, you must provide the value

global.databaseURL

string

+Expand
value:
valueFrom:
    secretKeyRef:
        name:
        key: database-url

Use this if you want to specify the full Database URL connection

global.databaseUsername

string

"django_db_user"

Database username backend to connect to. If you use external backend, provide the value

global.debug

string/bool

"False"

Python boolean literal, this will correspond to DEBUG environment variable inside the Django container. Useful as a debug switch.

global.djangoArgs

tpl/list

+Expand
global.djangoArgs: |
  ["uwsgi","--chdir=${REPO_ROOT}","--module=${MAIN_APP_NAME}.wsgi","--socket=:8000","--http=0.0.0.0:8080","--processes=5","--buffer-size=8192"]

The django command args to be passed to entrypoint command

global.djangoCommand

tpl/list

global.djangoCommand: |
  ["/opt/django/scripts/docker-entrypoint.sh"]

The django entrypoint command to execute

global.djangoSecretKey

object/common.secret

+Expand
# -- (string) Specify this Django Secret string value. If not, it will be autogenerated everytime chart upgraded
value:
valueFrom:
    secretKeyRef:
        name:
        key: django-secret

Secret structure for Django Secret Key

global.djangoSecretKey.value

string

null

Specify this Django Secret string value. If not, it will be autogenerated everytime chart upgraded

global.djangoSettingsModule

string

"django.settings"

Django settings module to be used

global.existingConfig

tpl/string

global.existingConfig: |

Name of existing config

global.existingSecret

tpl/string

global.existingSecret: |

Name of existing secret

global.fullnameOverride

string

null

You can override full release name

global.mainAppName

string

"django"

The main app name to execute. Affects which settings, wsgi, and rootURL to use.

global.mediaRoot

path

"/opt/django/media"

Location to the media directory

global.nameOverride

string

null

You can override release suffix

global.rootURLConf

string

"django.urls"

Django root URL conf to be used

global.sharedConfigName

string

"django-shared-config"

Name of shared config store that will be generated

global.sharedSecretName

string

"django-shared-secret"

Name of shared secret store that will be generated

global.siteName

string

"django"

global.staticRoot

path

"/opt/django/static"

Location to the static directory

global.storageClassName

string

null

Storage class name used to provision PV

image

object/container-image

+Expand
# -- Image registry
registry: docker.io
# -- Image repository
repository: lucernae/django-sample
# -- Image tag
tag: "3.1"
# -- (k8s/containers/image/imagePullPolicy) Image pullPolicy
pullPolicy: IfNotPresent

Image map

image.pullPolicy

k8s/containers/image/imagePullPolicy

"IfNotPresent"

Image pullPolicy

image.registry

string

"docker.io"

Image registry

image.repository

string

"lucernae/django-sample"

Image repository

image.tag

string

"3.1"

Image tag

ingress.annotations

dict

{}

Custom Ingress annotations

ingress.enabled

bool

false

Set to true to generate Ingress resource

ingress.host

tpl/string

ingress.host: |

Set custom host name. (DNS name convention)

ingress.labels

dict

{}

Custom Ingress labels

ingress.tls.enabled

bool

false

Set to true to enable HTTPS

ingress.tls.secretName

string

"django-tls"

You must provide a secret name where the TLS cert is stored

persistence.mediaDir.accessModes[0]

string

"ReadWriteOnce"

persistence.mediaDir.annotations

object

{}

persistence.mediaDir.enabled

bool

true

Allow persistence

persistence.mediaDir.existingClaim

string

false

Set to an existing claim if you have it

persistence.mediaDir.mountPath

path

"/opt/django/media"

This has to be the same with global.mediaRoot

persistence.mediaDir.size

string

"8Gi"

persistence.mediaDir.subPath

string

"media"

persistence.staticDir.accessModes[0]

string

"ReadWriteOnce"

persistence.staticDir.annotations

object

{}

persistence.staticDir.enabled

bool

false

Allow persistence

persistence.staticDir.existingClaim

string

false

Set to an existing claim if you have it

persistence.staticDir.mountPath

path

"/opt/django/static"

This has to be the same with global.staticRoot

persistence.staticDir.size

string

"8Gi"

persistence.staticDir.subPath

string

"static"

postgis.enabled

bool

true

Enable postgis as database backend by default. Set to false if using different external backend.

postgis.existingSecret

tpl/string

postgis.existingSecret: |

Existing secret to be used

postgis.extraConfigMap

tpl/object

+Expand
postgis.extraConfigMap: |
  django-db.sh: |
    #!/usr/bin/env bash
    DATABASE="{{ .Values.global.databaseName }}"
    # password comes from environment variables, so it can be retrieved from secret
    DATABASE_USER="{{ .Values.global.databaseUsername }}"
    # create database
    su postgres -c "createdb ${DATABASE}"
    # create role
    cat << EOF | su postgres -c "psql"
    CREATE ROLE ${DATABASE_USER};
    EOF
    # modify permissions
    cat << EOF | su postgres -c "psql -d ${DATABASE}"
    -- Create role
    ALTER ROLE ${DATABASE_USER} LOGIN PASSWORD '${DATABASE_PASSWORD}';
    ALTER DATABASE ${DATABASE} OWNER TO ${DATABASE_USER};
    EOF

Extra config map for postgis to be included Can be used to pregenerate Django database for first setup

postgis.extraPodEnv

tpl/array

+Expand
postgis.extraPodEnv: |
  - name: DATABASE_PASSWORD
    valueFrom:
      secretKeyRef:
        name: {{ include "common.sharedSecretName" . | quote }}
        key: {{ .Values.global.databasePassword.valueFrom.secretKeyRef.key }}

Extra pod env for postgis We expose Django database password in case we need to pregenerate it

postgis.extraVolume

tpl/array

+Expand
postgis.extraVolume: |
  - name: config-volume
    configMap:
      name: {{ template "common.fullname" . }}
      defaultMode: 0755

Extra volume declaration for postgis We use extra volume to mount postgis configmap to pregenerate database

postgis.extraVolumeMounts

tpl/array

+Expand
postgis.extraVolumeMounts: |
  - mountPath: /docker-entrypoint-initdb.d/django-db.sh
    subPath: django-db.sh
    name: config-volume

Extra volume mounts for postgis We use extra volume mounts postgis configmap to pregenerate database

postgis.nameOverride

string

"postgis"

postgis.postgresqlPassword

object/common.secret

value:

Postgres super user password. It can be different than global.databasePassword

postgis.postgresqlUsername

string

"superuser"

Postgres super user account. It can be different than global.databaseUsername

probe

tpl/object

probe: |

Probe can be overridden

service.annotations

dict

{}

Extra service annotations

service.clusterIP

string

""

Specify None for headless service. Otherwise, leave them be.

service.externalIPs

tpl/array

service.externalIPs: |

Specify for LoadBalancer service type

service.nodePort

int

null

Specify node port, for NodePort service type

service.port

int

80

Specify service port

service.type

string

"ClusterIP"

Define k8s service for Django.

test.django.containers

tpl/array


List of containers override for testing

Helm-Docs Chart Template Version

common-v1.0.1