diff --git a/orbit/README.md b/orbit/README.md index d674c4f615..1a55fc263e 100644 --- a/orbit/README.md +++ b/orbit/README.md @@ -7,13 +7,64 @@ Orbit is the recommended agent for Fleet. But Orbit can be used with or without # Documentation - [Releasing Orbit](docs/Releasing-Orbit.md) + +## How to build from source + +To build orbit we use [goreleaser](https://goreleaser.com/). + +For reference, here are the build configuration files: +- [Goreleaser github workflow](../.github/workflows/goreleaser-orbit.yml) +- Goreleaser configuration file for each platform: + - [goreleaser-linux.yml](./goreleaser-linux.yml) + - [goreleaser-macos.yml](./goreleaser-macos.yml) + - [goreleaser-windows.yml](./goreleaser-windows.yml) + +Following are the commands to build in case you can't use goreleaser. + +> IMPORTANT: We recommend you build orbit natively and not cross compile to avoid any build or runtime errors. + +### macOS +```sh +CGO_ENABLED=1 \ +CODESIGN_IDENTITY=$CODESIGN_IDENTITY \ +ORBIT_VERSION=$VERSION \ +ORBIT_BINARY_PATH=./orbit-macos \ +go run ./orbit/tools/build/build.go +``` + +### Windows +```sh +CGO_ENABLED=0 \ +GOOS=windows \ +GOARCH=amd64 \ +go build \ +-trimpath \ +-ldflags="-X github.com/fleetdm/fleet/v4/orbit/pkg/build.Version=$VERSION \ +-X github.com/fleetdm/fleet/v4/orbit/pkg/build.Commit=$COMMIT \ +-X github.com/fleetdm/fleet/v4/orbit/pkg/build.Date=$DATE" \ +-o ./orbit.exe ./orbit/cmd/orbit +``` + +### Linux +```sorbit/README.mdh +CGO_ENABLED=1 \ +GOOS=linux \ +GOARCH=amd64 \ +go build \ +-trimpath \ +-ldflags="-X github.com/fleetdm/fleet/v4/orbit/pkg/build.Version=$VERSION \ +-X github.com/fleetdm/fleet/v4/orbit/pkg/build.Commit=$COMMIT \ +-X github.com/fleetdm/fleet/v4/orbit/pkg/build.Date=$DATE" \ +-o ./orbit-linux ./orbit/cmd/orbit +``` + ## Bugs To report a bug or request a feature, [click here](https://github.com/fleetdm/fleet/issues). -#### Orbit Development +## Orbit Development -##### Run Orbit From Source +### Run Orbit From Source To execute orbit from source directly, run the following command: @@ -37,11 +88,12 @@ go run github.com/fleetdm/fleet/v4/orbit/cmd/orbit \ -- --flagfile=flagfile.txt --verbose ``` -##### Generate Installer Packages from Orbit Source +### Generate Installer Packages from Orbit Source The `fleetctl package` command generates installers by fetching the targets/executables from a [TUF](https://theupdateframework.io/) repository. To generate an installer that contains an Orbit built from source you need to setup a local TUF repository. The following document explains how you can generate a TUF repository, and installers that use it [tools/tuf/test](../tools/tuf/test/README.md). + ## FAQs ### How does Orbit compare with Kolide Launcher? @@ -71,7 +123,7 @@ Orbit uses a configurable update server. We expect that many folks will just use ## Community -#### Chat +### Chat Please join us in the #fleet channel on [osquery Slack](https://fleetdm.com/slack). diff --git a/orbit/goreleaser-linux.yml b/orbit/goreleaser-linux.yml index 9c974d09b2..a9e65fb4f9 100644 --- a/orbit/goreleaser-linux.yml +++ b/orbit/goreleaser-linux.yml @@ -1,5 +1,9 @@ project_name: orbit +################################################################################################# +# If this is updated make sure to update the "How to build from source" section in the README.md. +################################################################################################# + builds: - id: orbit dir: ./orbit/cmd/orbit/ diff --git a/orbit/goreleaser-macos.yml b/orbit/goreleaser-macos.yml index e64fe8ed3f..38c6f4d2bf 100644 --- a/orbit/goreleaser-macos.yml +++ b/orbit/goreleaser-macos.yml @@ -1,5 +1,9 @@ project_name: orbit +################################################################################################# +# If this is updated make sure to update the "How to build from source" section in the README.md. +################################################################################################# + builds: - id: orbit-macos dir: ./orbit/cmd/orbit/ diff --git a/orbit/goreleaser-windows.yml b/orbit/goreleaser-windows.yml index 9ed8963e55..fa2a71339a 100644 --- a/orbit/goreleaser-windows.yml +++ b/orbit/goreleaser-windows.yml @@ -1,5 +1,9 @@ project_name: orbit +################################################################################################# +# If this is updated make sure to update the "How to build from source" section in the README.md. +################################################################################################# + builds: - id: orbit dir: ./orbit/cmd/orbit/