Make fleetctl preview available over HTTP (#508)

Make fleetctl preview available over HTTP

Run a second copy of the Fleet server listening over HTTP on
localhost:1337 so that the UI can be used without the errors displayed
with a self-signed TLS certificate. Osquery clients and fleetctl
continue to communicate with the existing Fleet server on
https://localhost:8412.

Closes #504

Co-authored-by: Mike McNeil <mikermcneil@users.noreply.github.com>
This commit is contained in:
Zach Wasserman 2021-03-22 15:04:19 -07:00 committed by GitHub
parent 7f43472431
commit b4f0f461c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -18,9 +18,7 @@ npm install -g fleetctl
sudo fleetctl preview
```
A local demo copy of the Fleet server is now running at https://localhost:8412.
> **Seeing a warning in your browser?** You can safely skirt the browser warning ("Your connection is not private") when accessing Fleet locally over https. For example in Google Chrome, visit `chrome://flags/#allow-insecure-localhost` to enable self-signed certs on localhost. Then [refresh Fleet](https://localhost:8412) and click through this warning using the "Advanced" option.
The Fleet UI is now available at http://localhost:1337.
#### Your first query
Ready to run your first query? Target some of your sample hosts and try it out:

View File

@ -67,7 +67,7 @@ Use the stop and reset subcommands to manage the server and dependencies once st
}
fmt.Println("Pulling Docker dependencies...")
out, err := exec.Command("docker-compose", "pull", "mysql01", "redis01", "fleet01").CombinedOutput()
out, err := exec.Command("docker-compose", "pull").CombinedOutput()
if err != nil {
fmt.Println(string(out))
return errors.Errorf("Failed to run docker-compose")
@ -85,6 +85,15 @@ Use the stop and reset subcommands to manage the server and dependencies once st
return errors.Wrap(err, "wait for server startup")
}
// Start fleet02 (UI server) after fleet01 (agent/fleetctl server)
// has finished starting up so that there is no conflict with
// running database migrations.
out, err = exec.Command("docker-compose", "up", "-d", "--remove-orphans", "fleet02").CombinedOutput()
if err != nil {
fmt.Println(string(out))
return errors.Errorf("Failed to run docker-compose")
}
fmt.Println("Initializing server...")
const (
address = "https://localhost:8412"
@ -133,10 +142,9 @@ Use the stop and reset subcommands to manage the server and dependencies once st
return errors.Wrap(err, "Error writing fleetctl configuration")
}
fmt.Println("Fleet is now available at https://localhost:8412.")
fmt.Println("Fleet UI is now available at http://localhost:1337.")
fmt.Println("Username:", username)
fmt.Println("Password:", password)
fmt.Println("Note: You can safely ignore the browser warning \"Your connection is not private\". Click through this warning using the \"Advanced\" option. Chrome users may need to configure chrome://flags/#allow-insecure-localhost.")
// Create client and get enroll secret
client, err := unauthenticatedClientFromCLI(c)