Skip to content

Commit

Permalink
wip: init dep-out
Browse files Browse the repository at this point in the history
  • Loading branch information
alonbraymok committed Nov 13, 2024
1 parent 43fdd86 commit 9789e23
Show file tree
Hide file tree
Showing 93 changed files with 1,791 additions and 1 deletion.
3 changes: 2 additions & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ RUN yarn build
FROM --platform=$BUILDPLATFORM golang:1.22 AS backend
WORKDIR /app
COPY . .
COPY --from=builder /webapp/out frontend/webapp/out
COPY --from=builder /webapp/dep-out frontend/webapp/out
COPY --from=builder /webapp/dep-out frontend/webapp/dep-out
WORKDIR /app/frontend
ARG TARGETARCH
RUN CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o odigos-ui
Expand Down
32 changes: 32 additions & 0 deletions frontend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ type Flags struct {
//go:embed all:webapp/out/*
var uiFS embed.FS

//go:embed all:webapp/dep-out/*
var depUIFS embed.FS

func parseFlags() Flags {
defaultKubeConfig := env.GetDefaultKubeConfigPath()

Expand All @@ -80,6 +83,21 @@ func initKubernetesClient(flags *Flags) error {
return nil
}

func startDepServer() (*gin.Engine, error) {
r := gin.New()
gin.SetMode(gin.ReleaseMode)
r.Use(gin.Recovery())

// Serve dep-out app
dist, err := fs.Sub(depUIFS, "dep-out")
if err != nil {
return nil, fmt.Errorf("error reading dep-out directory: %s", err)
}
r.NoRoute(gin.WrapH(http.FileServer(http.FS(dist))))

return r, nil
}

func startHTTPServer(flags *Flags, odigosMetrics *collectormetrics.OdigosMetricsConsumer) (*gin.Engine, error) {
var r *gin.Engine
if flags.Debug {
Expand Down Expand Up @@ -260,6 +278,12 @@ func main() {
log.Fatalf("Error starting server: %s", err)
}

// Start the second server for dep-out
depServer, err := startDepServer()
if err != nil {
log.Fatalf("Error starting dep-out server: %s", err)
}

// Start watchers
err = watchers.StartInstrumentedApplicationWatcher(ctx, "")
if err != nil {
Expand Down Expand Up @@ -288,6 +312,14 @@ func main() {
}
}()

go func() {
log.Println("Starting Odigos dep-out server...")
err = depServer.Run(fmt.Sprintf("%s:%d", flags.Address, 3001))
if err != nil {
log.Fatalf("Error starting dep-out server: %s", err)
}
}()

<-ch
log.Println("Shutting down Odigos UI...")
cancel()
Expand Down
1 change: 1 addition & 0 deletions frontend/webapp/dep-out/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/b4846eed11c4725f.css" crossorigin="" data-precedence="next"/><link rel="preload" href="/_next/static/chunks/webpack-6ff63b03f4023a47.js" as="script" fetchPriority="low" crossorigin=""/><script src="/_next/static/chunks/fd9d1056-9cea142d2b41eb16.js" async="" crossorigin=""></script><script src="/_next/static/chunks/650-975aaf0197a949b5.js" async="" crossorigin=""></script><script src="/_next/static/chunks/main-app-2f75cbb4ad4c612e.js" async="" crossorigin=""></script><title>404: This page could not be found.</title><script src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js" crossorigin="" noModule=""></script><style data-styled="" data-styled-version="6.0.7"></style></head><body style="margin:0;position:fixed;scrollbar-width:none;width:100vw;height:100vh;background-color:#07111A"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><div class="notification-manager__NotificationsWrapper-sc-i62zdt-0 OHHxt"></div><script src="/_next/static/chunks/webpack-6ff63b03f4023a47.js" crossorigin="" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/css/b4846eed11c4725f.css\",\"style\",{\"crossOrigin\":\"\"}]\n0:\"$L2\"\n"])</script><script>self.__next_f.push([1,"3:I{\"id\":3710,\"chunks\":[\"272:static/chunks/webpack-6ff63b03f4023a47.js\",\"971:static/chunks/fd9d1056-9cea142d2b41eb16.js\",\"650:static/chunks/650-975aaf0197a949b5.js\"],\"name\":\"\",\"async\":false}\n5:I{\"id\":1271,\"chunks\":[\"272:static/chunks/webpack-6ff63b03f4023a47.js\",\"971:static/chunks/fd9d1056-9cea142d2b41eb16.js\",\"650:static/chunks/650-975aaf0197a949b5.js\"],\"name\":\"\",\"async\":false}\n"])</script><script>self.__next_f.push([1,"6:I{\"id\":9228,\"chunks\":[\"573:static/chunks/7af96b1d-661b23cf9b38f432.js\",\"727:static/chunks/9ccfb3e7-a5cf8b8ce3814083.js\",\"28:static/chunks/decd49cc-dce671d85655dfc2.js\",\"845:static/chunks/845-89170f42495c5944.js\",\"320:static/chunks/320-e9b7d301c5d0406b.js\",\"433:static/chunks/433-e81cb52d52eafb19.js\",\"611:static/chunks/611-4368b8e4d58ddaa0.js\",\"305:static/chunks/305-80ab836000a4f9a3.js\",\"32:static/chunks/32-708c0ff33a8c4e4f.js\",\"585:static/chunks/585-bacbad42c2242b55.js\",\"514:static/chunks/514-b3691d6ac242362e.js\",\"152:static/chunks/152-2782d3885a8aa0d5.js\",\"185:static/chunks/app/layout-c0a6904761fd962b.js\"],\"name\":\"\",\"async\":false}\n"])</script><script>self.__next_f.push([1,"7:I{\"id\":3602,\"chunks\":[\"272:static/chunks/webpack-6ff63b03f4023a47.js\",\"971:static/chunks/fd9d1056-9cea142d2b41eb16.js\",\"650:static/chunks/650-975aaf0197a949b5.js\"],\"name\":\"\",\"async\":false}\n8:I{\"id\":9347,\"chunks\":[\"272:static/chunks/webpack-6ff63b03f4023a47.js\",\"971:static/chunks/fd9d1056-9cea142d2b41eb16.js\",\"650:static/chunks/650-975aaf0197a949b5.js\"],\"name\":\"\",\"async\":false}\n"])</script><script>self.__next_f.push([1,"2:[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/b4846eed11c4725f.css\",\"precedence\":\"next\",\"crossOrigin\":\"\"}]],[\"$\",\"$L3\",null,{\"buildId\":\"bw7lcKqlenXQCXEp_D_Xw\",\"assetPrefix\":\"\",\"initialCanonicalUrl\":\"/_not-found\",\"initialTree\":[\"\",{\"children\":[\"__PAGE__\",{}]},\"$undefined\",\"$undefined\",true],\"initialHead\":[false,\"$L4\"],\"globalErrorComponent\":\"$5\",\"children\":[null,[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$L7\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"hasLoading\":false,\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"template\":[\"$\",\"$L8\",null,{}],\"templateStyles\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[],\"childProp\":{\"current\":[\"$L9\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null],\"segment\":\"__PAGE__\"},\"styles\":[]}],\"params\":{}}],null]}]]\n"])</script><script>self.__next_f.push([1,"4:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n9:null\n"])</script></body></html><style data-styled="" data-styled-version="6.0.7"></style>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9789e23

Please sign in to comment.