GithubHelp home page GithubHelp logo

uptime-probe's Introduction

CircleCI

Uptime Probe

This probe checks a set of websites and exposes the results as prometheus metrics. These metrics are used on an alert that triggers if any of the configured sites can't be accessed by the probe.

Configuration

The binary created with cargo build accepts one single argument, the path to a configuration file which defines the sites to check. An example is provided in the repo here.

When the binary is deployed to the kubernetes production cluster it uses this configmap for getting the configuration settings.

Files

These are the main directories in the repo:

  • charts: contains the uptime-probe helm chart, besides the deployment and service resources it contains manifests for these custom resources:

    • servicemonitor: allows to scrape metrics from uptime-probe.

    • configmap: basic configuration of the probe, including the set of websites to ccheck.

  • .circleci: defines the CI/CD configuration.

  • scripts: contains:

    • integration-tests.sh: automated checks to verify that the components can be properly deployed.

    • deploy.sh: commands to release the application to the production cluster using the published chart.

  • src, Cargo.*: code for uptime-probe and additional Rust project files.

  • Dockerfile: definition of the image used to deploy the probe. It consists on a multi-stage DDocker build, with a first stage that generates a static binary from Rust source files and a second stage which puts this binary on an Alpine image, resulting in a very lightweight final image (~7Mb).

Environment variables

In order to be able to deploy to production, these environment variables must be available:

  • $DIGITALOCEAN_ACCESS_TOKEN

  • $GITHUB_BOT_TOKEN

  • $DOCKER_USER

  • $DOCKER_PASSWORD

These values are already set on CI, and are available on 1Password, under the Infrastructure vault, the GitHub bot token in an item called GitHub bot, the Docker credentials in an item called Docker Hub Bot and the Digital Ocean access token in the DigitalOcean API credentials item.

CI/CD Workflow

When a PR is proposed to this repo, the integration tests defined by scripts/integration-tests.sh are executed on a Kubernetes cluster created on CI using the code from the PR, currently they just check that the component can be deployed and deleted without errors.

After the PR is merged into master, when a semantic version tag (vX.Y.Z) is pushed the tests are run again and, if all is ok, the chart is published and the probe is deployed to production. Note that the tag version pushed must match the version in ./charts/uptime-probe/Chart.yaml

Running tests

Tests can be run and debugged locally, you need to have docker and CircleCI CLI installed, then run:

$ circleci local execute --job cargoTests

for Cargo tests and:

$ circleci local execute --job integrationTests

for e2e integration tests (involving k8s component deployment).

uptime-probe's People

Contributors

fgimenez avatar ironoa avatar nexus2k avatar pampatzoglou avatar

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.