Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/stakwork/sphinx-swarm
Browse files Browse the repository at this point in the history
  • Loading branch information
Evanfeenstra committed Nov 6, 2024
2 parents 97b8434 + c9e587d commit 667078a
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 10 deletions.
4 changes: 3 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
load_balancer:
image: traefik:v2.2.1
image: traefik:v2.9
container_name: load_balancer
restart: unless-stopped
networks:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion second-brain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion sphinxv2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/bin/super/superapp/src/Healthcheck.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
try {
let url = `https://boltwall.${host}/stats`;
// custom URLs
if (!url.includes("swarm")) {
if (!/swarm\d+/.test(host)) {
url = `https://${host}/api/stats`;
}
console.log("URL", url);
Expand Down
2 changes: 1 addition & 1 deletion src/bin/super/superapp/src/Remotes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
try {
let url = `https://boltwall.${host}/stats`;
// custom URLs
if (!url.includes("swarm")) {
if (!/swarm\d+/.test(host)) {
url = `https://${host}/api/stats`;
}
console.log("URL", url);
Expand Down
3 changes: 3 additions & 0 deletions src/images/jarvis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ fn jarvis(
max_payment_hierarcy_depth
));
}
if let Ok(aws_region) = getenv("AWS_REGION") {
env.push(format!("AWS_S3_REGION_NAME={}", aws_region));
}
if let Ok(dynamo_db_aws_access_key_id) = getenv("DYNAMO_DB_AWS_ACCESS_KEY_ID") {
env.push(format!(
"DYNAMO_DB_AWS_ACCESS_KEY_ID={}",
Expand Down
18 changes: 16 additions & 2 deletions src/images/traefik.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,17 @@ ulimits:
hard: 1000000
*/

fn _aws_env() -> Option<Vec<String>> {
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<String> {
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,
Expand Down Expand Up @@ -87,6 +95,12 @@ fn _traefik(img: &TraefikImage) -> Config<String> {
}
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!");

Expand All @@ -99,7 +113,7 @@ fn _traefik(img: &TraefikImage) -> Config<String> {
add_ulimits,
add_log_limit,
),
env: None,
env: awsenv,
cmd: Some(strarr(cmd)),
..Default::default()
}
Expand Down
5 changes: 4 additions & 1 deletion superadmin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -89,6 +91,7 @@ services:
- EC2_DAILY_LIMIT=$EC2_DAILY_LIMIT
- QUESTION_AND_ANSWER_WORKFLOW_ID=$QUESTION_AND_ANSWER_WORKFLOW_ID
- AWS_S3_BUCKET_NAME=$AWS_S3_BUCKET_NAME
- AWS_USER_ROLE=$AWS_USER_ROLE

networks:
sphinx-swarm:
Expand Down

0 comments on commit 667078a

Please sign in to comment.