GithubHelp home page GithubHelp logo

ncsa / checks Goto Github PK

View Code? Open in Web Editor NEW
0.0 9.0 0.0 18 KB

Single container to be used as init containers. This can be used to check if the service is up and running and ready to be used.

Dockerfile 14.24% Python 85.76%
kubernetes init-containers

checks's Introduction

NCSA CHECKS

The goal of this project is to have a simple set of functions that can be used as init containers in your kubernetes deployment. Each of the checks will see if the service is ready to accept connections.

For example the following snippet will wait for rabbitmq and postgresql to be ready before starting the actual container:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mywebapp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mywebapp
  template:
    metadata:
      labels:
        app: mywebapp
    spec:
      initContainers:
        - name: check-rabbitmq
          image: "ncsa/checks:1.0.0"
          env:
            - name: RABBITMQ_URI
              value: "amqp://user:pass@rabbitmq/%2F"
        - name: check-postgresql
          image: "ncsa/checks:1.0.0"
          env:
            - name: PGURI
              value: "postgresql://postgres:secret@postgresql:5432/mydb"
            - name: PGTABLE
              value: "users"
      containers:
        - name: mywebapp
          image: mywebapp:1.0
          ports:
            - containerPort: 80
          env:
            - name: RABBITMQ_URI
              value: "amqp://user:pass@rabbitmq/%2F"
            - name: PGHOST
              value: "postgres"
            - name: PGUSER
              value: "postgres"

Tests Supported

RabbitMQ

  • description : checks to see if can connect to RabbitMQ Server
  • exit code : 1
  • parameters
    • RABBITMQ_URI [required] : URI for RabbitMQ server

Mongo

  • description : checks to see if can connect to MongoDB Server
  • exit code : 2
  • parameters
    • MONGO_URI [required] : URI for MongoDB server

URL

  • description : checks to see if URL is reachable and returns status code of 200. If optional text is given the text needs to be in the returned body.
  • exit code : 3
  • parameters
    • URL [required] : URL to check
    • URL_TEXT [optional] : text to be found in body returned

PostgreSQL

  • description : checks to see if database is up. Will check to see if the optional table exists
  • exit code : 4
  • parameters
    • PGURI [required*] : URI to connect to postgresql.
    • PGUSER [required*] :
    • PGPASSWORD [required*] :
    • PGHOST [required*] :
    • PGPORT [required*] :
    • PGDATABASE [required*] :
    • PGTABLE [optional] : table that should exist
  • either PG_URI or on of the PG* should be provided.

TODO:

  • check_service: check if host:port is reachable
  • create simple tests for each check
  • add db/collection for mongo to test access

checks's People

Contributors

bengalewsky avatar khk-globus avatar robkooper avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

checks's Issues

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.