Skip to content

Commit 8f79a73

Browse files
committed
Clenaup
1 parent da3dd1c commit 8f79a73

File tree

11 files changed

+21
-26
lines changed

11 files changed

+21
-26
lines changed

.github/actions/start-services/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ runs:
8888
ENVIRONMENT: "local"
8989
OTEL_COLLECTOR_GRPC_ENDPOINT: "localhost:4317"
9090
MAX_PARALLEL_MEMFILE_SNAPSHOTTING: "2"
91-
LOCAL_TEMPLATE_CACHE_PATH: "./.e2b-slab-cache"
91+
SHARED_TEMPLATE_CACHE_PATH: "./.e2b-slab-cache"
9292
run: |
93-
mkdir -p $LOCAL_TEMPLATE_CACHE_PATH
93+
mkdir -p $SHARED_TEMPLATE_CACHE_PATH
9494
mkdir -p ~/logs
9595
9696
# Start otel-collector

main.tf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,7 @@ module "nomad" {
261261
launch_darkly_api_key_secret_name = module.init.launch_darkly_api_key_secret_version.secret
262262

263263
# Filestore
264-
filestore_cache_enabled = var.filestore_cache_enabled
265-
266-
slab_cache_path = module.cluster.nfs_slab_cache_path
264+
shared_template_cache_path = module.cluster.shared_template_cache_path
267265
}
268266

269267
module "redis" {

packages/cluster/main.tf

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ module "client_cluster" {
137137
NFS_IP_ADDRESS = var.filestore_cache_enabled ? join(",", module.filestore[0].nfs_ip_addresses) : ""
138138
NFS_MOUNT_PATH = local.nfs_mount_path
139139
NFS_MOUNT_SUBDIR = local.nfs_mount_subdir
140-
141-
use_filestore_cache = var.filestore_cache_enabled
140+
USE_FILESTORE_CACHE = var.filestore_cache_enabled
142141
})
143142

144143
environment = var.environment
@@ -285,9 +284,7 @@ module "build_cluster" {
285284
NFS_IP_ADDRESS = var.filestore_cache_enabled ? join(",", module.filestore[0].nfs_ip_addresses) : ""
286285
NFS_MOUNT_PATH = local.nfs_mount_path
287286
NFS_MOUNT_SUBDIR = local.nfs_mount_subdir
288-
289-
// We don't use the filestore cache for the build cluster for now.
290-
use_filestore_cache = false
287+
USE_FILESTORE_CACHE = var.filestore_cache_enabled
291288
})
292289

293290
environment = var.environment

packages/cluster/outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ output "logs_proxy_ip" {
22
value = module.network.logs_proxy_ip
33
}
44

5-
output "nfs_slab_cache_path" {
6-
value = "${local.nfs_mount_path}/${local.nfs_mount_subdir}"
5+
output "shared_template_cache_path" {
6+
value = var.filestore_cache_enabled ? "${local.nfs_mount_path}/${local.nfs_mount_subdir}" : ""
77
}

packages/cluster/scripts/start-client.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ echo "$SWAPFILE none swap sw 0 0" | sudo tee -a /etc/fstab
4747
sudo sysctl vm.swappiness=10
4848
sudo sysctl vm.vfs_cache_pressure=50
4949

50-
%{ if use_filestore_cache }
50+
%{ if USE_FILESTORE_CACHE }
5151
# Mount NFS
5252
sudo mkdir -p "${NFS_MOUNT_PATH}"
5353
echo "${NFS_IP_ADDRESS}:/slabs ${NFS_MOUNT_PATH} nfs defaults,tcp,nconnect=2,sec=sys,_netdev 0 0" | sudo tee -a /etc/fstab

packages/nomad/filestore-cleanup.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ data "external" "filestore_cleanup_checksum" {
1212
}
1313

1414
resource "nomad_job" "filestore_cleanup" {
15-
count = var.filestore_cache_enabled ? 1 : 0
15+
count = var.shared_template_cache_path != "" ? 1 : 0
16+
1617
jobspec = templatefile("${path.module}/filestore-cleanup.hcl", {
1718
bucket_name = var.fc_env_pipeline_bucket_name
1819
environment = var.environment
1920
clean_nfs_cache_checksum = data.external.filestore_cleanup_checksum.result.hex
20-
nfs_cache_mount_path = var.slab_cache_path
21+
nfs_cache_mount_path = var.shared_template_cache_path
2122
max_disk_usage_target = var.filestore_cache_max_disk_usage_target
2223
})
2324
}

packages/nomad/main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ locals {
407407
otel_collector_grpc_endpoint = "localhost:${var.otel_collector_grpc_port}"
408408
allow_sandbox_internet = var.allow_sandbox_internet
409409
launch_darkly_api_key = trimspace(data.google_secret_manager_secret_version.launch_darkly_api_key.secret_data)
410-
nfs_cache_mount_path = var.slab_cache_path
410+
nfs_cache_mount_path = var.shared_template_cache_path
411411
clickhouse_connection_string = var.clickhouse_server_count > 0 ? "clickhouse://${var.clickhouse_username}:${random_password.clickhouse_password.result}@clickhouse.service.consul:${var.clickhouse_server_port.port}/${var.clickhouse_database}" : ""
412412
}
413413

@@ -492,8 +492,10 @@ resource "nomad_job" "template_manager" {
492492
logs_collector_public_ip = var.logs_proxy_address
493493
orchestrator_services = "template-manager"
494494
allow_sandbox_internet = var.allow_sandbox_internet
495-
nfs_cache_mount_path = var.slab_cache_path
496495
clickhouse_connection_string = local.clickhouse_connection_string
496+
497+
# For now we disable the shared template cache in the template manager
498+
nfs_cache_mount_path = ""
497499
})
498500
}
499501
resource "nomad_job" "loki" {

packages/nomad/orchestrator.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ EOT
7171
TEMPLATE_BUCKET_NAME = "${template_bucket_name}"
7272
OTEL_COLLECTOR_GRPC_ENDPOINT = "${otel_collector_grpc_endpoint}"
7373
ALLOW_SANDBOX_INTERNET = "${allow_sandbox_internet}"
74-
LOCAL_TEMPLATE_CACHE_PATH = "${nfs_cache_mount_path}"
74+
SHARED_TEMPLATE_CACHE_PATH = "${nfs_cache_mount_path}"
7575
CLICKHOUSE_CONNECTION_STRING = "${clickhouse_connection_string}"
7676

7777
%{ if launch_darkly_api_key != "" }

packages/nomad/template-manager.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ job "template-manager" {
6565
ORCHESTRATOR_SERVICES = "${orchestrator_services}"
6666
LOGS_COLLECTOR_PUBLIC_IP = "${logs_collector_public_ip}"
6767
ALLOW_SANDBOX_INTERNET = "${allow_sandbox_internet}"
68-
LOCAL_TEMPLATE_CACHE_PATH = "${nfs_cache_mount_path}"
68+
SHARED_TEMPLATE_CACHE_PATH = "${nfs_cache_mount_path}"
6969
CLICKHOUSE_CONNECTION_STRING = "${clickhouse_connection_string}"
7070
%{ if !update_stanza }
7171
FORCE_STOP = "true"

packages/nomad/variables.tf

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,9 @@ variable "clickhouse_node_pool" {
301301
type = string
302302
}
303303

304-
variable "slab_cache_path" {
305-
type = string
306-
}
307-
308-
variable "filestore_cache_enabled" {
309-
type = bool
304+
variable "shared_template_cache_path" {
305+
type = string
306+
default = ""
310307
}
311308

312309
variable "filestore_cache_max_disk_usage_target" {

0 commit comments

Comments
 (0)