Skip to content
Snippets Groups Projects
Commit 9aad76d6 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Initial commit

parent 3b1b32a3
Branches
No related tags found
No related merge requests found
Pipeline #120263 failed
*.pyc
*.swp
.venv
.vscode
venv
.DS_Store
.idea
\ No newline at end of file
test:
stage: test
image: python:$PYTHON_VERSION
script:
- pip3 install -r requirements.txt
- python3 runtests.py
parallel:
matrix:
- PYTHON_VERSION: [
"3.9-slim",
"3.10-slim",
"3.11-slim",
]
upload:
stage: build
needs: ['test', ]
image: harbor.pasteur.fr/kube-system/helm-kubectl:3.4.0
script:
- CHART_VERSION=$(helm show chart shiny-server | grep version | cut -d' ' -f2)
- CHART_NAME=$(helm show chart shiny-server | grep name | cut -d' ' -f2)
- |
if [ "helm" == "${CI_COMMIT_REF_SLUG}" ]; then
export CHANNEL="stable"
else
export CHANNEL="${CI_COMMIT_REF_SLUG}"
fi
echo $CHANNEL
- helm package shiny-server
- curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@${CHART_NAME}-${CHART_VERSION}.tgz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/${CHANNEL}/charts"
\ No newline at end of file
include LICENSE
include README.rst
\ No newline at end of file
============
django-kubernetes-probes
============
django-kubernetes-probes is a Django app to conduct web-based polls. For each
question, visitors can choose between a fixed number of answers.
Detailed documentation is in the "docs" directory.
Quick start
-----------
1. Add "polls" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [
...,
"django_kubernetes_probes",
]
2. Include the polls URLconf in your project urls.py like this::
path("polls/", include("django_kubernetes_probes.urls")),
4. Start the development server.
5. Visit the ``/probe_alive/`` URL to see that you app is alive.
\ No newline at end of file
from django.apps import AppConfig
class ProbesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "django_kubernetes_probes"
label = "probes"
import logging
from django.test import TestCase
from django.urls import reverse
logger = logging.getLogger(__name__)
class ProbeTestCase(TestCase):
def test_is_pk(self):
self.assertEqual(200, self.client.get(reverse("probes:probe_ready")).status_code)
self.assertEqual(200, self.client.get(reverse("probes:probe_alive")).status_code)
from django.urls import path
from probes import views
app_name = "probes"
urlpatterns = [
##############################
# url(r'^$', views.index, name='home'),
##############################
path("probe_alive/", views.is_alive, name="probe_alive"),
path("probe_ready/", views.is_ready, name="probe_ready"),
]
from django.contrib.auth import get_user_model
from django.http import HttpResponse
def is_ready(request):
from django.db import OperationalError
import django.apps
try:
for model_class in django.apps.apps.get_models():
if not model_class._meta.managed:
continue # we don't test not managed models
model_class.objects.first()
return HttpResponse(status=200)
except OperationalError:
pass
return HttpResponse(status=500)
def is_alive(request):
from django.db import OperationalError
try:
get_user_model().objects.exists()
return HttpResponse(status=200)
except OperationalError:
pass
return HttpResponse(status=500)
[build-system]
requires = ['setuptools>=40.8.0']
build-backend = 'setuptools.build_meta'
\ No newline at end of file
django>=3.2
\ No newline at end of file
[metadata]
name = django-kubernetes-probes
version = 1.0
description = A Django app to expose probes for kubernetes
long_description = file: README.rst
url = https://www.example.com/
author = Bryan Brancotte
author_email = bryan.brancotte@pasteur.fr
license = BSD-3-Clause # Example license
classifiers =
Environment :: Web Environment
Framework :: Django
Framework :: Django :: X.Y # Replace "X.Y" as appropriate
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Topic :: Internet :: WWW/HTTP
Topic :: Internet :: WWW/HTTP :: Dynamic Content
[options]
include_package_data = true
packages = find:
python_requires = >=3.10
install_requires =
Django >= X.Y # Replace "X.Y" as appropriate
\ No newline at end of file
from setuptools import setup
setup()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment