2
0
Fork 0

Basic traefik

pull/6/head
UnicodingUnicorn 2019-02-20 02:00:59 +08:00
parent 535b246b70
commit c62eadb84e
3 changed files with 158 additions and 22 deletions

@ -1 +1 @@
Subproject commit 26d72fe8743639812a2cf4052250026e65b345dc
Subproject commit 8f6481ecf5d09010a91003182e963a1854e18f50

View File

@ -1,5 +1,25 @@
version: "3"
services:
traefik:
image: traefik
command: --configfile=/traefik.toml
depends_on:
- core
- signal
- heartbeat
- bite
- publish
- subscribe
- transcription
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- ./traefik.toml:/traefik.toml
networks:
- traefiknet
pg:
build: ./backend-core/postgres
environment:
@ -33,21 +53,20 @@ services:
depends_on:
- pg
environment:
- LISTEN=:10200
- LISTEN=:80
- POSTGRES=postgresql://root@pg:5432/core?sslmode=disable
ports:
- "10200:10200"
networks:
- pgnet
- traefiknet
signal:
build: ./backend-signal
tty: true
restart: unless-stopped
environment:
- PORT=10201
ports:
- "10201:10201"
- PORT=80
networks:
- traefiknet
heartbeat:
build: ./backend-heartbeat
@ -56,12 +75,11 @@ services:
depends_on:
- redis
environment:
- LISTEN=:10203
- LISTEN=:80
- REDIS=redis:6379
ports:
- "10203:10203"
networks:
- redisnet
- traefiknet
login:
build: ./backend-login
@ -81,12 +99,11 @@ services:
depends_on:
- nats
environment:
- LISTEN=:10202
- LISTEN=:80
- NATS=nats://nats:4222
ports:
- "10202:10202"
networks:
- natsnet
- traefiknet
publish:
build: ./backend-publish
@ -95,13 +112,12 @@ services:
depends_on:
- nats
environment:
- LISTEN=:10205
- LISTEN=:80
- NATS=nats://nats:4222
- SECRET=secret
ports:
- "10205:10205"
networks:
- natsnet
- traefiknet
store:
build: ./backend-store
@ -122,12 +138,11 @@ services:
depends_on:
- nats
environment:
- LISTEN=:10206
- LISTEN=:80
- NATS=nats://nats:4222
ports:
- "10206:10206"
networks:
- natsnet
- traefiknet
transcription:
build: ./backend-transcription
@ -136,15 +151,15 @@ services:
depends_on:
- nats
environment:
- LISTEN=:10207
- LISTEN=:80
- NATS=nats://nats:4222
- API_KEY=AIzaSyDxSXDefzw9gXCQaVzOCYlRn_vcC9Da9Q0
ports:
- "10207:10207"
networks:
- natsnet
- traefiknet
networks:
pgnet:
natsnet:
redisnet:
traefiknet:

121
traefik.toml Normal file
View File

@ -0,0 +1,121 @@
[api]
dashboard = true
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.traefik]
address = ":8080"
[file]
# Core
[backends.core]
[backends.core.servers.one]
url = "http://core"
[frontends.core]
backend = "core"
entrypoints = ["http", "https"]
[frontends.core.headers.customresponseheaders]
Access-Control-Allow-Origin = "*"
Access-Control-Allow-Headers = "Content-Type, Authorization"
Access-Control-Allow-Credentials = "true"
Access-Control-Allow-Methods = "GET, HEAD, POST, PUT, PATCH, DELETE"
[frontends.core.routes.one]
rule = "PathPrefix: /core/"
# Signal
[backends.signal]
[backends.signal.servers.one]
url = "http://signal"
[frontends.signal]
backend = "signal"
entrypoints = ["http", "https"]
[frontends.signal.headers.customresponseheaders]
Access-Control-Allow-Origin = "*"
Access-Control-Allow-Headers = "Content-Type, Authorization"
Access-Control-Allow-Credentials = "true"
Access-Control-Allow-Methods = "GET, HEAD, POST, PUT, PATCH, DELETE"
[frontends.signal.routes.one]
rule = "PathPrefix: /signal/"
# Heartbeat
[backends.heartbeat]
[backends.heartbeat.servers.one]
url = "http://heartbeat"
[frontends.heartbeat]
backend = "heartbeat"
entrypoints = ["http", "https"]
[frontends.heartbeat.headers.customresponseheaders]
Access-Control-Allow-Origin = "*"
Access-Control-Allow-Headers = "Content-Type, Authorization"
Access-Control-Allow-Credentials = "true"
Access-Control-Allow-Methods = "GET, HEAD, POST, PUT, PATCH, DELETE"
[frontends.heartbeat.routes.one]
rule = "PathPrefix: /heartbeat/"
# Bite
[backends.bite]
[backends.bite.servers.one]
url = "http://bite"
[frontends.bite]
backend = "bite"
entrypoints = ["http", "https"]
[frontends.bite.headers.customresponseheaders]
Access-Control-Allow-Origin = "*"
Access-Control-Allow-Headers = "Content-Type, Authorization"
Access-Control-Allow-Credentials = "true"
Access-Control-Allow-Methods = "GET, HEAD, POST, PUT, PATCH, DELETE"
[frontends.bite.routes.one]
rule = "PathPrefix: /bite/"
# Publish
[backends.publish]
[backends.publish.servers.one]
url = "http://publish"
[frontends.publish]
backend = "publish"
entrypoints = ["http", "https"]
[frontends.publish.headers.customresponseheaders]
Access-Control-Allow-Origin = "*"
Access-Control-Allow-Headers = "Content-Type, Authorization"
Access-Control-Allow-Credentials = "true"
Access-Control-Allow-Methods = "GET, HEAD, POST, PUT, PATCH, DELETE"
[frontends.publish.routes.one]
rule = "PathPrefix: /publish/"
# Subscribe
[backends.subscribe]
[backends.subscribe.servers.one]
url = "http://subscribe"
[frontends.subscribe]
backend = "subscribe"
entrypoints = ["http", "https"]
[frontends.subscribe.headers.customresponseheaders]
Access-Control-Allow-Origin = "*"
Access-Control-Allow-Headers = "Content-Type, Authorization"
Access-Control-Allow-Credentials = "true"
Access-Control-Allow-Methods = "GET, HEAD, POST, PUT, PATCH, DELETE"
[frontends.subscribe.routes.one]
rule = "PathPrefix: /subscribe/"
# transcription
[backends.transcription]
[backends.transcription.servers.one]
url = "http://transcription"
[frontends.transcription]
backend = "transcription"
entrypoints = ["http", "https"]
[frontends.transcription.headers.customresponseheaders]
Access-Control-Allow-Origin = "*"
Access-Control-Allow-Headers = "Content-Type, Authorization"
Access-Control-Allow-Credentials = "true"
Access-Control-Allow-Methods = "GET, HEAD, POST, PUT, PATCH, DELETE"
[frontends.transcription.routes.one]
rule = "PathPrefix: /transcription/"