Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changelog.d/5-bug-fixes/fix-unavailable-server-types
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Fixed: subsequent provisioning retries to change server_type will not automatically tear down already deployed machines
Fixed: subsequent provisioning retries with changed server_type will not automatically tear down already deployed machines
1 change: 1 addition & 0 deletions changelog.d/5-bug-fixes/hetzner-retry-matrix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed: Hetzner CD retry matrix only uses server types offered in EU locations (ccx as fallback) and only tears down provisioned machines when moving on to the next location
22 changes: 15 additions & 7 deletions offline/cd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ COMMIT_HASH="${GITHUB_SHA}"
ARTIFACT="wire-server-deploy-static-${COMMIT_HASH}"

# Retry matrix
# Locations are tried in order and exhaust all server types before moving on.
# Locations are tried in order and exhaust all server type pairs before moving on.
# Prefer hel1: German locations rarely have capacity.
LOCATIONS=("hel1" "fsn1" "nbg1")
SMALL_SERVER_TYPES=("cx23" "cx33" "cpx22")
MEDIUM_SERVER_TYPES=("cx33" "cx43" "cpx32")
# Pairs (small/medium) are matched by index. cx* types are currently not offered
# in any EU location, so dedicated ccx types serve as fallback.
# Servers use lifecycle.ignore_changes = [server_type], so on retry only servers
# that failed to be created pick up the next pair; existing ones are kept.
LOCATIONS=("hel1" "nbg1" "fsn1")
SMALL_SERVER_TYPES=("cpx22" "cpx32" "ccx13" "ccx23")
MEDIUM_SERVER_TYPES=("cpx42" "cpx42" "ccx23" "ccx33")

# Retry configuration
RETRY_DELAY=30
Expand Down Expand Up @@ -100,8 +104,12 @@ for location_index in $(seq 0 $((location_count - 1))); do
if [[ $attempt -lt $MAX_RETRIES ]]; then
echo "Will retry with the next location and server type combination..."

echo "Cleaning up partial deployment..."
terraform destroy -auto-approve || true
# Keep already provisioned servers while retrying within a location;
# only tear down when moving on to the next location.
if [[ $server_type_index -eq $((server_type_count - 1)) ]]; then
echo "Location ${attempt_location} exhausted, cleaning up partial deployment..."
terraform destroy -auto-approve || true
fi

echo "Waiting ${RETRY_DELAY}s for resources to become available..."
sleep $RETRY_DELAY
Expand Down Expand Up @@ -143,7 +151,7 @@ rm -f ssh_private_key || true
echo "$ssh_private_key" > ssh_private_key
chmod 400 ssh_private_key

# TO-DO: make changes to test the deployment with demo user in
# TO-DO: make changes to test the deployment with demo user in
terraform output -json static-inventory > inventory.json
yq eval -o=yaml '.' inventory.json > inventory.yml

Expand Down
14 changes: 10 additions & 4 deletions offline/cd_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ COMMIT_HASH="${GITHUB_SHA}"
# Retry matrix
# Locations are tried in order and exhaust all server types before moving on.
# Prefer hel1: German locations rarely have capacity.
LOCATIONS=("hel1" "fsn1" "nbg1")
SERVER_TYPES=("cx53" "cpx62")
# cx* types are currently not offered in any EU location and hel1 lacks cpx62,
# so the dedicated ccx43 (16 vCPU) serves as fallback.
LOCATIONS=("hel1" "nbg1" "fsn1")
SERVER_TYPES=("cpx62" "ccx43")

# Retry configuration
RETRY_DELAY=30
Expand Down Expand Up @@ -89,8 +91,12 @@ for location_index in $(seq 0 $((location_count - 1))); do
fi

if [[ $attempt -lt $MAX_RETRIES ]]; then
echo "Cleaning up partial deployment..."
terraform destroy -auto-approve || true
# Keep already provisioned resources while retrying within a location;
# only tear down when moving on to the next location.
if [[ $server_type_index -eq $((server_type_count - 1)) ]]; then
echo "Location ${attempt_location} exhausted, cleaning up partial deployment..."
terraform destroy -auto-approve || true
fi

echo "Waiting ${RETRY_DELAY}s for resources to become available..."
sleep $RETRY_DELAY
Expand Down
18 changes: 13 additions & 5 deletions offline/cd_staging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ COMMIT_HASH="${GITHUB_SHA}"
ARTIFACT="wire-server-deploy-static-${COMMIT_HASH}"

# Retry matrix
# Locations are tried in order and exhaust all server types before moving on.
# Locations are tried in order and exhaust all server type pairs before moving on.
# Prefer hel1: German locations rarely have capacity.
# Pairs (small/medium) are matched by index. cx* types are currently not offered
# in any EU location, so dedicated ccx types serve as fallback.
# Servers use lifecycle.ignore_changes = [server_type], so on retry only servers
# that failed to be created pick up the next pair; existing ones are kept.
LOCATIONS=("hel1" "nbg1" "fsn1")
SMALL_SERVER_TYPES=("cpx22" "cpx32" "cpx42")
MEDIUM_SERVER_TYPES=("cpx42" "cpx52" "cpx62")
SMALL_SERVER_TYPES=("cpx22" "cpx32" "ccx13" "ccx23")
MEDIUM_SERVER_TYPES=("cpx42" "cpx42" "ccx23" "ccx33")

# Retry configuration
RETRY_DELAY=30
Expand Down Expand Up @@ -100,8 +104,12 @@ for location_index in $(seq 0 $((location_count - 1))); do
if [[ $attempt -lt $MAX_RETRIES ]]; then
echo "Will retry with the next location and server type combination..."

echo "Cleaning up partial deployment..."
terraform destroy -auto-approve || true
# Keep already provisioned servers while retrying within a location;
# only tear down when moving on to the next location.
if [[ $server_type_index -eq $((server_type_count - 1)) ]]; then
echo "Location ${attempt_location} exhausted, cleaning up partial deployment..."
terraform destroy -auto-approve || true
fi

echo "Waiting ${RETRY_DELAY}s for resources to become available..."
sleep $RETRY_DELAY
Expand Down
3 changes: 3 additions & 0 deletions terraform/examples/wiab-staging-hetzner/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,7 @@ resource "hcloud_server" "datanode" {
network_id = hcloud_network.main.id
ip = ""
}
lifecycle {
ignore_changes = [server_type]
}
}
Loading