Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 66 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
![CLI GitHub Workflow Status](https://github.com/codesphere-cloud/oms/actions/workflows/service-build_test.yml/badge.svg)
![Service GitHub Workflow Status](https://github.com/codesphere-cloud/oms/actions/workflows/cli-build_test.yml/badge.svg)

Expand All @@ -6,46 +7,93 @@
This repository contains the source for the operations management system. It
contains the sources for both the CLI and the Service.

## CLI
The CLI tool is used to bootstrap Codesphere cluster on customer sites and
## OMS CLI

The OMS CLI tool is used to bootstrap Codesphere cluster on customer sites and
replaces the formerly used private cloud installer.

### How to Build?
### Installation

```shell
make build-cli
You can install the OMS CLI in a few ways:

#### Using GitHub CLI (`gh`)

If you have the [GitHub CLI](https://cli.github.com/) installed, you can install the OMS CLI with a command like the following.
Note that some commands may require you to elevate to the root user with `sudo`.

##### ARM Mac

```
gh release download -R codesphere-cloud/oms -O /usr/local/bin/oms-cli -p "oms-cli*darwin_arm64"
chmod +x /usr/local/bin/oms-cli
```

### How to Test?
##### Linux Amd64

```
gh release download -R codesphere-cloud/oms -O /usr/local/bin/oms-cli -p "oms-cli*linux_amd64"
chmod +x /usr/local/bin/oms-cli
```

### How to Use?
#### Using `wget`

This option requires to have the `wget` and `jq` utils installed. Download the OMS CLI and add permissions to run it with the following commands:
Note that some commands may require you to elevate to the root user with `sudo`.

## Service
##### ARM Mac

### How to Build?
```
wget -qO- 'https://api.github.com/repos/codesphere-cloud/oms/releases/latest' | jq -r '.assets[] | select(.name | match("oms-cli.*darwin_arm64")) | .browser_download_url' | xargs wget -O oms-cli
mv oms-cli /usr/local/bin/oms-cli
chmod +x /usr/local/bin/oms-cli
```

```shell
make build-service
##### Linux Amd64

```
wget -qO- 'https://api.github.com/repos/codesphere-cloud/oms/releases/latest' | jq -r '.assets[] | select(.name | match("oms-cli.*linux_amd64")) | .browser_download_url' | xargs wget -O oms-cli
mv oms-cli /usr/local/bin/oms-cli
chmod +x /usr/local/bin/oms-cli
```

### How to Test?
#### Manual Download

You can also download the pre-compiled binaries from the [OMS Releases page](https://github.com/codesphere-cloud/oms/releases).
Note that some commands may require you to elevate to the root user with `sudo`.

1. Go to the [latest release](https://github.com/codesphere-cloud/oms-cli/releases/latest).

2. Download the appropriate release for your operating system and architecture (e.g., `oms-cli_darwin_amd64` for macOS, `oms-cli_linux_amd64` for Linux, or `oms-cli_windows_amd64` for Windows).

### How to Use?
3. Move the `oms-cli` binary to a directory in your system's `PATH` (e.g., `/usr/local/bin` on Linux/Mac, or a directory added to `Path` environment variable on Windows).

4. Make the binary executable (e.g. by running `chmod +x /usr/local/bin/oms-cli` on Mac or Linux)

## How to add a command to one of the binaries?
#### Available Commands

This project currently uses a fork of cobra-cli with locally-scoped variables: https://github.com/NautiluX/cobra-cli-local
The OMS CLI organizes its functionality into several top-level commands, each with specific subcommands and flags.

See our [Usage Documentation](docs) for usage information about the specific subcommands.

### How to Build?

```shell
cobra-cli add -L -d cli -p install postgres
make build-cli
```

This command will add the following command to the CLI:
See also [CONTRIBUTION.md]

## Service

The service implementation is currently WIP

### How to Build?

```shell
oms-cli install postgres
make build-service
```

## Community & Contributions

Please review our [Code of Conduct](CODE_OF_CONDUCT.md) to understand our community expectations.
We welcome contributions! All contributions to this project must be made in accordance with the Developer Certificate of Origin (DCO). See our full [Contributing Guidelines](CONTRIBUTING.md) for details.
29 changes: 4 additions & 25 deletions service/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,43 +1,22 @@
// Copyright (c) Codesphere Inc.
// SPDX-License-Identifier: Apache-2.0

package cmd

import (
"os"

"github.com/codesphere-cloud/cs-go/pkg/io"
"github.com/spf13/cobra"
)

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
// rootCmd represents the base command when called without any subcommands
rootCmd := &cobra.Command{
Use: "service",
Short: "A brief description of your application",
Long: `A longer description that spans multiple lines and likely contains
examples and usage of using your application. For example:
Short: "Codesphere Operations Management System",
Long: io.Long(`This is the OMS standalone service, which can be used to manage and observe Codesphere installations.

Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
// Uncomment the following line if your bare application
// has an action associated with it:
// Run: func(cmd *cobra.Command, args []string) { },
This area is work in progress! OMS is under heavy development so please take a look back soon!`),
}
// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.

// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.service.yaml)")

// Cobra also supports local flags, which will only run
// when this action is called directly.
// rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")

// Add child commands here
// AddChildCmd(rootCmd)

err := rootCmd.Execute()
if err != nil {
Expand Down