projektmotor / docker-apache-load-balancer

Debian based docker image containing apache2 load balancer for use as reverse proxy and/or load balancer.
https://hub.docker.com/r/projektmotor/apache-load-balancer/
9 stars 6 forks source link
apache docker-image load-balancer reverse-proxy

APACHE2 Load Balancer

Build Status

Use Cases

What else:

Table of Content

  1. General Usage
  2. Load Balancer Mode
  3. Reverse Proxy Mode
  4. Build-In Scripts
  5. Examples with docker-compose

1. General Usage

Self-Signed Certificates with local CA

Certification warnings suck! To change this (for your self-signed certificate), you should be your own local CA. All you need is a root-key (myCA.key) & root-certificate (myCA.pem). These two things should be placed on your docker host and mounted to any docker container which uses self-signed certificates. Additionally the root-certificate must be added as CA on all devices (browsers) which execute requests against your ssl-host(s).

At the beginning of the command, the script asks for some certificate informations:

Country Name (2 letter code) [AU]:DE
State or Province Name (full name) [Some-State]:Saxony
Locality Name (eg, city) []:Leipzig
Organization Name (eg, company) [Internet Widgits Pty Ltd]:ProjektMOTOR GmbH
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:
Email Address []:noreply@projektmotor.de

Congrats, now you are your own CA! :] Stop... you are your own CA, but nobody knows about it! :/ To change this, you should add the earlier generated certificate as CA to your browser.

Persistence

Logging

In general it is a good idea to mount a host-folder to /var/log/apache2. This makes your apache log-files persistent and log debugging from the outside of the docker container quite easy.

$ docker run -it --rm \
      -v .../logs/:/var/log/apache2 \
      --name acme-load-balancer-container \
      projektmotor/apache-load-balancer:latest

2. Load Balancer Mode

Load Balancer with Self-Signed Certificate

3. Reverse Proxy Mode

Reverse Proxy with Self-Signed Certificate

4. Build-In Scripts

Loadbalancer Build-In Scripts

Reverseproxy Build-In Scripts

5. Examples with docker-compose

Run with docker-compose as a local dev-server