Skip to content
Merged
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
5 changes: 4 additions & 1 deletion packages/orchestrator/internal/sandbox/build/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ import (
"context"
"fmt"
"os"
"path/filepath"
"sync"
"time"

"github.com/jellydator/ttlcache/v3"
"go.uber.org/zap"
"golang.org/x/sys/unix"

"github.com/e2b-dev/infra/packages/shared/pkg"
)

const (
ToMBShift = 20
fallbackDiffSize = 100 << ToMBShift
)

const DefaultCachePath = "/orchestrator/build"
var DefaultCachePath = filepath.Join(pkg.OrchestratorBasePath, "build")

type deleteDiff struct {
size int64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ import (
"github.com/e2b-dev/infra/packages/orchestrator/internal/template/build/sandboxtools"
"github.com/e2b-dev/infra/packages/orchestrator/internal/template/build/storage/cache"
"github.com/e2b-dev/infra/packages/orchestrator/internal/template/metadata"
"github.com/e2b-dev/infra/packages/shared/pkg"
artifactsregistry "github.com/e2b-dev/infra/packages/shared/pkg/artifacts-registry"
"github.com/e2b-dev/infra/packages/shared/pkg/id"
"github.com/e2b-dev/infra/packages/shared/pkg/storage"
)

const (
templatesDirectory = "/orchestrator/build-templates"
var templatesDirectory = filepath.Join(pkg.OrchestratorBasePath, "build-templates")

const (
rootfsBuildFileName = "rootfs.filesystem.build"
rootfsProvisionLink = "rootfs.filesystem.build.provision"

Expand Down
13 changes: 9 additions & 4 deletions packages/orchestrator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,20 @@ const (
defaultProxyPort = 5007

version = "0.1.0"

fileLockName = "/orchestrator.lock"
)

var (
forceStop = env.GetEnv("FORCE_STOP", "false") == "true"
commitSHA string
forceStop = env.GetEnv("FORCE_STOP", "false") == "true"
commitSHA string
fileLockName = "/orchestrator.lock"
)

func init() {
if value := os.Getenv("ORCHESTRATOR_LOCK_PATH"); value != "" {
fileLockName = value
}
}

func main() {
port := flag.Uint("port", defaultPort, "orchestrator server port")
proxyPort := flag.Uint("proxy-port", defaultProxyPort, "orchestrator proxy port")
Expand Down
11 changes: 11 additions & 0 deletions packages/shared/pkg/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package pkg

import "os"

var OrchestratorBasePath = "/orchestrator"

func init() {
if value := os.Getenv("ORCHESTRATOR_BASE_PATH"); value != "" {
OrchestratorBasePath = value
}
}
5 changes: 2 additions & 3 deletions packages/shared/pkg/storage/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import (
"os"
"path/filepath"

"github.com/e2b-dev/infra/packages/shared/pkg"
"github.com/e2b-dev/infra/packages/shared/pkg/id"
)

const (
sandboxCacheDir = "/orchestrator/sandbox"
)
var sandboxCacheDir = filepath.Join(pkg.OrchestratorBasePath, "sandbox")

type SandboxFiles struct {
TemplateCacheFiles
Expand Down
6 changes: 3 additions & 3 deletions packages/shared/pkg/storage/template_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"path/filepath"

"github.com/google/uuid"
)

const (
templateCacheDir = "/orchestrator/template"
"github.com/e2b-dev/infra/packages/shared/pkg"
)

var templateCacheDir = filepath.Join(pkg.OrchestratorBasePath, "template")

type TemplateCacheFiles struct {
TemplateFiles

Expand Down