Skip to content

Commit 973e72b

Browse files
committed
bugfix for Template build time out.
1 parent 0e7dada commit 973e72b

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

infra-iac/terraform/main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ locals {
5151
clusters = {
5252
# Server nodes run Consul and Nomad servers
5353
server = {
54-
instance_type_x86 = "t3.xlarge"
55-
instance_type_arm = "t4g.xlarge"
54+
instance_type_x86 = var.environment == "prod" ? "m6i.xlarge" : "t3.xlarge"
55+
instance_type_arm = var.environment == "prod" ? "m7g.xlarge" : "t4g.xlarge"
5656
desired_capacity = 3
5757
max_size = 3
5858
min_size = 3
@@ -67,16 +67,16 @@ locals {
6767
}
6868
# API nodes run the API service
6969
api = {
70-
instance_type_x86 = "t3.xlarge"
71-
instance_type_arm = "t4g.xlarge"
70+
instance_type_x86 = var.environment == "prod" ? "m6i.xlarge" : "t3.xlarge"
71+
instance_type_arm = var.environment == "prod" ? "m7g.xlarge" : "t4g.xlarge"
7272
desired_capacity = 1
7373
max_size = 1
7474
min_size = 1
7575
}
7676
# Build nodes for environment building (currently not active)
7777
build = {
78-
instance_type_x86 = "t3.xlarge"
79-
instance_type_arm = "t4g.xlarge"
78+
instance_type_x86 = var.environment == "prod" ? "m6i.xlarge" : "t3.xlarge"
79+
instance_type_arm = var.environment == "prod" ? "m7g.xlarge" : "t4g.xlarge"
8080
desired_capacity = 0
8181
max_size = 0
8282
min_size = 0

packages/create_template.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ DOCKERFILE="FROM e2bdev/code-interpreter:latest"
55
DOCKER_IMAGE="e2bdev/code-interpreter:latest"
66
CREATE_TYPE="default"
77
ECR_IMAGE=""
8-
8+
START_COMMAND="/root/.jupyter/start-up.sh"
9+
READY_COMMAND=""
910

1011
# Parse command line arguments
1112
while [ $# -gt 0 ]; do
1213
case "$1" in
1314
--docker-file)
1415
if [ -f "$2" ]; then
16+
START_COMMAND=""
1517
DOCKERFILE=$(cat "$2")
1618
CREATE_TYPE="dockerfile"
1719
echo "Will use below Dockerfile to create template: $DOCKERFILE"
@@ -22,6 +24,7 @@ while [ $# -gt 0 ]; do
2224
fi
2325
;;
2426
--ecr-image)
27+
START_COMMAND=""
2528
ECR_IMAGE="$2"
2629
DOCKERFILE="FROM $2"
2730
CREATE_TYPE="ecr_image"
@@ -77,12 +80,16 @@ RESPONSE=$(curl -s -X POST \
7780
-H "Authorization: $ACCESS_TOKEN" \
7881
-H 'Content-Type: application/json' \
7982
-d "{
83+
\"readyCmd\": \"$READY_COMMAND\",
84+
\"startCmd\": \"$START_COMMAND\",
8085
\"dockerfile\": \"$DOCKERFILE\",
86+
\"alias\": \"test-$(date +%s)\",
8187
\"memoryMB\": 4096,
82-
\"cpuCount\": 4,
83-
\"startCmd\": \"/root/.jupyter/start-up.sh\"
88+
\"cpuCount\": 4
8489
}")
8590

91+
echo "Response: $RESPONSE"
92+
8693
# Extract buildID and templateID from response
8794
if command -v jq &> /dev/null; then
8895
BUILD_ID=$(echo "$RESPONSE" | jq -r '.buildID')
@@ -110,7 +117,8 @@ echo "AWS Account ID: $AWS_ACCOUNT_ID"
110117

111118
# Execute ECR login command
112119
echo "Logging in to ECR..."
113-
aws ecr get-login-password --region $AWSREGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWSREGION.amazonaws.com
120+
ECR_DOMAIN="$AWS_ACCOUNT_ID.dkr.ecr.$AWSREGION.amazonaws.com"
121+
aws ecr get-login-password --region $AWSREGION | docker login --username AWS --password-stdin $ECR_DOMAIN
114122
if [ $? -ne 0 ]; then
115123
echo "Error: Failed to login to ECR"
116124
exit 1
@@ -168,7 +176,7 @@ case "$CREATE_TYPE" in
168176
esac
169177

170178
# Tag and push the base image
171-
BASE_ECR_REPOSITORY="$AWS_ACCOUNT_ID.dkr.ecr.$AWSREGION.amazonaws.com/e2bdev/base/$TEMPLATE_ID:$BUILD_ID"
179+
BASE_ECR_REPOSITORY="$ECR_DOMAIN/e2bdev/base/$TEMPLATE_ID:$BUILD_ID"
172180
echo "Tagging base Docker image as $BASE_ECR_REPOSITORY..."
173181
docker tag $BASE_IMAGE $BASE_ECR_REPOSITORY
174182
if [ $? -ne 0 ]; then

packages/orchestrator/internal/template/build/provision.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ set -euo pipefail
33

44
echo "Starting provisioning script"
55

6+
apt-get update -y && apt-get upgrade -y
7+
DEBIAN_FRONTEND=noninteractive apt-get install -y e2fsprogs
8+
69
# fix: dpkg-statoverride: warning: --update given but /var/log/chrony does not exist
710
mkdir -p /var/log/chrony
811

packages/shared/pkg/storage/storage_aws.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717

1818
const (
1919
awsOperationTimeout = 5 * time.Second
20-
awsWriteTimeout = 30 * time.Second
20+
awsWriteTimeout = 120 * time.Second
2121
awsReadTimeout = 15 * time.Second
2222
)
2323

0 commit comments

Comments
 (0)