Skip to main content

a dead-simple backplane for Dockerized applications

Project description

backplane

A dead-simple backplane for your Docker containers.

  • Traefik reverse-proxy for your containers
  • Portainer management dashboard for Docker

Get started

pip install backplane
backplane install
backplane start

You can now visit the dashboards of both services in your browser:

Configure your containers

To expose one of your services through Traefik, your service needs to be part of the backplane Docker network and carry a few Traefik-relevant labels:

docker

docker run \
--network backplane \
--label "traefik.enable=true" \
--label "traefik.http.routers.whoami.rule=Host(\`whoami.here.ns0.co\`)" \
--label "traefik.http.routers.whoami.entrypoints=http" \
--rm traefik/whoami

Visit http://whoami.here.ns0.co to verify it worked.

docker-compose

version: "3.3"

services:
  whoami:
    image: "traefik/whoami"
    container_name: "simple-service"
    networks:
      - backplane
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule=Host(`whoami.here.ns0.co`)"
      - "traefik.http.routers.whoami.entrypoints=http"
      - "traefik.docker.network=backplane"

networks:
  backplane:
    name: backplane
    external: true

Visit http://whoami.here.ns0.co to verify it worked.

Use in production

backplane can be used on public cloud hosts, too:

backplane install --environment production --domain mydomain.com --mail letsencrypt@mydomain.com
backplane start

This enables the following additional features:

  • access your backplane services through mydomain.com (NOTE: if you do not specify a domain, backplane will use a wildcard domain based on the IP of your server, like 127-0-0-1.nip.io)
  • automatic SSL for your containers through LetsEncrypt
  • configurable HTTP to HTTPS redirect
  • sane security defaults

docker

docker run \
--network backplane \
--label "traefik.enable=true" \
--label "traefik.http.routers.whoami.rule=Host(\`whoami.here.ns0.co\`)" \
--label "traefik.http.routers.whoami.entrypoints=http" \
--label "traefik.http.routers.whoami.middlewares=compress@docker" \
--label "traefik.http.routers.whoami.middlewares=https-redirect@docker" \
--label "traefik.http.routers.whoami-secure.entrypoints=https" \
--label "traefik.http.routers.whoami-secure.rule=Host(\`whoami.mydomain.com\`)" \
--label "traefik.http.routers.whoami-secure.tls=true" \
--label "traefik.http.routers.whoami-secure.tls.certresolver=letsencrypt" \
--label "traefik.http.routers.whoami-secure.middlewares=secured@docker" \
--label "traefik.http.routers.whoami-secure.middlewares=compress@docker" \
--rm traefik/whoami

docker-compose

version: "3.3"

services:
  whoami:
    image: "traefik/whoami"
    container_name: "simple-service"
    networks:
      - backplane
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.entrypoints=http"
      - "traefik.http.routers.whoami.rule=Host(`whoami.mydomain.com`)"
      - "traefik.http.routers.whoami.middlewares=compress@docker"
      - "traefik.http.routers.whoami.middlewares=https-redirect@docker"
      - "traefik.http.routers.whoami-secure.entrypoints=https"
      - "traefik.http.routers.whoami-secure.rule=Host(`whoami.mydomain.com`)"
      - "traefik.http.routers.whoami-secure.tls=true"
      - "traefik.http.routers.whoami-secure.tls.certresolver=letsencrypt"
      - "traefik.http.routers.whoami-secure.middlewares=secured@docker"
      - "traefik.http.routers.whoami-secure.middlewares=compress@docker"
      - "traefik.docker.network=backplane"

networks:
  backplane:
    name: backplane
    external: true

Use the Runner

Update your ssh config

Add the following to ~/.ssh/config. This allows you to reach the runner under backplane without further configuration.

Host backplane
    HostName 127.0.0.1
    User backplane
    Port 2222

Update your git remote

Assuming your repository is called myapp, this is how you add the backplane runner to your git remotes:

git remote add origin "git@backplane:myapp"

Configure your application

These are

BACKPLANE_COMPOSE_FILE=docker-compose.yml
BACKPLANE_ENV_FILE=.env

Development

Dependencies

pip install poetry
poetry shell
poetry install
npm i -g standard-version

Build

poetry build

Publish

poetry publish

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

backplane-0.1.23.tar.gz (13.1 kB view hashes)

Uploaded Source

Built Distribution

backplane-0.1.23-py3-none-any.whl (12.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page