Skip to main content

Introduction

This guide provides a step-by-step approach to deploying an edge architecture in a Docker Swarm environment. We will set up HAProxy as a front proxy to Traefik, which will handle routing to backend services. Additionally, we will integrate GoAccess for real-time traffic analytics, allowing us to monitor and analyze incoming traffic effectively.

Prerequisite

  • Docker Swarm cluster with at least one manager and worker node.
  • Basic understanding of Docker, Traefik, HAProxy, and GoAccess.

Logical Diagram

Overview

In this guide, we will cover the following steps:
  1. Deploy HAProxy as a front proxy in Docker Swarm.
  2. Configure Traefik as a reverse proxy behind HAProxy.
  3. Set up GoAccess for real-time traffic analytics.

Step 1: Deploy HAProxy

Create a Docker Compose file for HAProxy:

Step 2: Configure haproxy.cfg

Create the HAProxy configuration file (haproxy.cfg):