# tarampampam/3proxy-docker architecture

> Architecture diagram of the GitHub repository tarampampam/3proxy-docker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tarampampam/3proxy-docker
- Repository: https://github.com/tarampampam/3proxy-docker

## Overview

##### Main Components
- Docker Build & Image Component:
– The Dockerfile at the root is responsible for building the container image that packages 3proxy.
– Additional files (.dockerignore, .editorconfig, 3proxy configuration templates, etc.) support the Docker build process.
- 3proxy Service:
– At runtime, the container runs the 3proxy proxy server. Emphasize that it handles two main services: HTTP proxy on port 3128 and SOCKS proxy on port 1080 (by default, configurable via environment variables).
- Configuration & Environment Variables:
– Include the environment variable settings (such as PROXY_LOGIN, PROXY_PASSWORD, PRIMARY_RESOLVER, etc.) as they determine the behavior and customization of the 3proxy service.
– Show how additional configuration (EXTRA_CONFIG) can be appended.
- Kubernetes & Helm Deployment:
– In the deployments/helm directory, a Helm chart is provided (Chart.yaml and related templates) to deploy this Docker image on K8s.
– Represent the relationship between the Helm chart and the containerized service.
- Continuous Integration/Deployment:
– The .github/workflows directory includes CI/CD pipelines for tests, release, and documentation. Although not directly part of the runtime architecture, they assure streamlined builds and deployments.

##### Relationships and Interactions
- Docker Build Process:
- Container Execution:
– Show that when the container runs (via docker run or as part of K8s/Helm deployment), environment variables are injected to adjust the proxy’s behavior.
- Deployment Modes:
– For local Docker deployments, highlight the command-line examples where ports are mapped and environment variables are set.
– For Kubernetes deployments, illustrate how the Helm chart templates are used to generate a deployment and service that runs the container on a K8s cluster.
- CI/CD Pipelines:
– Optionally, include a separate area showing how GitHub workflows trigger automated builds, testing, and releases that ultimately push new images to registries (Docker Hub and GitHub Container Registry).

##### Architectural Patterns and Technologies
- Containerization:
– The Dockerfile and related configuration files reflect a containerized microservice approach.
- Configuration via Environment Variables:
– Highlight the design principle of making the image configurable at run time, which is key for flexibility in different deployment environments.
- Helm Chart for Kubernetes:
– The separation of concerns is clear with Helm templates managing K8s deployments. This aligns with best practices for deploying containerized applications.
- CI/CD:
– Focus on automation as per GitHub Actions for building, testing, and releasing the image.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Source Code & Config"
        dockerfile["Dockerfile"]:::source
        dockerignore[".dockerignore"]:::source
        editorconfig[".editorconfig"]:::source
        proxyJson["3proxy.cfg.json"]:::source
        proxyMustache["3proxy.cfg.mustach"]:::source
    end

    ci_cd["CI/CD Pipelines (GitHub Actions)"]:::ci

    build["Docker Build Process"]:::build

    runtime["3proxy Container (Runtime)"]:::runtime

    helm["Helm Chart Deployment (Kubernetes)"]:::helm

    %% Relationships from CI/CD and source code to Docker Build Process
    ci_cd -->|"build_trigger"| build
    dockerfile -->|"source_config"| build
    dockerignore -->|"source_config"| build
    editorconfig -->|"source_config"| build
    proxyJson -->|"source_config"| build
    proxyMustache -->|"source_config"| build

    %% Relationships from Build Process to Runtime and Helm
    build -->|"docker_run_env_injection"| runtime
    build -->|"helm_packaging"| helm
    helm -->|"k8s_deploy"| runtime

    %% External Network Traffic into the 3proxy Container
    http["External HTTP Traffic (3128)"]:::runtime
    socks["External SOCKS Traffic (1080)"]:::runtime
    http -->|"port_3128"| runtime
    socks -->|"port_1080"| runtime

    %% Click Events
    click dockerfile "https://github.com/tarampampam/3proxy-docker/tree/master/Dockerfile"
    click dockerignore "https://github.com/tarampampam/3proxy-docker/blob/master/.dockerignore"
    click editorconfig "https://github.com/tarampampam/3proxy-docker/blob/master/.editorconfig"
    click proxyJson "https://github.com/tarampampam/3proxy-docker/blob/master/3proxy.cfg.json"
    click proxyMustache "https://github.com/tarampampam/3proxy-docker/blob/master/3proxy.cfg.mustach"
    click helm "https://github.com/tarampampam/3proxy-docker/tree/master/deployments/helm"
    click ci_cd "https://github.com/tarampampam/3proxy-docker/tree/master/.github/workflows"

    %% Styles
    classDef source fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef ci fill:#FFFF99,stroke:#000,stroke-width:1px;
    classDef build fill:#FFA07A,stroke:#000,stroke-width:1px;
    classDef runtime fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef helm fill:#DDA0DD,stroke:#000,stroke-width:1px;
```
