GithubHelp home page GithubHelp logo

traefik-maintenance-plugin's Introduction

Traefik Maintenance Plugin by Programic

Traefik maintenance plugin to show visitors a maintenance page. Useful when upgrading a production environment.

Hosts (by regex) that are under maintenance are retrieved using an http request to an inform url. Permitted ips are retained (such as development team) and other visitors receive a maintenance page with status code 503 Service Unavailable.

This plugin returns the correct response based on the Content-Type header. Currently supported: application/json, text/plain and text/html.

Configuration

The test directory shows a fully working setup for using this plugin in combination with Traefik in Docker. You can use this configuration for your own project. Below an explanation.

The following declaration (given here in YAML) defines a plugin:

# Static configuration

experimental:
  maintenance:
    moduleName: github.com/programic/traefik-maintenance-plugin
    version: "v0.0.1" # Grep the latest version 

Here is an example of a file provider dynamic configuration (given here in YAML), where the interesting part is the http.middlewares section:

# Dynamic configuration

http:
  middlewares:
    maintenance: # Middleware name
      plugin:
        maintenance: # Plugin name
          informUrl: "http://inform/inform.json"
          informInterval: 60
          informTimeout: 5

Properties

  • informUrl (required): Url to the inform.json to check if hosts are under maintenance. In directory test/services/inform/inform.json is an example.
  • informInterval (optional): Every how many seconds should the inform url be consulted.
  • informTimeout (optional): The timeout of the inform url.

Local development

To test this plugin for local development, you can do the following.

Prerequisites

  • docker and docker-compose installed.
  • *.test refers to your local development environment through dnsmasq.

1. Start the local development environment

$ cd test
$ docker-compose up -d

2. Open your browser

  1. Go to maintenance.test.
  2. You will now see a maintenance page or a welcome page.
  3. Change the ip in file test/services/inform/inform.json to your Docker network ip.
  4. Go back to the maintenance.test and see what happened.
  5. Check what a json or png response looks like.

3. Happy coding!

You can now edit the plugin locally. Don't forget to restart Docker every time:

$ docker-compose down && docker-compose up -d

traefik-maintenance-plugin's People

Contributors

remcowolvenne avatar

Watchers

 avatar Jeffrey van den Hondel avatar  avatar

traefik-maintenance-plugin's Issues

[Traefik Plugin Catalog] Plugin Analyzer has detected a problem.

The plugin was not imported into Traefik Plugin Catalog.

Cause:

failed to get the latest tag: missing tag/version

Traefik Plugin Analyzer will restart when you will close this issue.

If you believe there is a problem with the Analyzer or this issue is the result of a false positive, please contact us.

No license information

We're planning on using this helpful plugin, and we noticed that there is no license listed for this repository. We have some ideas of how we'd like to extend it as well, but we don't want to infringe on your rights as a developer. Would it be possible to add a license to let us know how we are allowed to use the code?

[Traefik Plugin Catalog] Plugin Analyzer has detected a problem.

The plugin was not imported into Traefik Plugin Catalog.

Cause:

failed to get the latest tag: missing tag/version

Traefik Plugin Analyzer will restart when you will close this issue.

If you believe there is a problem with the Analyzer or this issue is the result of a false positive, please contact us.

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.