Skip to content

Commit f938683

Browse files
chore(pro): bump platform types
1 parent 3cfa809 commit f938683

File tree

17 files changed

+139
-34
lines changed

17 files changed

+139
-34
lines changed

cmd/agent/container/daemon.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/loft-sh/devpod/pkg/agent"
1818
agentd "github.com/loft-sh/devpod/pkg/daemon/agent"
1919
"github.com/loft-sh/devpod/pkg/devcontainer"
20-
devpodlog "github.com/loft-sh/devpod/pkg/log"
2120
"github.com/loft-sh/devpod/pkg/platform/client"
2221
"github.com/loft-sh/devpod/pkg/ts"
2322
"github.com/loft-sh/log"
@@ -200,7 +199,7 @@ func runTimeoutMonitor(ctx context.Context, duration time.Duration, errChan chan
200199
// runNetworkServer starts the network server.
201200
func runNetworkServer(ctx context.Context, cmd *DaemonCmd, errChan chan<- error, wg *sync.WaitGroup) {
202201
defer wg.Done()
203-
rootDir := filepath.Join(os.TempDir(), "devpod")
202+
rootDir := "/var/devpod"
204203
if err := os.MkdirAll(rootDir, os.ModePerm); err != nil {
205204
errChan <- err
206205
return
@@ -293,8 +292,6 @@ func initLogging(rootDir string) log.Logger {
293292
logLevel := logrus.InfoLevel
294293
logPath := filepath.Join(rootDir, "daemon.log")
295294
logger := log.NewFileLogger(logPath, logLevel)
296-
if os.Getenv("DEVPOD_UI") != "true" {
297-
logger = devpodlog.NewCombinedLogger(logLevel, logger, log.NewStreamLogger(os.Stdout, os.Stderr, logLevel))
298-
}
295+
299296
return logger
300297
}

cmd/pro/daemon/daemon.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ func NewCmd(globalFlags *flags.GlobalFlags) *cobra.Command {
2323

2424
c.AddCommand(NewStartCmd(globalFlags))
2525
c.AddCommand(NewStatusCmd(globalFlags))
26+
c.AddCommand(NewNetcheckCmd(globalFlags))
2627

2728
return c
2829
}

cmd/pro/daemon/netcheck.go

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package daemon
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"strconv"
7+
8+
"github.com/loft-sh/devpod/cmd/agent"
9+
proflags "github.com/loft-sh/devpod/cmd/pro/flags"
10+
"github.com/loft-sh/devpod/pkg/config"
11+
daemon "github.com/loft-sh/devpod/pkg/daemon/platform"
12+
providerpkg "github.com/loft-sh/devpod/pkg/provider"
13+
"github.com/loft-sh/log"
14+
"github.com/spf13/cobra"
15+
"tailscale.com/client/tailscale"
16+
)
17+
18+
// NetcheckCmd holds the DevPod daemon flags
19+
type NetcheckCmd struct {
20+
*proflags.GlobalFlags
21+
22+
Host string
23+
Log log.Logger
24+
}
25+
26+
// NewNetcheckCmd creates a new command
27+
func NewNetcheckCmd(flags *proflags.GlobalFlags) *cobra.Command {
28+
cmd := &NetcheckCmd{
29+
GlobalFlags: flags,
30+
Log: log.Default,
31+
}
32+
c := &cobra.Command{
33+
Use: "netcheck",
34+
Short: "Get the status of the current network",
35+
RunE: func(cobraCmd *cobra.Command, args []string) error {
36+
devPodConfig, provider, err := findProProvider(cobraCmd.Context(), cmd.Context, cmd.Provider, cmd.Host, cmd.Log)
37+
if err != nil {
38+
return err
39+
}
40+
41+
return cmd.Run(cobraCmd.Context(), devPodConfig, provider)
42+
},
43+
PersistentPreRun: func(cmd *cobra.Command, args []string) {
44+
root := cmd.Root()
45+
if root == nil {
46+
return
47+
}
48+
if root.Annotations == nil {
49+
root.Annotations = map[string]string{}
50+
}
51+
// Don't print debug message
52+
root.Annotations[agent.AgentExecutedAnnotation] = "true"
53+
},
54+
}
55+
56+
c.Flags().StringVar(&cmd.Host, "host", "", "The pro instance to use")
57+
_ = c.MarkFlagRequired("host")
58+
59+
return c
60+
}
61+
62+
func (cmd *NetcheckCmd) Run(ctx context.Context, devPodConfig *config.Config, provider *providerpkg.ProviderConfig) error {
63+
dir, err := providerpkg.GetDaemonDir(devPodConfig.DefaultContext, provider.Name)
64+
if err != nil {
65+
return fmt.Errorf("get daemon dir: %w", err)
66+
}
67+
68+
tsClient := &tailscale.LocalClient{
69+
Socket: daemon.GetSocketAddr(dir, provider.Name),
70+
UseSocketOnly: true,
71+
}
72+
73+
dm, err := tsClient.CurrentDERPMap(ctx)
74+
if err != nil {
75+
return err
76+
}
77+
78+
for _, region := range dm.Regions {
79+
report, err := tsClient.DebugDERPRegion(ctx, strconv.Itoa(region.RegionID))
80+
if err != nil {
81+
return err
82+
}
83+
msg := fmt.Sprintf("DERP %d (%s)\n", region.RegionID, region.RegionCode)
84+
if len(report.Errors) > 0 {
85+
for _, error := range report.Errors {
86+
msg += fmt.Sprintf(" Error: %s\n", error)
87+
}
88+
}
89+
if len(report.Warnings) > 0 {
90+
for _, warning := range report.Warnings {
91+
msg += fmt.Sprintf(" Warning: %s\n", warning)
92+
}
93+
}
94+
if len(report.Info) > 0 {
95+
for _, info := range report.Info {
96+
msg += fmt.Sprintf(" Info: %s\n", info)
97+
}
98+
}
99+
fmt.Println(msg)
100+
}
101+
102+
return nil
103+
}

cmd/pro/login.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/loft-sh/devpod/pkg/platform/client"
1515
"github.com/loft-sh/devpod/pkg/provider"
1616
"github.com/loft-sh/devpod/pkg/types"
17+
versionpkg "github.com/loft-sh/devpod/pkg/version"
1718
"github.com/loft-sh/devpod/pkg/workspace"
1819
"github.com/loft-sh/log"
1920
"github.com/mgutz/ansi"
@@ -150,7 +151,7 @@ func (cmd *LoginCmd) Run(ctx context.Context, fullURL string, log log.Logger) er
150151
if err != nil {
151152
return fmt.Errorf("invalid version %s: %w", remoteVersion, err)
152153
}
153-
if rv.LT(semver.Version{Major: 0, Minor: 7, Patch: 0}) {
154+
if rv.LT(semver.Version{Major: 0, Minor: 6, Patch: 999}) && remoteVersion != versionpkg.DevVersion {
154155
log.Debug("remote version < 0.7.0, installing proxy provider")
155156
// proxy providers are deprecated and shouldn't be used
156157
// unless explicitly the server version is below 0.7.0

desktop/src/views/Pro/CreateWorkspace/UpdateWorkspace.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function UpdateWorkspace({ instance, template }: TUpdateWorkspaceProps) {
7575
}
7676

7777
return (
78-
<Box mb="40">
78+
<Box pb="24">
7979
<CreateWorkspaceForm
8080
instance={instance}
8181
presets={presets}

desktop/src/views/Pro/Workspace/Tabs.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ export function WorkspaceTabs({ ...tabProps }: TWorkspaceTabProps) {
6060
<TabPanels h="99%">
6161
{DETAILS_TABS.map(({ label, component: Component }) => (
6262
<TabPanel
63-
h="full"
63+
bgColor={contentBackgroundColor}
64+
h={label === "Configuration" ? "" : "full"}
6465
width="100vw"
6566
ml="-8"
6667
px="12"
6768
pt="8"
6869
pb="0"
69-
key={label}
70-
bgColor={contentBackgroundColor}>
70+
key={label}>
7171
<Component {...tabProps} />
7272
</TabPanel>
7373
))}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ require (
2929
github.com/gorilla/websocket v1.5.3
3030
github.com/joho/godotenv v1.5.1
3131
github.com/julienschmidt/httprouter v1.3.0
32-
github.com/loft-sh/agentapi/v4 v4.3.0-devpod.alpha.0
32+
github.com/loft-sh/agentapi/v4 v4.3.0-devpod.alpha.5
3333
github.com/loft-sh/analytics-client v0.0.0-20240219162240-2f4c64b2494e
34-
github.com/loft-sh/api/v4 v4.3.0-devpod.alpha.0
34+
github.com/loft-sh/api/v4 v4.3.0-devpod.alpha.5
3535
github.com/loft-sh/apiserver v0.0.0-20250206205835-422f1d472459
3636
github.com/loft-sh/log v0.0.0-20240219160058-26d83ffb46ac
3737
github.com/loft-sh/programming-language-detection v0.0.5

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,14 @@ github.com/loft-sh/admin-apis v0.0.0-20250221182517-7499d86167d2 h1:om1MqUdW84ZQ
424424
github.com/loft-sh/admin-apis v0.0.0-20250221182517-7499d86167d2/go.mod h1:WHCqWfljfD1hkwk41hLeqBhW2yeLvWipB1sH6vfnR7U=
425425
github.com/loft-sh/agentapi/v4 v4.3.0-devpod.alpha.0 h1:dy7pnOSCHg6GKnyRn0oMtGvYE1nCVupMXZzopqO6KDc=
426426
github.com/loft-sh/agentapi/v4 v4.3.0-devpod.alpha.0/go.mod h1:UteiUdc6QeGt2uXIo5K5qlReRa366GbPY5QdDuPyFCs=
427+
github.com/loft-sh/agentapi/v4 v4.3.0-devpod.alpha.5 h1:2d+b5Q31BlGVuVsF+nPhhVgX/158o5qzbWQfSHGrKlw=
428+
github.com/loft-sh/agentapi/v4 v4.3.0-devpod.alpha.5/go.mod h1:UteiUdc6QeGt2uXIo5K5qlReRa366GbPY5QdDuPyFCs=
427429
github.com/loft-sh/analytics-client v0.0.0-20240219162240-2f4c64b2494e h1:JcPnMaoczikvpasi8OJ47dCkWZjfgFubWa4V2SZo7h0=
428430
github.com/loft-sh/analytics-client v0.0.0-20240219162240-2f4c64b2494e/go.mod h1:FFWcGASyM2QlWTDTCG/WBVM/XYr8btqYt335TFNRCFg=
429431
github.com/loft-sh/api/v4 v4.3.0-devpod.alpha.0 h1:nakRHE+xJc5WlSHT7+Tq5Ql76L2L1pRH3X1G+JYZaAg=
430432
github.com/loft-sh/api/v4 v4.3.0-devpod.alpha.0/go.mod h1:9tiitoNy76JZq33Z+S0roYqJUUOqycYJ3VBk8oGJ1WM=
433+
github.com/loft-sh/api/v4 v4.3.0-devpod.alpha.5 h1:K3AMY0rOYoZGXdib+MgW964dw6J9cX4dTiTBSXgvIBI=
434+
github.com/loft-sh/api/v4 v4.3.0-devpod.alpha.5/go.mod h1:02FqJ2RLI4eIILhCBYndcKcgxlzUv2nVs1KRtI/w2nk=
431435
github.com/loft-sh/apiserver v0.0.0-20250206205835-422f1d472459 h1:6SrgBtT1S9ANsQMoO/O0Mq+hs9EbC5te5kPqOBfg5UI=
432436
github.com/loft-sh/apiserver v0.0.0-20250206205835-422f1d472459/go.mod h1:rung3jsKjaVAtykQN0vWmFHhx2A/umpRyAae8BJVSeE=
433437
github.com/loft-sh/log v0.0.0-20240219160058-26d83ffb46ac h1:Gz/7Lb7WgdgIv+KJz87ORA1zvQW52tUqKPGyunlp4dQ=

pkg/ts/derp.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ import (
44
"context"
55
"crypto/tls"
66
"fmt"
7-
"io"
87
"net/http"
98
"net/url"
109
"os"
1110
"strings"
1211
"time"
13-
14-
"k8s.io/klog/v2"
1512
)
1613

1714
type ConnTrackingFunc func(address string)
@@ -38,14 +35,6 @@ func CheckDerpConnection(ctx context.Context, baseUrl *url.URL) error {
3835

3936
res, err := client.Do(req)
4037
if err != nil || (res != nil && res.StatusCode != http.StatusOK) {
41-
klog.FromContext(ctx).Error(err, "Failed to reach the coordinator server.", "url", derpUrl.String())
42-
43-
if res != nil {
44-
body, _ := io.ReadAll(res.Body)
45-
defer res.Body.Close()
46-
klog.FromContext(ctx).V(1).Info("Response body", "body", string(body))
47-
}
48-
4938
return fmt.Errorf("failed to reach the coordinator server: %w", err)
5039
}
5140

vendor/github.com/loft-sh/api/v4/pkg/apis/management/v1/devpodworkspaceinstance_troubleshoot_types.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)