ketchup

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2020 License: MIT

README

ketchup

Build Status codecov Go Report Card Dependabot Status Quality Gate Status

Thanks to OpenEmoji for favicon.

Check your Github dependencies every day at 8am and send a digest by email.

Features

  • Timezone aware cron
  • Simple and plain HTML interface, mobile ready
  • Swagger UI documentation available on /api endpoint
  • Healthcheck available on /health endpoint
  • Version available on /version endpoint
  • Prometheus metrics for Golang and HTTP available on /metrics endpoint
  • Graceful shutdown of HTTP listener
  • Docker/Kubernetes ready container
  • 12factor app compliant

Getting started

Prerequisites

You need a Github OAuth Token, with no particular permission, for having a decent rate-limiting when querying Github. Configuration is done by passing -githubToken arg or setting equivalent environment variable (cf. Usage section)

You need a Postgres database for storing your datas. I personnaly use free tier of ElephantSQL. Once setup, you have to to create schema with provided SQL. Configuration is done by passing -dbHost, -dbName, -dbUser, -dbPass arg or setting equivalent environment variables (cf. Usage section).

In order to send email, you must configure a mailer. Configuration is done by passing -mailerURL arg or setting equivalent environment variable (cf. Usage section).

Installation

Golang binary is built with static link. You can download it directly from the Github Release page or build it by yourself by cloning this repo and running make.

A Docker image is available for amd64, arm and arm64 platforms on Docker Hub: vibioh/ketchup.

You can configure app by passing CLI args or environment variables (cf. Usage section). CLI override environment variables.

You'll find a Kubernetes exemple (without secrets) in the infra/ folder. We don't manage authentification and rely on Traefik basic-auth.

Mailer

Usage

Usage of ketchup:
  -address string
        [http] Listen address {KETCHUP_ADDRESS}
  -cert string
        [http] Certificate file {KETCHUP_CERT}
  -corsCredentials
        [cors] Access-Control-Allow-Credentials {KETCHUP_CORS_CREDENTIALS}
  -corsExpose string
        [cors] Access-Control-Expose-Headers {KETCHUP_CORS_EXPOSE}
  -corsHeaders string
        [cors] Access-Control-Allow-Headers {KETCHUP_CORS_HEADERS} (default "Content-Type")
  -corsMethods string
        [cors] Access-Control-Allow-Methods {KETCHUP_CORS_METHODS} (default "GET")
  -corsOrigin string
        [cors] Access-Control-Allow-Origin {KETCHUP_CORS_ORIGIN} (default "*")
  -csp string
        [owasp] Content-Security-Policy {KETCHUP_CSP} (default "default-src 'self'; base-uri 'self'")
  -dbHost string
        [db] Host {KETCHUP_DB_HOST}
  -dbName string
        [db] Name {KETCHUP_DB_NAME}
  -dbPass string
        [db] Pass {KETCHUP_DB_PASS}
  -dbPort uint
        [db] Port {KETCHUP_DB_PORT} (default 5432)
  -dbSslmode string
        [db] SSL Mode {KETCHUP_DB_SSLMODE} (default "disable")
  -dbUser string
        [db] User {KETCHUP_DB_USER}
  -frameOptions string
        [owasp] X-Frame-Options {KETCHUP_FRAME_OPTIONS} (default "deny")
  -githubToken string
        [github] OAuth Token {KETCHUP_GITHUB_TOKEN}
  -graceDuration string
        [http] Grace duration when SIGTERM received {KETCHUP_GRACE_DURATION} (default "15s")
  -hsts
        [owasp] Indicate Strict Transport Security {KETCHUP_HSTS} (default true)
  -ketchupTimezone string
        [ketchup] Timezone {KETCHUP_KETCHUP_TIMEZONE} (default "Europe/Paris")
  -ketchupTo string
        [ketchup] Email to send notification {KETCHUP_KETCHUP_TO}
  -key string
        [http] Key file {KETCHUP_KEY}
  -mailerPass string
        [mailer] Pass {KETCHUP_MAILER_PASS}
  -mailerURL string
        [mailer] URL (an instance of github.com/ViBiOh/mailer) {KETCHUP_MAILER_URL}
  -mailerUser string
        [mailer] User {KETCHUP_MAILER_USER}
  -okStatus int
        [http] Healthy HTTP Status code {KETCHUP_OK_STATUS} (default 204)
  -port uint
        [http] Listen port {KETCHUP_PORT} (default 1080)
  -prometheusPath string
        [prometheus] Path for exposing metrics {KETCHUP_PROMETHEUS_PATH} (default "/metrics")
  -swaggerTitle string
        [swagger] API Title {KETCHUP_SWAGGER_TITLE} (default "API")
  -swaggerVersion string
        [swagger] API Version {KETCHUP_SWAGGER_VERSION} (default "1.0.0")
  -targetsDefaultPage uint
        [targets] Default page {KETCHUP_TARGETS_DEFAULT_PAGE} (default 1)
  -targetsDefaultPageSize uint
        [targets] Default page size {KETCHUP_TARGETS_DEFAULT_PAGE_SIZE} (default 20)
  -targetsMaxPageSize uint
        [targets] Max page size {KETCHUP_TARGETS_MAX_PAGE_SIZE} (default 100)
  -targetsName string
        [targets] Resource's name {KETCHUP_TARGETS_NAME} (default "Target of Ketchup")
  -targetsPath string
        [targets] HTTP Path {KETCHUP_TARGETS_PATH} (default "targets")
  -url string
        [alcotest] URL to check {KETCHUP_URL}
  -userAgent string
        [alcotest] User-Agent for check {KETCHUP_USER_AGENT} (default "Alcotest")

CI

Following variables are required for CI:

Name Purpose
DOCKER_USER for publishing Docker image
DOCKER_PASS for publishing Docker image
SCRIPTS_NO_INTERACTIVE for disabling prompt in CI

Directories

Path Synopsis
cmd
ketchup command
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL