Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
Add ui-server (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlegrone committed Dec 30, 2021
1 parent 5d2482f commit 583fa90
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 49 deletions.
20 changes: 17 additions & 3 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ github.com/beorn7/perks/quantile,https://github.com/beorn7/perks,MIT,Blake Mizer
github.com/blang/semver/v4,https://github.com/blang/semver,MIT,Benedikt Lang <github at benediktlang.de>
github.com/cactus/go-statsd-client/statsd,https://github.com/cactus/go-statsd-client,MIT,Eli Janssen
github.com/cespare/xxhash/v2,https://github.com/cespare/xxhash,MIT,Caleb Spare
github.com/coreos/go-oidc/v3/oidc,https://github.com/coreos/go-oidc,Apache-2.0,
github.com/cpuguy83/go-md2man/v2/md2man,https://github.com/cpuguy83/go-md2man,MIT,Brian Goff
github.com/davecgh/go-spew/spew,https://github.com/davecgh/go-spew,ISC,Dave Collins <dave@davec.name>
github.com/dgrijalva/jwt-go,https://github.com/dgrijalva/jwt-go,MIT,Dave Grijalva
github.com/dgrijalva/jwt-go/v4,https://github.com/dgrijalva/jwt-go,MIT,Dave Grijalva
github.com/dgryski/go-farm,https://github.com/dgryski/go-farm,MIT,Damian Gryski
github.com/emirpasic/gods,https://github.com/emirpasic/gods,BSD-2-Clause,Emir Pasic
github.com/facebookgo/clock,https://github.com/facebookgo/clock,MIT,Ben Johnson
github.com/gocql/gocql,https://github.com/gocql/gocql,BSD-3-Clause,The Gocql authors
github.com/gogo/googleapis/google/rpc,https://github.com/gogo/googleapis,Apache-2.0,Google Inc
github.com/gogo/gateway,https://github.com/gogo/gateway,BSD-3-Clause,"Gengo, Inc."
github.com/gogo/googleapis/google,https://github.com/gogo/googleapis,Apache-2.0,Google Inc
github.com/gogo/protobuf,https://github.com/gogo/protobuf,BSD-3-Clause,The GoGo Authors
github.com/gogo/status,https://github.com/gogo/status,Apache-2.0,
github.com/golang/glog,https://github.com/golang/glog,Apache-2.0,
Expand All @@ -31,7 +34,11 @@ github.com/google/licenseclassifier,https://github.com/google/licenseclassifier,
github.com/google/licenseclassifier/stringclassifier,https://github.com/google/licenseclassifier,Apache-2.0,
github.com/google/uuid,https://github.com/google/uuid,BSD-3-Clause,Google Inc.
github.com/googleapis/gax-go/v2,https://github.com/googleapis/gax-go,BSD-3-Clause,Google Inc.
github.com/gorilla/context,https://github.com/gorilla/context,BSD-3-Clause,Rodrigo Moraes
github.com/gorilla/securecookie,https://github.com/gorilla/securecookie,BSD-3-Clause,Rodrigo Moraes
github.com/gorilla/sessions,https://github.com/gorilla/sessions,BSD-3-Clause,The Gorilla Authors
github.com/grpc-ecosystem/go-grpc-middleware,https://github.com/grpc-ecosystem/go-grpc-middleware,Apache-2.0,
github.com/grpc-ecosystem/grpc-gateway,https://github.com/grpc-ecosystem/grpc-gateway,BSD-3-Clause,"Gengo, Inc."
github.com/hailocab/go-hostpool,https://github.com/hailocab/go-hostpool,MIT,Bitly
github.com/iancoleman/strcase,https://github.com/iancoleman/strcase,MIT,Ian Coleman
github.com/jbenet/go-context/io,https://github.com/jbenet/go-context,MIT,Juan Batiz-Benet
Expand All @@ -40,7 +47,12 @@ github.com/jmoiron/sqlx,https://github.com/jmoiron/sqlx,MIT,Jason Moiron
github.com/jonboulle/clockwork,https://github.com/jonboulle/clockwork,Apache-2.0,
github.com/josharian/intern,https://github.com/josharian/intern,MIT,Josh Bleecher Snyder
github.com/kevinburke/ssh_config,https://github.com/kevinburke/ssh_config,MIT,Kevin Burke
github.com/labstack/echo-contrib/session,https://github.com/labstack/echo-contrib,MIT,LabStack
github.com/labstack/echo/v4,https://github.com/labstack/echo,MIT,LabStack
github.com/labstack/gommon,https://github.com/labstack/gommon,MIT,labstack
github.com/mailru/easyjson,https://github.com/mailru/easyjson,MIT,Mail.Ru Group
github.com/mattn/go-colorable,https://github.com/mattn/go-colorable,MIT,Yasuhiro Matsumoto
github.com/mattn/go-isatty,https://github.com/mattn/go-isatty,MIT,
github.com/mattn/go-sqlite3,https://github.com/mattn/go-sqlite3,MIT,Yasuhiro Matsumoto
github.com/matttproud/golang_protobuf_extensions/pbutil,https://github.com/matttproud/golang_protobuf_extensions,Apache-2.0,
github.com/mitchellh/go-homedir,https://github.com/mitchellh/go-homedir,MIT,Mitchell Hashimoto
Expand All @@ -66,11 +78,14 @@ github.com/src-d/gcfg,https://github.com/src-d/gcfg,BSD-3-Clause,Péter Surányi
github.com/stretchr/objx,https://github.com/stretchr/objx,MIT,"Stretchr, Inc."
github.com/stretchr/testify,https://github.com/stretchr/testify,MIT,"Mat Ryer, Tyler Bunnell and contributors"
github.com/temporalio/ringpop-go,https://github.com/temporalio/ringpop-go,MIT,"Uber Technologies, Inc."
github.com/temporalio/ui-server/server,https://github.com/temporalio/ui-server,MIT,Temporal Technologies Inc.
github.com/twmb/murmur3,https://github.com/twmb/murmur3,BSD-3-Clause,Sébastien Paolacci
github.com/uber-common/bark,https://github.com/uber-common/bark,MIT,"Uber Technologies, Inc."
github.com/uber-go/tally/v4,https://github.com/uber-go/tally,MIT,"Permission is hereby granted, free of charge, to any person obtaining a copy"
github.com/uber/tchannel-go,https://github.com/uber/tchannel-go,MIT,"Uber Technologies, Inc."
github.com/urfave/cli/v2,https://github.com/urfave/cli,MIT,Jeremy Saenz & Contributors
github.com/valyala/bytebufferpool,https://github.com/valyala/bytebufferpool,MIT,"Aliaksandr Valialkin, VertaMedia"
github.com/valyala/fasttemplate,https://github.com/valyala/fasttemplate,MIT,Aliaksandr Valialkin
github.com/xanzy/ssh-agent,https://github.com/xanzy/ssh-agent,Apache-2.0,
github.com/xwb1989/sqlparser,https://github.com/xwb1989/sqlparser,Apache-2.0,
go.opencensus.io,,Apache-2.0,
Expand Down Expand Up @@ -102,7 +117,7 @@ golang.org/x/tools,,BSD-3-Clause,The Go Authors
golang.org/x/xerrors,,BSD-3-Clause,The Go Authors
google.golang.org/api,,BSD-3-Clause,Google Inc.
google.golang.org/api/internal/third_party/uritemplates,,BSD-3-Clause,Joshua Tacoma
google.golang.org/genproto/googleapis,,Apache-2.0,
google.golang.org/genproto,,Apache-2.0,
google.golang.org/grpc,,Apache-2.0,
google.golang.org/protobuf,,BSD-3-Clause,The Go Authors
gopkg.in/inf.v0,,BSD-3-Clause,Péter Surányi. Portions Copyright (c) 2009 The Go
Expand All @@ -112,5 +127,4 @@ gopkg.in/src-d/go-billy.v4,,Apache-2.0,Sourced Technologies S.L
gopkg.in/src-d/go-git.v4,,Apache-2.0,"Sourced Technologies, S.L"
gopkg.in/validator.v2,,Apache-2.0,
gopkg.in/warnings.v0,,BSD-2-Clause,Péter Surányi
gopkg.in/yaml.v2,,Apache-2.0,
gopkg.in/yaml.v3,,MIT,Kirill Simonov
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Features that align with this goal:
- Fast startup time
- Minimal resource overhead: no dependencies on a container runtime or database server
- Support for Windows, Linux, and macOS
- Ships with a web interface

## Getting Started

Expand All @@ -37,9 +38,11 @@ go install github.com/DataDog/temporalite/cmd/temporalite@latest
Start Temporal server:

```bash
temporalite start
temporalite start --namespace default
```

At this point you should have a server running on `localhost:7233` and a web interface at http://localhost:8233.

### Use CLI

Use [Temporal's command line tool](https://docs.temporal.io/docs/system-tools/tctl) `tctl` to interact with the local Temporalite server.
Expand Down
35 changes: 29 additions & 6 deletions cmd/temporalite/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (
"net"
"os"

uiserver "github.com/temporalio/ui-server/server"
uiconfig "github.com/temporalio/ui-server/server/config"
uiserveroptions "github.com/temporalio/ui-server/server/server_options"
"github.com/urfave/cli/v2"
"go.temporal.io/server/common/headers"
"go.temporal.io/server/common/log"
Expand All @@ -32,6 +35,7 @@ const (
ephemeralFlag = "ephemeral"
dbPathFlag = "filename"
portFlag = "port"
uiPortFlag = "ui-port"
ipFlag = "ip"
logFormatFlag = "log-format"
namespaceFlag = "namespace"
Expand Down Expand Up @@ -76,6 +80,11 @@ func buildCLI() *cli.App {
Usage: "port for the temporal-frontend GRPC service",
Value: liteconfig.DefaultFrontendPort,
},
&cli.IntFlag{
Name: uiPortFlag,
Usage: "port for the temporal web UI",
DefaultText: fmt.Sprintf("--port + 1000, eg. %d", liteconfig.DefaultFrontendPort+1000),
},
&cli.StringFlag{
Name: logFormatFlag,
Usage: `customize the log formatting (allowed: "json", "pretty")`,
Expand All @@ -93,7 +102,7 @@ func buildCLI() *cli.App {
Name: ipFlag,
Usage: `IPv4 address to bind the frontend service to instead of localhost`,
EnvVars: nil,
Value: "",
Value: "127.0.0.1",
},
},
Before: func(c *cli.Context) error {
Expand All @@ -117,13 +126,31 @@ func buildCLI() *cli.App {
return nil
},
Action: func(c *cli.Context) error {
var (
ip = c.String(ipFlag)
serverPort = c.Int(portFlag)
uiPort = serverPort + 1000
)

if c.IsSet(uiPortFlag) {
uiPort = c.Int(uiPortFlag)
}
uiOpts := uiconfig.Config{
TemporalGRPCAddress: fmt.Sprintf(":%d", c.Int(portFlag)),
Host: ip,
Port: uiPort,
EnableUI: true,
}

opts := []temporalite.ServerOption{
temporalite.WithFrontendPort(c.Int(portFlag)),
temporalite.WithFrontendPort(serverPort),
temporalite.WithFrontendIP(ip),
temporalite.WithDatabaseFilePath(c.String(dbPathFlag)),
temporalite.WithNamespaces(c.StringSlice(namespaceFlag)...),
temporalite.WithUpstreamOptions(
temporal.InterruptOn(temporal.InterruptCh()),
),
temporalite.WithUI(uiserver.NewServer(uiserveroptions.WithConfig(&uiOpts))),
}
if c.Bool(ephemeralFlag) {
opts = append(opts, temporalite.WithPersistenceDisabled())
Expand All @@ -142,10 +169,6 @@ func buildCLI() *cli.App {
opts = append(opts, temporalite.WithLogger(logger))
}

if c.IsSet(ipFlag) {
opts = append(opts, temporalite.WithFrontendIP(c.String(ipFlag)))
}

s, err := temporalite.NewServer(opts...)
if err != nil {
return err
Expand Down
15 changes: 15 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.17
require (
github.com/google/go-licenses v0.0.0-20210816172045-3099c18c36e1
github.com/google/licenseclassifier v0.0.0-20210722185704-3043a050f148
github.com/temporalio/ui-server v0.1.1-0.20211223210854-4484839e0398
github.com/urfave/cli/v2 v2.3.0
go.temporal.io/sdk v1.11.1
go.temporal.io/server v1.14.1
Expand All @@ -21,13 +22,16 @@ require (
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cactus/go-statsd-client v3.1.1+incompatible // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coreos/go-oidc/v3 v3.0.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/gocql/gocql v0.0.0-20211015133455-b225f9b53fa1 // indirect
github.com/gogo/gateway v1.1.0 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gogo/status v1.1.0 // indirect
Expand All @@ -39,7 +43,11 @@ require (
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gax-go/v2 v2.1.1 // indirect
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/gorilla/sessions v1.2.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
github.com/iancoleman/strcase v0.2.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
Expand All @@ -48,7 +56,12 @@ require (
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect
github.com/labstack/echo-contrib v0.9.0 // indirect
github.com/labstack/echo/v4 v4.2.1 // indirect
github.com/labstack/gommon v0.3.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.11 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-sqlite3 v1.14.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
Expand All @@ -75,6 +88,8 @@ require (
github.com/uber-common/bark v1.3.0 // indirect
github.com/uber-go/tally/v4 v4.1.0 // indirect
github.com/uber/tchannel-go v1.22.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
github.com/xanzy/ssh-agent v0.2.1 // indirect
github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2 // indirect
go.opencensus.io v0.23.0 // indirect
Expand Down

0 comments on commit 583fa90

Please sign in to comment.