Skip to content

Commit

Permalink
switch to traefik
Browse files Browse the repository at this point in the history
  • Loading branch information
khanzadimahdi committed Jan 7, 2025
1 parent 24c1572 commit fdef912
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 58 deletions.
1 change: 1 addition & 0 deletions .github/workflows/infrastructure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }}

permissions:
packages: write
contents: read

needs:
Expand Down
4 changes: 2 additions & 2 deletions proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM nginx:1.26-alpine
FROM traefik:v3.3

COPY ./nginx.conf /etc/nginx/conf.d/default.conf
COPY ./traefik.yml /etc/traefik/traefik.yml

EXPOSE 80
56 changes: 0 additions & 56 deletions proxy/nginx.conf

This file was deleted.

70 changes: 70 additions & 0 deletions proxy/traefik.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
http:
routers:
# Catch-all router for unmatched subdomains
catch-all:
rule: "HostRegexp(`{subdomain:[a-z0-9-]+}.*`)"
entryPoints:
- web
service: frontend-service
middlewares:
- headers

# Backend subdomain
backend:
rule: "Host(`backend.{subdomain:[a-z0-9-]+}.*`)"
entryPoints:
- web
service: app-service
middlewares:
- headers

# Docker Dashboard subdomain
dockerdashboard:
rule: "Host(`dockerdashboard.{subdomain:[a-z0-9-]+}.*`)"
entryPoints:
- web
service: docker-dashboard-service
middlewares:
- headers

# MongoDB Dashboard subdomain
mongodashboard:
rule: "Host(`mongodashboard.{subdomain:[a-z0-9-]+}.*`)"
entryPoints:
- web
service: mongodb-dashboard-service
middlewares:
- headers

services:
frontend-service:
loadBalancer:
servers:
- url: "http://frontend:3000"

app-service:
loadBalancer:
servers:
- url: "http://app:80"

docker-dashboard-service:
loadBalancer:
servers:
- url: "http://docker_dashboard:9000"

mongodb-dashboard-service:
loadBalancer:
servers:
- url: "http://mongodb_dashboard:8081"

middlewares:
headers:
headers:
customRequestHeaders:
X-Real-IP: "{remote_ip}"
X-Forwarded-For: "{remote_ip}"
X-Forwarded-Proto: "{scheme}"

entryPoints:
web:
address: ":80"

0 comments on commit fdef912

Please sign in to comment.