Giter Club home page Giter Club logo

django-helm-chart's Introduction

Django Helm Chart

Django Helm Chart with Celery, Celery-Beat, Flower and Redis. The chart also includes deployments for Celery setup (Worker, Flower.

  • Deployment includes a multi container pod with Django and Caddy. Caddy is used as sidecar to serve the static files of backend. Caddyfile can be found here.

  • The chart includes Redis as an optional subchart.

  • The Deployment containers init containers for migrations and staticfiles.

This is my personal take on such a type of chart, thus I might not use the best practices or you might disagree with how I do things. Any and all feedback is greatly appreciated!

Deployment setup

Set values for Django backend on Deployment Section of values.yaml

Example:

replicaCount: 1
revisionHistoryLimit: 2
image:
  repository: ghcr.io/sanoguzhan/django-helm-test
  pullPolicy: IfNotPresent
  # Overrides the image tag whose default is the chart appVersion.
  tag: "latest"
  containerPort: 8081
command: 'gunicorn blog.wsgi -b 0.0.0.0:8081'

Note: Set the command as a string instead of a list.

Init Container

  • migrations: Add command to apply migrations before container is created.
  • staticfiles: Add command for Django to collect static files.
init:
  migrations:
    name: migrations
    command:  "python3 manage.py migrate"
  staticfiles:
    name: staticfiles
    command: "python3 manage.py collectstatic --noinput"

Static files and Media directories should be given under data:

data:
  staticfiles: "app/staticfiles/"
  data_media: "app/data_media/"

Paths should be relative to the working directory of main container. Static files are shared volume (emptyDir) between initContainer and Proxy container.

ConfigMaps and Secrets

ConfigMaps and Secret values should be set under:

# Env ConfigMap values 
envConfigs: {}
# Enc Secret Values (Base64 encoded data)
envSecrets: {}

Celery Setup

Celery setup includes worker, flower and beat. Celery Beat is optional, set enabled to false if you want to exclude it. Flower includes ingress setup optionally.

celery:
# Celery Beat Values
  beat:
    enabled: true
    componentName: celery-beat
    command: 'celery -A blog.celery beat -l DEBUG'
    replicaCount: 1
    strategy: Recreate
# Celery Worker Settings  
  worker:
    componentName: celery-worker
    command: 'celery -A blog.celery worker -l DEBUG'
    replicaCount: 1
    strategy: RollingUpdate
# Celery Flower Settings
  flower:
    componentName: celery-flower
    command: 'celery -A blog.celery flower'
    replicaCount: 1
    strategy: RollingUpdate   
    service:
      type: ClusterIP
      port: 
        number: 5555
        name: flower
    ingress:
      enabled: false
      annotations: {}
      hosts:
        - host: example.com
          paths:
            - path: / 
              pathType: Prefix
      tls: []  

Redis

Redis is optional sub-chart, which could be disabled by setting enabled to false. Bitnami Redis Helm Chart is used, and version of the chart is given in the Chart.yaml file.

redis:
  enabled: true

Build chart dependency includes

helm dependency build ./django

Getting Started

Use the Github template

First, click the green Use this template button near the top of this page. This will take you to Github's 'Generate Repository' page. Fill in a repository name and short description, and click 'Create repository from template'. This will allow you to create a new repository in your Github account, prepopulated with the contents of this project.

Now you can clone the project locally and get to work!

git clone https://github.com/<user>/<your_new_repo>.git

django-helm-chart's People

Contributors

sanoguzhan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.