Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
zipofar committed Nov 28, 2023
2 parents ba5d5ce + 158fa74 commit ca24f08
Show file tree
Hide file tree
Showing 35 changed files with 998 additions and 227 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
uffizzi-cli (2.3.3)
uffizzi-cli (2.3.4)
activesupport
awesome_print
faker
Expand Down Expand Up @@ -36,7 +36,7 @@ GEM
factory_bot (6.2.0)
activesupport (>= 5.0.0)
fakefs (1.8.0)
faker (3.2.1)
faker (3.2.2)
i18n (>= 1.8.11, < 2)
hashdiff (1.0.1)
i18n (1.8.11)
Expand Down Expand Up @@ -99,8 +99,8 @@ GEM
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.11.0)
securerandom (0.2.2)
sentry-ruby (5.12.0)
securerandom (0.3.0)
sentry-ruby (5.14.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
thor (1.3.0)
tty-color (0.6.0)
Expand Down
172 changes: 2 additions & 170 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,178 +1,10 @@
# Uffizzi CLI

A command-line interace (CLI) for [Uffizzi App](https://github.com/UffizziCloud/uffizzi_app)

## Uffizzi Overview

Uffizzi is an open-source engine for creating lightweight, ephemeral test environments for APIs and full-stack applications. Uffizzi enables teams to preview new features before merging and to mitigate the risk of introducing regressions into a codebase. Each preview gets a shareable URL that's updated when you push new commits or image tags, so teams can provide continual feedback during the development/QA process. Previews can be configured to expire or be destroyed when a pull request is closed, so environments exist only as long as they are needed. Uffizzi also helps deconflict shared development environments since previews are deployed as isolated namespaces—there is no risk of clobbering another developer's preview.

While Uffizzi depends on Kubernetes, it does not require end-users to interface with Kubernetes directly. Instead, Uffizzi leverages Docker Compose as its configuration file format, so developers do not need modify Kubernetes manifests or even know about Kubernetes.

Uffizzi is designed to integrate with any CI/CD system.

## Uffizzi Architecture
<img src="https://github.com/UffizziCloud/uffizzi_app/blob/main/docs/images/uffizzi-architecture.png" description="Uffizzi Architecture" width="320"/>

Uffizzi consists of the following components:

- [Uffizzi App](https://github.com/UffizziCloud/uffizzi_app) - The primary REST API for creating and managing Previews
- [Uffizzi Controller](https://github.com/UffizziCloud/uffizzi_controller) - A smart proxy service that handles requests from Uffizzi App to the Kubernetes API
- Uffizzi CLI (this repository) - A command-line interface for Uffizzi App

To host Uffizzi yourself, you will also need the following external dependencies:

- Kubernetes (k8s) cluster
- Postgres database
- Redis cache
A command-line interace (CLI) for the [Uffizzi API](https://github.com/UffizziCloud/uffizzi)

## Installation

The Uffizzi CLI can be used interactively or as part of an automated workflow (e.g. GitHub Actions). Both options use the `uffizzi/cli` container image available on Docker Hub.

### Interactive mode

Run the CLI as a Docker container in interactive mode:
```
docker run --interactive --rm --tty --entrypoint=sh uffizzi/cli
```

If you specify the following environment variables, the Docker image's
entrypoint script can log you into Uffizzi before executing your command.

- `UFFIZZI_USER`
- `UFFIZZI_SERVER`
- `UFFIZZI_PASSWORD`
- `UFFIZZI_PROJECT` (optional)

### Automated mode

If you want to use Uffizzi as part of an automated workflow, you can pass the Uffizzi commands to the Docker run command. For example:

```
docker run -it --rm uffizzi/cli project list
```

## Sample commands and examples

### help

The `help` subcommand can be used to see more information about a particular command.

Examples:

```
uffizzi help
```

```
uffizzi preview help
```

```
uffizzi project compose help
```

### login

```
uffizzi login --server=localhost:8080 [email protected]
```

Log in to the app with the specified server.

#### login options

| Option | Aliase | Description |
| ------------ | ------ | ------------------------- |
| `--username` | `-u` | Your email for logging in |
| `--server` | | The URL of the Uffizzi installation |

If server uses basic authentication you can specify options for it by setting `basic_auth_user` and `basic_auth_password` via `config set` command.

### config

Use this command to configure your cli app.

```
$ uffizzi config
```

Launching interactive setup guide that sets the values for `server`, `username` and `project`

### config subcommands

This command has 4 subcommands `list`, `get`, `set`, and `delete`.

```
uffizzi config list
```

Shows all options and their values from the config file.

```
uffizzi config get-value OPTION
```

Shows the value of the specified option.

```
uffizzi config set OPTION VALUE
```

Sets specified value for specified option. If a specified option already exists and has value it will be overwritten.

```
uffizzi config unset OPTION
```

Unsets specified option.

### project

```
uffizzi project
```

Use this command to configure your projects. This command has 2 subcommands `list` and `compose`.

```
uffizzi project list
```

Shows all your projects' slugs

If you have only one project it will be added to your config file automatically, if there's more than one project you need to set up your project manually with the commands `uffizzi config set YOUR_PROJECT_SLUG` or `uffizzi project set-default YOUR_PROJECT_SLUG`

```
$ uffizzi project set-default PROJECT_SLUG
```
Create a preview from a compose file.

Sets the default project given with the given project slug. When set, all commands use this project as the default context unless overridden by the --project flag.

### preview

Create and manage previews

```
uffizzi preview create docker-compose.uffizzi.yml
```
Create a preview from a compose file.

```
uffizzi preview delete deployment-21
```
Delete a preview with preview ID `deployment-21`.

### disconnect

```
uffizzi disconnect CREDENTIAL_TYPE
```

Deletes credential of specified type

Supported credential types - `docker-hub`, `acr`, `ecr`, `gcr`
See the [Uffizzi Documentation](https://docs.uffizzi.com) for installation instructions.

## Contributing

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ services:
- ~/.ssh:/root/.ssh
- ~/.bash_history:/root/.bash_history
- ~/.config/uffizzi:/root/.config/uffizzi
- ~/test/uffizzi_app/charts/uffizzi-app:/gem/tmp/charts/uffizzi_app
- ~/test/uffizzi_controller_os/charts/uffizzi-controller:/gem/tmp/charts/uffizzi-controller
- bundle_cache:/bundle_cache
environment:
- BUNDLE_PATH=/bundle_cache
Expand Down
8 changes: 8 additions & 0 deletions lib/uffizzi/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ def disconnect(credential_type)
require_relative 'cli/dev'
subcommand 'dev', Cli::Dev

desc 'install', 'install'
require_relative 'cli/install'
subcommand 'install', Cli::Install

desc 'uninstall', 'uninstall'
require_relative 'cli/uninstall'
subcommand 'uninstall', Cli::Uninstall

map preview: :compose

class << self
Expand Down
Loading

0 comments on commit ca24f08

Please sign in to comment.