Giter Site home page Giter Site logo

sigsci-container's Introduction

thermondo sigsci container

Run the Signal Sciences WAF ("sigsci") agent in reverse proxy mode alongside your app in the same container.

docker pull ghcr.io/thermondo/sigsci

Why?

Signal Sciences offers several integration options including a containerized option, but it assumes that you're using Kubernetes.

The recommended way to run the SigSci agent would be with a separate container while using Kubernetes, Docker Compose, etc., however there are cases where you really want to do everything in one container (such as when you're running in Heroku, which has limited Docker support).

This container image is especially developed for Heroku, though it can be used in probably any context.

General Info

This is meant to be used as a base image for your own containers. When you base your container on this image, you can configure the sigsci agent to filter all incoming HTTP requests through the WAF before they get to your application.

This container image comes in a few variants:

It should be trivial to create other similar "flavors" of the image as needed.

Configuration

The sigsci agent can be configured via environment variables. The most notable ones:

sigsci auth settings

  • SIGSCI_ACCESSKEYID: access key ID
  • SIGSCI_SECRETACCESSKEY: the secret portion of the access key

these settings are best configured in Heroku, not hard-coded

port settings

  • PORT: (this is set automatically by Heroku) -- the port number the sigsci agent should listen on
  • APP_PORT: the port that YOUR application should listen on. the sigsci agent will forward traffic to this port.

The PORT and APP_PORT values must be different. Keep in mind that Heroku assigns a random number to the PORT variable at runtime, in the range of 3000 - 60000 for common runtime apps. So it's best to hard-code your APP_PORT in your Dockerfile (recommended anywhere between 1025 and 2999). This will guarantee you don't have any port conflicts when Heroku tries to set the PORT variable at runtime.

startup settings

The container will only start the sigsci agent after your app is running. It knows your app is running when it responds to an HTTP request on a configured HTTP endpoint.

  • SIGSCI_WAIT_ENDPOINT: (optional) the HTTP endpoint that indicates your service is running. you could set this to something like ht or version, for example. the default value is an empty string, so the startup script will just ping http://127.0.0.1:${APP_PORT}/ if you don't configure it at all.
  • SIGSCI_WAIT_TIMEOUT: (optional) defaults to 60 seconds. if your app's "wait endpoint" doesn't respond within this time, the container will stop with an error code.
  • SIGSCI_STATUS: (optional) defaults to enabled. set this environment variable to disabled and it will just run your app without the firewall. In this case the container will change the APP_PORT env variable to match PORT if PORT is defined.

Example Python Dockerfile:

FROM ghcr.io/thermondo/sigsci:python-3.11
ARG DEBIAN_FRONTEND=noninteractive

# Configure All The Things here as usual

ENV APP_PORT=2000
ENV SIGSCI_WAIT_ENDPOINT=ht
CMD [ "poetry", "run", "python", "runserver.py", "0:${APP_PORT}" ]

Important Notes

  • The base image uses an ENTRYPOINT script to launch the sigsci agent after your app is up and running. This means you should not use ENTRYPOINT in your own Dockerfile unless you know what you're doing. If you use CMD instead, the base image's entrypoint script will execute that command for you.

sigsci-container's People

Contributors

pcrock-thmdo avatar zahidkizmaz avatar dependabot[bot] avatar

Watchers

Nathan Mkaya avatar  avatar ./root avatar Sami Fahed avatar Ali Jahanpak avatar Daniel Rios avatar Dean Jürges avatar  avatar  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.