All Projects → painless-software → django-probes

painless-software / django-probes

Licence: BSD-3-Clause license
Django app to run database liveness probe in a Kubernetes project

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to django-probes

Openshift Examples
Openshift Examples - This repo does not provide end to end example but rather act as a rough draft for my work. use with caution. Buzzme at @twitter
Stars: ✭ 247 (+671.88%)
Mutual labels:  openshift
jetlag
Automation to deploy Bare-metal OpenShift leveraging the Assisted-Installer
Stars: ✭ 18 (-43.75%)
Mutual labels:  openshift
Chowkidar
A kubernetes controller that watches/observes events & then takes configured actions – [✩Star] if you're using it!
Stars: ✭ 55 (+71.88%)
Mutual labels:  openshift
openshift-json-schema
A set of JSON schemas for various OpenShift versions, extracted from the OpenAPI definitions
Stars: ✭ 23 (-28.12%)
Mutual labels:  openshift
openshift-cartridge-mysql
Custom cartridge for OpenShift providing MySQL 5.7.17
Stars: ✭ 13 (-59.37%)
Mutual labels:  openshift
ChRIS ultron backEnd
Backend for ChRIS
Stars: ✭ 28 (-12.5%)
Mutual labels:  openshift
Openwhisk Deploy Kube
The Apache OpenWhisk Kubernetes Deployment repository supports deploying the Apache OpenWhisk system on Kubernetes and OpenShift clusters.
Stars: ✭ 231 (+621.88%)
Mutual labels:  openshift
dockerevil
My security researches involving Docker and Openshift
Stars: ✭ 28 (-12.5%)
Mutual labels:  openshift
kubernetes.core
The collection includes a variety of Ansible content to help automate the management of applications in Kubernetes and OpenShift clusters, as well as the provisioning and maintenance of clusters themselves.
Stars: ✭ 159 (+396.88%)
Mutual labels:  openshift
ocp4upc
OCP4 Upgrade Paths Checker
Stars: ✭ 30 (-6.25%)
Mutual labels:  openshift
openshift-install-power
UPI Install helper to deploy OpenShift 4 on IBM Power Systems Virtual Server using Terraform IaC
Stars: ✭ 16 (-50%)
Mutual labels:  openshift
openshift4-upi-homelab
OpenShift 4 User Provisioned Infrastructure Homelab
Stars: ✭ 15 (-53.12%)
Mutual labels:  openshift
backup-repository
Backup storage for E2E GPG-encrypted files, with multi-user, quotas, versioning, using a object storage (S3/Min.io/GCS etc.) and deployed on Kubernetes or standalone.
Stars: ✭ 21 (-34.37%)
Mutual labels:  openshift
openshift-starter-guides
Getting Started with OpenShift for Developers Workshop
Stars: ✭ 35 (+9.38%)
Mutual labels:  openshift
s2i-ruby-container
Ruby container images based on Red Hat Software Collections and intended for OpenShift and general usage, that provide a platform for building and running Ruby applications. Users can choose between Red Hat Enterprise Linux, Fedora, and CentOS based images.
Stars: ✭ 55 (+71.88%)
Mutual labels:  openshift
Selinon
An advanced distributed task flow management on top of Celery
Stars: ✭ 237 (+640.63%)
Mutual labels:  openshift
anthill
A Kubernetes/OpenShift operator to manage Gluster clusters
Stars: ✭ 35 (+9.38%)
Mutual labels:  openshift
kubernetes-kafka
Managing kafka clusters in Kubernetes and OpenShift
Stars: ✭ 18 (-43.75%)
Mutual labels:  openshift
apb-examples
A repository of example ansible-playbook bundles. THIS REPO IS DEPRECATED. Please look at https://github.com/ansibleplaybookbundle/ For updated examples.
Stars: ✭ 15 (-53.12%)
Mutual labels:  openshift
camunda-cloud-helm
Camunda Platform 8 Self-Managed Helm charts
Stars: ✭ 41 (+28.13%)
Mutual labels:  openshift

Django-probes Latest version on PyPI

GitHub Workflow Status GitHub Workflow Status Python versions Software license

Provides a Django management command to check whether the primary database is ready to accept connections.

Run this command in a Kubernetes or OpenShift Init Container to make your Django application wait until the database is available (e.g. to run database migrations).

Why Should I Use This App?

wait_for_database is a single command for all database engines Django supports. It automatically checks the database you have configured in your Django project settings. No need to code a specific wait command for Postgres, MariaDB, Oracle, etc., no need to pull a database engine specific container just for running the database readiness check.

Installation

The easiest way to install django-probes is with pip

$ pip install django-probes

Basic Usage

  1. Add django-probes to your Django application:
INSTALLED_APPS = [
    ...
    'django_probes',
]

2. Add an Init Container to your Kubernetes/OpenShift deployment configuration, which calls the wait_for_database management command:

- kind: Deployment
  apiVersion: apps/v1
  spec:
    template:
      spec:
        initContainers:
        - name: wait-for-database
          image: my-django-app:latest
          envFrom:
          - secretRef:
              name: django
          command: ['python', 'manage.py', 'wait_for_database']

Use with Your Own Command

Alternatively, you can integrate the wait_for_database command in your own management command, and do things like database migration, load initial data, etc. with roughly the same Kubernetes setup as above.

from django.core.management import call_command

# ...
call_command('wait_for_database')

Command Line Options

The management command comes with sane defaults, which you can override if needed:

--timeout, -t:how long to wait for the database before timing out (seconds), default: 180
--stable, -s:how long to observe whether connection is stable (seconds), default: 5
--wait-when-down, -d:delay between checks when database is down (seconds), default: 2
--wait-when-alive, -a:delay between checks when database is up (seconds), default: 1
--database:which database of settings.DATABASES to wait for, default: default
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].