Compare commits
3 Commits
6e9c0f0442
...
add-route-
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a2fb750a0 | |||
| 1d30d5afad | |||
| ef466353b8 |
33
prod/route-to-staging-dev.yaml
Normal file
33
prod/route-to-staging-dev.yaml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
http:
|
||||||
|
routers:
|
||||||
|
# Router for HTTP (Port 80)
|
||||||
|
staging:
|
||||||
|
rule: "HostRegexp(`^.+\\.staging\\.kovagoadi\\.hu$`) || HostRegexp(`^.+\\.dev\\.kovagoadi\\.hu$`)"
|
||||||
|
entryPoints:
|
||||||
|
- "web"
|
||||||
|
service: "dev-staging"
|
||||||
|
priority: 1000
|
||||||
|
services:
|
||||||
|
dev-staging:
|
||||||
|
loadBalancer:
|
||||||
|
servers:
|
||||||
|
- url: "http://staging:8080"
|
||||||
|
|
||||||
|
tcp:
|
||||||
|
routers:
|
||||||
|
# Router for HTTPS (Passthrough)
|
||||||
|
dev-staging-secure:
|
||||||
|
rule: "HostSNIRegexp(`^.+\\.staging\\.kovagoadi\\.hu$`) || HostSNIRegexp(`^.+\\.dev\\.kovagoadi\\.hu$`)"
|
||||||
|
service: "dev-staging-secure"
|
||||||
|
# Passthrough must be true for SSL to reach Nginx encrypted
|
||||||
|
tls:
|
||||||
|
passthrough: true
|
||||||
|
priority: 1000
|
||||||
|
entryPoints:
|
||||||
|
- "https"
|
||||||
|
services:
|
||||||
|
dev-staging-secure:
|
||||||
|
loadBalancer:
|
||||||
|
servers:
|
||||||
|
# Note: Ensure Traefik trusts the cert at .85 or set insecureSkipVerify
|
||||||
|
- address: "staging:445"
|
||||||
@@ -7,8 +7,8 @@ DOMAIN = os.getenv("DOMAIN", "dev.kovagoadi.hu")
|
|||||||
PORT = os.getenv("PORT", "898")
|
PORT = os.getenv("PORT", "898")
|
||||||
HTTPS_PORT = os.getenv("HTTPS_PORT", "446")
|
HTTPS_PORT = os.getenv("HTTPS_PORT", "446")
|
||||||
|
|
||||||
BASE_URL = f"http://127.0.0.1:{PORT}"
|
BASE_URL = f"http://192.168.1.85:{PORT}"
|
||||||
HTTPS_BASE_URL = f"https://127.0.0.1:{HTTPS_PORT}"
|
HTTPS_BASE_URL = f"https://192.168.1.85:{HTTPS_PORT}"
|
||||||
HOST_HEADER = f"test-whoami.{DOMAIN}"
|
HOST_HEADER = f"test-whoami.{DOMAIN}"
|
||||||
|
|
||||||
@pytest.fixture(scope="session", autouse=True)
|
@pytest.fixture(scope="session", autouse=True)
|
||||||
@@ -122,7 +122,7 @@ def test_whoami_https_reachable():
|
|||||||
# We use curl because requests doesn't support --resolve easily to force SNI with custom IP
|
# We use curl because requests doesn't support --resolve easily to force SNI with custom IP
|
||||||
cmd = [
|
cmd = [
|
||||||
"curl", "-s", "-k", "--fail",
|
"curl", "-s", "-k", "--fail",
|
||||||
"--resolve", f"{HOST_HEADER}:{HTTPS_PORT}:127.0.0.1",
|
"--resolve", f"{HOST_HEADER}:{HTTPS_PORT}:192.168.1.85",
|
||||||
f"https://{HOST_HEADER}:{HTTPS_PORT}"
|
f"https://{HOST_HEADER}:{HTTPS_PORT}"
|
||||||
]
|
]
|
||||||
try:
|
try:
|
||||||
@@ -159,7 +159,7 @@ def test_unknown_host_https_passthrough():
|
|||||||
# unknown.com should hit the catch-all SNI router
|
# unknown.com should hit the catch-all SNI router
|
||||||
cmd = [
|
cmd = [
|
||||||
"curl", "-s", "-k", "-i", "--fail",
|
"curl", "-s", "-k", "-i", "--fail",
|
||||||
"--resolve", f"tar.kovagoadi.hu:{HTTPS_PORT}:127.0.0.1",
|
"--resolve", f"tar.kovagoadi.hu:{HTTPS_PORT}:192.168.1.85",
|
||||||
f"https://tar.kovagoadi.hu:{HTTPS_PORT}/login"
|
f"https://tar.kovagoadi.hu:{HTTPS_PORT}/login"
|
||||||
]
|
]
|
||||||
try:
|
try:
|
||||||
@@ -193,7 +193,7 @@ def test_staging_https_routing():
|
|||||||
host = "test-whoami.staging.kovagoadi.hu"
|
host = "test-whoami.staging.kovagoadi.hu"
|
||||||
cmd = [
|
cmd = [
|
||||||
"curl", "-s", "-k", "-i", "--fail",
|
"curl", "-s", "-k", "-i", "--fail",
|
||||||
"--resolve", f"{host}:{HTTPS_PORT}:127.0.0.1",
|
"--resolve", f"{host}:{HTTPS_PORT}:192.168.1.85",
|
||||||
f"https://{host}:{HTTPS_PORT}"
|
f"https://{host}:{HTTPS_PORT}"
|
||||||
]
|
]
|
||||||
try:
|
try:
|
||||||
@@ -209,7 +209,7 @@ def test_dev_https_routing():
|
|||||||
host = "test-whoami.dev.kovagoadi.hu"
|
host = "test-whoami.dev.kovagoadi.hu"
|
||||||
cmd = [
|
cmd = [
|
||||||
"curl", "-s", "-k", "-i", "--fail",
|
"curl", "-s", "-k", "-i", "--fail",
|
||||||
"--resolve", f"{host}:{HTTPS_PORT}:127.0.0.1",
|
"--resolve", f"{host}:{HTTPS_PORT}:192.168.1.85",
|
||||||
f"https://{host}:{HTTPS_PORT}"
|
f"https://{host}:{HTTPS_PORT}"
|
||||||
]
|
]
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user