diff --git a/config.yml b/config.yml index d829cbd7..dcf91676 100644 --- a/config.yml +++ b/config.yml @@ -4,7 +4,7 @@ version: "2" services: reverse-proxy: - image: traefik:v2.2.1 + image: traefik:v2.9 container_name: traefik.sphinx restart: unless-stopped networks: @@ -34,6 +34,8 @@ services: # So that Traefik can listen to the Docker events - /var/run/docker.sock:/var/run/docker.sock - /home/admin/letsencrypt:/letsencrypt + environment: + - AWS_REGION=$AWS_REGION logging: options: max-size: 10m diff --git a/docker-compose.yml b/docker-compose.yml index 6782d82b..42bf13a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: load_balancer: - image: traefik:v2.2.1 + image: traefik:v2.9 container_name: load_balancer restart: unless-stopped networks: @@ -32,6 +32,8 @@ services: # So that Traefik can listen to the Docker events - /var/run/docker.sock:/var/run/docker.sock - /home/admin/letsencrypt:/letsencrypt + environment: + - AWS_REGION=$AWS_REGION logging: options: max-size: 10m diff --git a/second-brain.yml b/second-brain.yml index f765ce25..b85b8ac4 100644 --- a/second-brain.yml +++ b/second-brain.yml @@ -4,7 +4,7 @@ version: "2" services: load_balancer: - image: traefik:v2.2.1 + image: traefik:v2.9 container_name: load_balancer restart: unless-stopped networks: @@ -36,6 +36,8 @@ services: # So that Traefik can listen to the Docker events - /var/run/docker.sock:/var/run/docker.sock - /home/admin/letsencrypt:/letsencrypt + environment: + - AWS_REGION=$AWS_REGION logging: options: max-size: 10m diff --git a/sphinx.yml b/sphinx.yml index b9fb8455..c5844d85 100644 --- a/sphinx.yml +++ b/sphinx.yml @@ -4,7 +4,7 @@ version: "2" services: reverse-proxy: - image: traefik:v2.2.1 + image: traefik:v2.9 container_name: traefik.sphinx restart: unless-stopped networks: @@ -36,6 +36,8 @@ services: # So that Traefik can listen to the Docker events - /var/run/docker.sock:/var/run/docker.sock - /home/admin/letsencrypt:/letsencrypt + environment: + - AWS_REGION=$AWS_REGION logging: options: max-size: 10m diff --git a/sphinxv2.yml b/sphinxv2.yml index ccd0e286..99d901b9 100644 --- a/sphinxv2.yml +++ b/sphinxv2.yml @@ -4,7 +4,7 @@ version: "2" services: reverse-proxy: - image: traefik:v2.2.1 + image: traefik:v2.9 container_name: traefik.sphinx restart: unless-stopped networks: @@ -36,6 +36,8 @@ services: # So that Traefik can listen to the Docker events - /var/run/docker.sock:/var/run/docker.sock - /home/admin/letsencrypt:/letsencrypt + environment: + - AWS_REGION=$AWS_REGION logging: options: max-size: 10m diff --git a/src/images/traefik.rs b/src/images/traefik.rs index 0f95a598..5ce6a567 100644 --- a/src/images/traefik.rs +++ b/src/images/traefik.rs @@ -47,9 +47,17 @@ ulimits: hard: 1000000 */ +fn _aws_env() -> Option> { + let aws_region = std::env::var("AWS_REGION"); + if let Err(_) = aws_region { + return None; + } + Some(vec![format!("AWS_REGION={}", aws_region.unwrap())]) +} + fn _traefik(img: &TraefikImage) -> Config { let name = img.name.clone(); - let image = "traefik:v2.2.1"; + let image = "traefik:v2.9"; let mut ports = vec!["80", "443"]; let insecure = match std::env::var("TRAEFIK_INSECURE") { Ok(_) => true, @@ -87,6 +95,12 @@ fn _traefik(img: &TraefikImage) -> Config { } let add_ulimits = true; let add_log_limit = true; + let awsenv = _aws_env(); + if let Some(ae) = &awsenv { + log::info!("traefik: using AWS REGION env {:?}", ae.get(0)); + } else { + log::error!("traefik: MISSING AWS REGION ENV!"); + } log::error!("traefik: MISSING AWS ENV!"); @@ -99,7 +113,7 @@ fn _traefik(img: &TraefikImage) -> Config { add_ulimits, add_log_limit, ), - env: None, + env: awsenv, cmd: Some(strarr(cmd)), ..Default::default() } diff --git a/superadmin.yml b/superadmin.yml index 26f80296..43138e0c 100644 --- a/superadmin.yml +++ b/superadmin.yml @@ -4,7 +4,7 @@ version: "2" services: load_balancer: - image: traefik:v2.2.1 + image: traefik:v2.9 container_name: load_balancer restart: unless-stopped networks: @@ -34,6 +34,8 @@ services: # So that Traefik can listen to the Docker events - /var/run/docker.sock:/var/run/docker.sock - /home/admin/letsencrypt:/letsencrypt + environment: + - AWS_REGION=$AWS_REGION logging: options: max-size: 10m