Skip to content

Commit

Permalink
[Web] Remove dashboard daemon, deprecate flags (#3856)
Browse files Browse the repository at this point in the history
In short the complexity of building and maintaining multiple distributions of the Sensu web interface has lead to slower development and a less than stellar community edition. By simplifying our build targets we hope to be able to serve both the community and commercial distributions better.

@calebhailey does the topic justice in Building A Better UI for Sensu; an excerpt:

> Although it has taken various different forms over the past few years, the Sensu project has been committed to open source from day one. At some point along the way we adopted an open core business model 1, which has helped us continue to invest in the OSS project even as we have built a commercial product offering on top of that core engine. Most recently we made the decision to modify our distribution model so that 100% of Sensu Go’s commercial features are now free up to your first 100 nodes. This has had a pretty huge impact on Sensu adoption, simplifying the process of choosing which version of Sensu you should use when you’re initially evaluating the platform – we’re now seeing that almost 100% of Sensu installations with 100 nodes or fewer under management are running the commercial distribution.
> While this has been great for users, it has complicated our OSS development process to a certain degree – primarily with respect to the Sensu Go web UI. Trying to maintain a common code base between OSS and the commercial version of the UI which leverages the commercial features of the Sensu backend has introduced some complexity that has slowed frontend product development.
> This friction combined with the success of our commercial distribution strategy (i.e., FREE Sensu for everyone!) has prompted us to make the decision to split the OSS web UI off as a separate project. Moving forward, new web UI features will be implemented in the commercial distribution first and continue to be made available for free up to your first 100 nodes.

Signed-off-by: James Phillips <[email protected]>
  • Loading branch information
jamesdphillips authored Jul 9, 2020
1 parent ae485d8 commit 04cc62d
Show file tree
Hide file tree
Showing 21 changed files with 21 additions and 1,385 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased

### Breaking Changes
- The web interface is now a standalone product and no longer distributed
inside the sensu-backend binary. Refer to https://github.com/sensu/web for
more.

### Fixed
- Clarifies wording around a secret provider error message.
- Logs and returns an error if a mutator cannot be found.
Expand Down
33 changes: 3 additions & 30 deletions backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"github.com/sensu/sensu-go/backend/authentication/providers/basic"
"github.com/sensu/sensu-go/backend/authorization/rbac"
"github.com/sensu/sensu-go/backend/daemon"
"github.com/sensu/sensu-go/backend/dashboardd"
"github.com/sensu/sensu-go/backend/etcd"
"github.com/sensu/sensu-go/backend/eventd"
"github.com/sensu/sensu-go/backend/keepalived"
Expand Down Expand Up @@ -73,6 +72,7 @@ type Backend struct {
SecretsProviderManager *secrets.ProviderManager
HealthRouter *routers.HealthRouter
EtcdClientTLSConfig *tls.Config
APIDConfig apid.Config

ctx context.Context
runCtx context.Context
Expand Down Expand Up @@ -397,7 +397,7 @@ func Initialize(ctx context.Context, config *Config) (*Backend, error) {
}

// Initialize apid
apidConfig := apid.Config{
b.APIDConfig = apid.Config{
ListenAddress: config.APIListenAddress,
URL: config.APIURL,
Bus: bus,
Expand All @@ -412,7 +412,7 @@ func Initialize(ctx context.Context, config *Config) (*Backend, error) {
GraphQLService: b.GraphQLService,
HealthRouter: b.HealthRouter,
}
api, err := apid.New(apidConfig)
api, err := apid.New(b.APIDConfig)
if err != nil {
return nil, fmt.Errorf("error initializing %s: %s", api.Name(), err)
}
Expand All @@ -433,33 +433,6 @@ func Initialize(ctx context.Context, config *Config) (*Backend, error) {
}
b.Daemons = append(b.Daemons, tessen)

// Initialize dashboardd TLS config
var dashboardTLSConfig *corev2.TLSOptions

// Always use dashboard tls options when they are specified
if config.DashboardTLSCertFile != "" && config.DashboardTLSKeyFile != "" {
dashboardTLSConfig = &corev2.TLSOptions{
CertFile: config.DashboardTLSCertFile,
KeyFile: config.DashboardTLSKeyFile,
}
} else if config.TLS != nil {
// use apid tls config if no dashboard tls options are specified
dashboardTLSConfig = &corev2.TLSOptions{
CertFile: config.TLS.GetCertFile(),
KeyFile: config.TLS.GetKeyFile(),
}
}
dashboard, err := dashboardd.New(dashboardd.Config{
APIDConfig: apidConfig,
Host: config.DashboardHost,
Port: config.DashboardPort,
TLS: dashboardTLSConfig,
})
if err != nil {
return nil, fmt.Errorf("error initializing %s: %s", dashboard.Name(), err)
}
b.Daemons = append(b.Daemons, dashboard)

return b, nil
}

Expand Down
4 changes: 0 additions & 4 deletions backend/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func TestBackendHTTPListener(t *testing.T) {
apURL := fmt.Sprintf("%s://127.0.0.1:0", tc.httpScheme)
agentPort := 8081
apiPort := 8080
dashboardPort := 3000
initCluster := fmt.Sprintf("default=%s", apURL)

var tlsInfo etcd.TLSInfo
Expand All @@ -83,8 +82,6 @@ func TestBackendHTTPListener(t *testing.T) {
AgentHost: "127.0.0.1",
AgentPort: agentPort,
APIListenAddress: fmt.Sprintf("127.0.0.1:%d", apiPort),
DashboardHost: "127.0.0.1",
DashboardPort: dashboardPort,
StateDir: dataPath,
CacheDir: cachePath,
TLS: tc.tls,
Expand Down Expand Up @@ -124,7 +121,6 @@ func TestBackendHTTPListener(t *testing.T) {

retryConnect(t, fmt.Sprintf("127.0.0.1:%d", agentPort))
retryConnect(t, fmt.Sprintf("127.0.0.1:%d", apiPort))
retryConnect(t, fmt.Sprintf("127.0.0.1:%d", dashboardPort))

userCredentials := base64.StdEncoding.EncodeToString([]byte("agent:P@ssw0rd!"))

Expand Down
13 changes: 13 additions & 0 deletions backend/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import (
"golang.org/x/time/rate"
)

// The DeprecateDashboardFlags is used to mark usage dashboard daemon flags
// as deprecated.
var DeprecateDashboardFlags = true

var (
annotations map[string]string
labels map[string]string
Expand Down Expand Up @@ -427,6 +431,15 @@ func handleConfig(cmd *cobra.Command, server bool) error {
_ = cmd.Flags().SetAnnotation(flagEtcdNodeName, "categories", []string{"store"})
}

// Deprecated flags
if server && DeprecateDashboardFlags {
msg := "as of Sensu v6.0 the dashboard is no longer distributed as part of the sensu-backend binary"
_ = cmd.Flags().MarkDeprecated(flagDashboardHost, msg)
_ = cmd.Flags().MarkDeprecated(flagDashboardPort, msg)
_ = cmd.Flags().MarkDeprecated(flagDashboardCertFile, msg)
_ = cmd.Flags().MarkDeprecated(flagDashboardKeyFile, msg)
}

// Etcd client/server flags
cmd.Flags().StringSlice(flagEtcdCipherSuites, nil, "list of ciphers to use for etcd TLS configuration")
_ = cmd.Flags().SetAnnotation(flagEtcdCipherSuites, "categories", []string{"store"})
Expand Down
20 changes: 0 additions & 20 deletions backend/dashboardd/LICENSE

This file was deleted.

159 changes: 0 additions & 159 deletions backend/dashboardd/asset/collection.go

This file was deleted.

64 changes: 0 additions & 64 deletions backend/dashboardd/asset/collection_test.go

This file was deleted.

1 change: 0 additions & 1 deletion backend/dashboardd/asset/fixtures/dir_a/a

This file was deleted.

Empty file.
Empty file.
Empty file.
1 change: 0 additions & 1 deletion backend/dashboardd/asset/fixtures/dir_b/a

This file was deleted.

Empty file.
Loading

0 comments on commit 04cc62d

Please sign in to comment.