Skip to content
/ ketchup Public
generated from ViBiOh/goweb

Check update of your Github, Helm, Docker, NPM or Pypi dependencies every day

License

Notifications You must be signed in to change notification settings

ViBiOh/ketchup

Repository files navigation

ketchup

Build

Thanks to OpenEmoji for favicon.

Thanks to FontAwesome for icons.

Check your GitHub, Helm, Docker, NPM or Pypi dependencies every day or week at 8am and send a digest by email.

Features

  • Simple and plain HTML interface, mobile ready
  • Healthcheck available on /health endpoint
  • Version available on /version endpoint
  • OpenTelemetry
  • 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 data. Once setup, you have to to create schema with Auth DDL and Ketchup DDL. Configuration is done by passing -dbHost, -dbName, -dbUser, -dbPass args or setting equivalent environment variables (cf. Usage section).

You need a Redis instance for storing captcha token and distributed locks across multiples instances. Configuration is done by passing -redisAddress, -redisPassword, -redisDatabase args 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 example in the infra/ folder, using my app chart

Endpoints

Usage

The application can be configured by passing CLI args described below or their equivalent as environment variable. CLI values take precedence over environments variables.

Be careful when using the CLI values, if someone list the processes on the system, they will appear in plain-text. Pass secrets by environment variables: it's less easily visible.

Usage of ketchup:
  --address           string        [server] Listen address ${KETCHUP_ADDRESS}
  --cert              string        [server] Certificate file ${KETCHUP_CERT}
  --corsCredentials                 [cors] Access-Control-Allow-Credentials ${KETCHUP_CORS_CREDENTIALS} (default false)
  --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'; script-src 'self' 'httputils-nonce'; style-src 'self' 'httputils-nonce'")
  --dbHost            string        [db] Host ${KETCHUP_DB_HOST}
  --dbMaxConn         uint          [db] Max Open Connections ${KETCHUP_DB_MAX_CONN} (default 5)
  --dbMinConn         uint          [db] Min Open Connections ${KETCHUP_DB_MIN_CONN} (default 2)
  --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}
  --dockerPassword    string        [docker] Registry Password ${KETCHUP_DOCKER_PASSWORD}
  --dockerUsername    string        [docker] Registry Username ${KETCHUP_DOCKER_USERNAME}
  --frameOptions      string        [owasp] X-Frame-Options ${KETCHUP_FRAME_OPTIONS} (default "deny")
  --githubToken       string        [github] OAuth Token ${KETCHUP_GITHUB_TOKEN}
  --graceDuration     duration      [http] Grace duration when signal received ${KETCHUP_GRACE_DURATION} (default 30s)
  --hsts                            [owasp] Indicate Strict Transport Security ${KETCHUP_HSTS} (default true)
  --idleTimeout       duration      [server] Idle Timeout ${KETCHUP_IDLE_TIMEOUT} (default 2m0s)
  --key               string        [server] Key file ${KETCHUP_KEY}
  --loggerJson                      [logger] Log format as JSON ${KETCHUP_LOGGER_JSON} (default false)
  --loggerLevel       string        [logger] Logger level ${KETCHUP_LOGGER_LEVEL} (default "INFO")
  --loggerLevelKey    string        [logger] Key for level in JSON ${KETCHUP_LOGGER_LEVEL_KEY} (default "level")
  --loggerMessageKey  string        [logger] Key for message in JSON ${KETCHUP_LOGGER_MESSAGE_KEY} (default "msg")
  --loggerTimeKey     string        [logger] Key for timestamp in JSON ${KETCHUP_LOGGER_TIME_KEY} (default "time")
  --minify                          Minify HTML ${KETCHUP_MINIFY} (default true)
  --name              string        [server] Name ${KETCHUP_NAME} (default "http")
  --okStatus          int           [http] Healthy HTTP Status code ${KETCHUP_OK_STATUS} (default 204)
  --pathPrefix        string        Root Path Prefix ${KETCHUP_PATH_PREFIX}
  --port              uint          [server] Listen port (0 to disable) ${KETCHUP_PORT} (default 1080)
  --pprofAgent        string        [pprof] URL of the Datadog Trace Agent (e.g. http://datadog.observability:8126) ${KETCHUP_PPROF_AGENT}
  --pprofPort         int           [pprof] Port of the HTTP server (0 to disable) ${KETCHUP_PPROF_PORT} (default 0)
  --publicURL         string        Public URL ${KETCHUP_PUBLIC_URL} (default "https://ketchup.vibioh.fr")
  --readTimeout       duration      [server] Read Timeout ${KETCHUP_READ_TIMEOUT} (default 5s)
  --redisAddress      string slice  [redis] Redis Address host:port (blank to disable) ${KETCHUP_REDIS_ADDRESS}, as a string slice, environment variable separated by "," (default [127.0.0.1:6379])
  --redisDatabase     int           [redis] Redis Database ${KETCHUP_REDIS_DATABASE} (default 0)
  --redisMinIdleConn  int           [redis] Redis Minimum Idle Connections ${KETCHUP_REDIS_MIN_IDLE_CONN} (default 0)
  --redisPassword     string        [redis] Redis Password, if any ${KETCHUP_REDIS_PASSWORD}
  --redisPoolSize     int           [redis] Redis Pool Size (default GOMAXPROCS*10) ${KETCHUP_REDIS_POOL_SIZE} (default 0)
  --redisUsername     string        [redis] Redis Username, if any ${KETCHUP_REDIS_USERNAME}
  --shutdownTimeout   duration      [server] Shutdown Timeout ${KETCHUP_SHUTDOWN_TIMEOUT} (default 10s)
  --telemetryRate     string        [telemetry] OpenTelemetry sample rate, 'always', 'never' or a float value ${KETCHUP_TELEMETRY_RATE} (default "always")
  --telemetryURL      string        [telemetry] OpenTelemetry gRPC endpoint (e.g. otel-exporter:4317) ${KETCHUP_TELEMETRY_URL}
  --telemetryUint64                 [telemetry] Change OpenTelemetry Trace ID format to an unsigned int 64 ${KETCHUP_TELEMETRY_UINT64} (default true)
  --title             string        Application title ${KETCHUP_TITLE} (default "Ketchup")
  --url               string        [alcotest] URL to check ${KETCHUP_URL}
  --userAgent         string        [alcotest] User-Agent for check ${KETCHUP_USER_AGENT} (default "Alcotest")
  --writeTimeout      duration      [server] Write Timeout ${KETCHUP_WRITE_TIMEOUT} (default 10s)

Contributing

Thanks for your interest in contributing! There are many ways to contribute to this project. Get started here.

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