More pipeline debugging info
This commit is contained in:
@@ -325,7 +325,12 @@ func cleanupExistingNodes(ctx context.Context) error {
|
|||||||
|
|
||||||
func deployServiceWorkers(image string) {
|
func deployServiceWorkers(image string) {
|
||||||
log.Printf("[DEBUG] Validating deployment of workers as services IF swarmConfig = run (value: %#v)", swarmConfig)
|
log.Printf("[DEBUG] Validating deployment of workers as services IF swarmConfig = run (value: %#v)", swarmConfig)
|
||||||
if swarmConfig == "run" || swarmConfig == "swarm" {
|
if swarmConfig != "run" && swarmConfig != "swarm" {
|
||||||
|
log.Printf("[DEBUG] Skipping deployment of workers as services as swarmConfig is not set to run or swarm. Value: %#v", swarmConfig)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
// Looks for and cleans up all existing items in swarm we can't re-use (Shuffle only)
|
// Looks for and cleans up all existing items in swarm we can't re-use (Shuffle only)
|
||||||
|
|
||||||
@@ -712,8 +717,6 @@ func deployServiceWorkers(image string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deploys the worker with the current available environments
|
// Deploys the worker with the current available environments
|
||||||
@@ -1910,7 +1913,7 @@ func main() {
|
|||||||
pipelineUrl = "http://localhost:5160"
|
pipelineUrl = "http://localhost:5160"
|
||||||
|
|
||||||
// Find the IP in baseUrl. Base format is http://<ip>:<port>
|
// Find the IP in baseUrl. Base format is http://<ip>:<port>
|
||||||
if baseUrl != "" {
|
if baseUrl != "" && !strings.Contains(baseUrl, "shuffle") && !strings.Contains(baseUrl, "localhost") && !strings.Contains(baseUrl, "run.app") {
|
||||||
urlSplit := strings.Split(baseUrl, "://")
|
urlSplit := strings.Split(baseUrl, "://")
|
||||||
if len(urlSplit) > 1 {
|
if len(urlSplit) > 1 {
|
||||||
// Find the IP
|
// Find the IP
|
||||||
@@ -1921,6 +1924,10 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(containerId) > 0 {
|
||||||
|
pipelineUrl = "http://tenzir-node:5160"
|
||||||
|
}
|
||||||
|
|
||||||
log.Printf("[WARNING] SHUFFLE_PIPELINE_URL not set, falling back to default URL: %s. If BASE_URL is set, we use the external IP for that", pipelineUrl)
|
log.Printf("[WARNING] SHUFFLE_PIPELINE_URL not set, falling back to default URL: %s. If BASE_URL is set, we use the external IP for that", pipelineUrl)
|
||||||
os.Setenv("SHUFFLE_PIPELINE_URL", pipelineUrl)
|
os.Setenv("SHUFFLE_PIPELINE_URL", pipelineUrl)
|
||||||
}
|
}
|
||||||
@@ -2605,7 +2612,7 @@ func deployTenzirNode() error {
|
|||||||
// Check if image exists
|
// Check if image exists
|
||||||
_, _, err := dockercli.ImageInspectWithRaw(ctx, imageName)
|
_, _, err := dockercli.ImageInspectWithRaw(ctx, imageName)
|
||||||
if dockerclient.IsErrNotFound(err) {
|
if dockerclient.IsErrNotFound(err) {
|
||||||
log.Printf("[DEBUG] Pulling image %s", imageName)
|
log.Printf("[DEBUG] Pulling image %s. This may take a while.", imageName)
|
||||||
pullOptions := image.PullOptions{}
|
pullOptions := image.PullOptions{}
|
||||||
out, err := dockercli.ImagePull(ctx, imageName, pullOptions)
|
out, err := dockercli.ImagePull(ctx, imageName, pullOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -2671,6 +2678,7 @@ func createAndStartTenzirNode(ctx context.Context, containerName, imageName stri
|
|||||||
|
|
||||||
// Ensure restart policy is there
|
// Ensure restart policy is there
|
||||||
config := &container.Config{
|
config := &container.Config{
|
||||||
|
Hostname: containerName,
|
||||||
Cmd: []string{"--commands=web server --mode=dev --bind=0.0.0.0"},
|
Cmd: []string{"--commands=web server --mode=dev --bind=0.0.0.0"},
|
||||||
Image: imageName,
|
Image: imageName,
|
||||||
Healthcheck: healthconfig,
|
Healthcheck: healthconfig,
|
||||||
@@ -2768,9 +2776,6 @@ func createAndStartTenzirNode(ctx context.Context, containerName, imageName stri
|
|||||||
|
|
||||||
if isKubernetes != "true" {
|
if isKubernetes != "true" {
|
||||||
hostConfig.NetworkMode = container.NetworkMode(fmt.Sprintf("container:%s", containerId))
|
hostConfig.NetworkMode = container.NetworkMode(fmt.Sprintf("container:%s", containerId))
|
||||||
if strings.ToLower(cleanupEnv) != "false" {
|
|
||||||
hostConfig.AutoRemove = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := dockercli.ContainerCreate(ctx, config, hostConfig, networkingConfig, nil, containerName)
|
_, err := dockercli.ContainerCreate(ctx, config, hostConfig, networkingConfig, nil, containerName)
|
||||||
@@ -2858,9 +2863,6 @@ func checkTenzirNode() error {
|
|||||||
return errors.New("Pipelines are disabled by user with SHUFFLE_SKIP_PIPELINES")
|
return errors.New("Pipelines are disabled by user with SHUFFLE_SKIP_PIPELINES")
|
||||||
}
|
}
|
||||||
|
|
||||||
retries := 1
|
|
||||||
|
|
||||||
//retryInterval := 3 * time.Second
|
|
||||||
url := fmt.Sprintf("%s/api/v0/ping", pipelineUrl)
|
url := fmt.Sprintf("%s/api/v0/ping", pipelineUrl)
|
||||||
forwardMethod := "POST"
|
forwardMethod := "POST"
|
||||||
|
|
||||||
@@ -2873,16 +2875,14 @@ func checkTenzirNode() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < retries; i++ {
|
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err == nil && resp.StatusCode == http.StatusOK {
|
if err == nil && resp.StatusCode == http.StatusOK {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//time.Sleep(retryInterval)
|
log.Printf("[DEBUG] Failed to verify Tenzir node on %s: %s", url, err)
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Errorf("tenzir node is not available")
|
return fmt.Errorf("Tenzir node is not available")
|
||||||
}
|
}
|
||||||
|
|
||||||
func createPipeline(command, identifier string) (string, error) {
|
func createPipeline(command, identifier string) (string, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user