Skip to content

API Gateway of MODAPTO System acting as a Reverse Proxy and route communication to MODAPTO Components

License

Notifications You must be signed in to change notification settings

Modapto/api-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

modapto-api-gateway

Overview

API Gateway utilizes Traefik reverse proxy to route specific domains / subdomains to MODAPTO components.

It provides load balancing and firewall rules to enable or forbid specific communication from outside services. It secures the HTTP communication via HTTPS protocol.

Table of Contents

  1. Installation
  2. Deployment
  3. Usage
  4. LICENSE
  5. Contributors

Installation

Clone the repository:

git clone https://github.com/Modapto/api-gateway.git
cd api-gateway

Deployment

  1. Install or make sure Docker is running

  2. Create a hashed password for a specific user and update the traefik_dynamic.toml file under the config folder with the following:

    # Generate a hashed password using htpasswd
    htpasswd -nb [user] [password]
    
    # Copy the generated password and configure the dynamic config
    [hostPath] = URL of the Traefic Dashboard (if enabled)
    [user]:[hashedPassword] = Copy the contents of the generated hashed value
    
    # Configure your email on traefik.toml
    [email]: Your personal email
    
  3. Deploy API Gateway from Docker Compose:

    docker compose up -d
  4. After some time Traefik dashboard will be available on: https://[hostPath].

  5. To terminate Docker compose simply run:

    docker compose down

Usage

For each new component that will de deployed through API Gateway we must define the following labels in each docker compose configuration:

        - traefik.enable=true
        - traefik.http.routers.[containerName]=true
        - traefik.http.routers.[containerName].rule=Host(`[desiredURLPath]`)
        - traefik.http.routers.[containerName].tls=true
        - traefik.http.routers.[containerName].tls.certresolver=lets-encrypt
        - traefik.http.middlewares.securityHeader.headers.sslredirect=true
        - traefik.http.routers.[containerName].middlewares=securityHeader
        - traefik.http.services.notification-center.loadbalancer.server.port=[containerPort]

        # Optionally we can configure a PathPrefix in the Host Role
        - traefik.http.routers.[containerName].rule=Host(`[desiredURLPath]`) && PathPrexix(`[desiredPathPreix]`)

LICENSE

This project has received funding from the European Union's Horizon 2022 research and innovation programm, under Grant Agreement 101091996.

For more details about the licence, see the LICENSE file.

Contributors

About

API Gateway of MODAPTO System acting as a Reverse Proxy and route communication to MODAPTO Components

Resources

License

Stars

Watchers

Forks

Packages

No packages published