Skip to content

Commit 57e5a17

Browse files
committed
gateway app: Optional turning on sync mode
1 parent 3558bd7 commit 57e5a17

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

gateway/dstack-app/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ services:
2727
- CF_API_TOKEN=${CF_API_TOKEN}
2828
- CF_ZONE_ID=${CF_ZONE_ID}
2929
- MY_URL=${MY_URL}
30+
- BOOTNODE_URL=${BOOTNODE_URL}
3031
- ACME_STAGING=${ACME_STAGING}
3132
- SUBNET_INDEX=${SUBNET_INDEX}
3233
- RUST_LOG=info,certbot=debug

gateway/dstack-app/entrypoint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ if [[ ! "$SUBNET_INDEX" =~ ^[0-9]+$ ]] || [ "$SUBNET_INDEX" -lt 0 ] || [ "$SUBNE
5353
exit 1
5454
fi
5555

56+
SYNC_ENABLED=$([ -z "$BOOTNODE_URL" ] && echo "false" || echo "true")
5657
# The IP address of this dstack-gateway node
5758
IP="10.4.0.$((SUBNET_INDEX + 1))/16"
5859
# Reserving 5 bits(32 IPs) for server use
@@ -63,6 +64,7 @@ CLIENT_RANGE="10.4.$((SUBNET_INDEX * 16)).0/20"
6364
echo "IP: $IP"
6465
echo "RESERVED_NET: $RESERVED_NET"
6566
echo "CLIENT_RANGE: $CLIENT_RANGE"
67+
echo "SYNC_ENABLED: $SYNC_ENABLED"
6668

6769
# Create gateway.toml configuration
6870
cat >$CONFIG_PATH <<EOF
@@ -86,7 +88,7 @@ rpc_domain = "gateway.$SRV_DOMAIN"
8688
run_in_dstack = true
8789
8890
[core.sync]
89-
enabled = false
91+
enabled = $SYNC_ENABLED
9092
interval = "30s"
9193
my_url = "$MY_URL"
9294
bootnode = "$BOOTNODE_URL"

0 commit comments

Comments
 (0)