Merge branch '2.0.0' of https://github.com/shuffle/shuffle into 2.0.0

This commit is contained in:
Frikky
2024-12-02 18:35:35 +01:00
2 changed files with 23 additions and 20 deletions
+2 -2
View File
@@ -48,8 +48,8 @@ DB_LOCATION=./shuffle-database
DOCKER_API_VERSION=1.40 DOCKER_API_VERSION=1.40
# Orborus/Proxy configurations # Orborus/Proxy configurations
HTTP_PROXY=noproxy HTTP_PROXY=
HTTPS_PROXY=noproxy HTTPS_PROXY=
SHUFFLE_PASS_WORKER_PROXY=TRUE SHUFFLE_PASS_WORKER_PROXY=TRUE
SHUFFLE_PASS_APP_PROXY=TRUE SHUFFLE_PASS_APP_PROXY=TRUE
SHUFFLE_INTERNAL_HTTP_PROXY=noproxy SHUFFLE_INTERNAL_HTTP_PROXY=noproxy
+21 -18
View File
@@ -341,6 +341,7 @@ func deployServiceWorkers(image string) {
log.Printf("[ERROR] Memcached is not running. Will try to deploy it.") log.Printf("[ERROR] Memcached is not running. Will try to deploy it.")
deployMemcached(dockercli) deployMemcached(dockercli)
} }
ip := "shuffle-cache" ip := "shuffle-cache"
os.Setenv("SHUFFLE_MEMCACHED", fmt.Sprintf("%s:11211", ip)) os.Setenv("SHUFFLE_MEMCACHED", fmt.Sprintf("%s:11211", ip))
@@ -1256,27 +1257,27 @@ func deployWorker(image string, identifier string, env []string, executionReques
Resources: container.Resources{}, Resources: container.Resources{},
} }
certPath := "/certs" certPath := "/certs"
// This is just to test the mounting locally so // This is just to test the mounting locally so
// I can control from what source I'm mounting // I can control from what source I'm mounting
// the certs to. Default behaviour is: // the certs to. Default behaviour is:
// /certs:/certs. // /certs:/certs.
if os.Getenv("SHUFFLE_CERT_PATH") != "" { if os.Getenv("SHUFFLE_CERT_PATH") != "" {
certPath = os.Getenv("SHUFFLE_CERT_PATH") certPath = os.Getenv("SHUFFLE_CERT_PATH")
} }
_, err := os.ReadDir(certPath) _, err := os.ReadDir(certPath)
if certPath != "" && err == nil { if certPath != "" && err == nil {
certVol := mount.Mount{ certVol := mount.Mount{
Type: mount.TypeBind, Type: mount.TypeBind,
Source: certPath, Source: certPath,
Target: "/certs", Target: "/certs",
} }
hostConfig.Mounts = append(hostConfig.Mounts, certVol) hostConfig.Mounts = append(hostConfig.Mounts, certVol)
} }
if len(os.Getenv("DOCKER_HOST")) == 0 { if len(os.Getenv("DOCKER_HOST")) == 0 {
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
@@ -3985,8 +3986,9 @@ func deployMemcached(dockercli *dockerclient.Client) error {
ctx := context.Background() ctx := context.Background()
memcachedImage := "docker.io/library/memcached:latest"
containerConfig := &container.Config{ containerConfig := &container.Config{
Image: "memcached", Image: memcachedImage,
Cmd: []string{"-m", defaultMem}, Cmd: []string{"-m", defaultMem},
} }
@@ -3996,6 +3998,7 @@ func deployMemcached(dockercli *dockerclient.Client) error {
}, },
} }
dockercli.ImagePull(ctx, memcachedImage, image.PullOptions{})
containerName := "shuffle-cache" containerName := "shuffle-cache"
resp, err := dockercli.ContainerCreate(ctx, containerConfig, hostConfig, nil, nil, containerName) resp, err := dockercli.ContainerCreate(ctx, containerConfig, hostConfig, nil, nil, containerName)