-
Notifications
You must be signed in to change notification settings - Fork 9
/
prepare.go
57 lines (44 loc) · 1.48 KB
/
prepare.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2022 Namespace Labs Inc; All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
package debug
import (
"context"
"fmt"
"github.com/spf13/cobra"
"namespacelabs.dev/foundation/internal/cli/fncobra"
"namespacelabs.dev/foundation/internal/console"
"namespacelabs.dev/foundation/internal/runtime/docker/install"
"namespacelabs.dev/foundation/internal/workspace/dirs"
)
func newPrepareCmd() *cobra.Command {
var version string
cmd := &cobra.Command{
Use: "prepare",
Short: "Prepares a workstation for debugging.",
Args: cobra.RangeArgs(0, 1),
RunE: fncobra.RunE(func(ctx context.Context, args []string) error {
spec := install.PersistentSpec{
Name: "jaeger",
ContainerName: "fn-jaeger",
Image: "jaegertracing/all-in-one",
Version: "1.27",
Ports: map[int]int{
20000: 16686,
20001: 14268,
},
}
if err := spec.Ensure(ctx, console.Output(ctx, "jaeger")); err != nil {
return err
}
w := console.Stdout(ctx)
config, _ := dirs.Config()
fmt.Fprintf(w, "\n Jaeger listening on: http://localhost:20001/api/traces\n\n")
fmt.Fprintf(w, "Consider updating %s/config.json with:\n\n", config)
fmt.Fprintf(w, " %q: %q\n\n", "jaeger_endpoint", "http://localhost:20001/api/traces")
return nil
}),
}
cmd.Flags().StringVar(&version, "version", "", "Which version to rehydrate.")
return cmd
}