npm package: @notabene/ops
Description: CLI for Notabene Ops
Author: Notabene
Latest version: 1.10.0

<div align="center">

<img src="https://assets-global.website-files.com/5e68f0772de982756aa8c1a4/5eee5fb470215e6ecdc34b94_Full_transparent_black_1280x413.svg" height=50>

<br>

# Notabene Ops CLI

[![pipeline status](https://gitlab.com/notabene/open-source/cli/badges/master/pipeline.svg)](https://gitlab.com/notabene/open-source/cli/-/commits/master)
[![Latest Release](https://gitlab.com/notabene/open-source/cli/-/badges/release.svg)](https://gitlab.com/notabene/open-source/cli/-/releases)

Internal CLI tool to make development faster.

[Documentation](https://devx.notabene.id) •
[Prerequisites](#prerequisites) •
[Installation](#installation)

</div>

## Prerequisites

You'll need to install the following packages first:

- [AWS CLI](https://aws.amazon.com/cli/)
- [AWS Session Manager Plugin](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html)

## Installation

Install the library globally using Yarn:

```
yarn global add @notabene/ops
```

or NPM:

```
npm i -g @notabene/ops
```

Make sure that the path to globally installed packages are in your `$PATH` environment variable.

The Ops CLI is then available using `nb`.

## Setup & Auth

You can configure your AWS CLI by calling:

```bash
nb setup
```

Then you'll need to authenticate a session with AWS which you can initiate with:

```bash
nb login
```

## Databases

### Login

List all databases in an environment:

```bash
nb db:list --env {env}
```

### Credentials

Get credentials for a specific database:

```bash
nb db:credentials --env {env} --db {db}
```

### Connect

Connect to an AWS RDS database by mounting a local port:

```bash
nb db:connect --env {env} --db {db} --port {localPort}
```

_Note: You can then use a tool like [Postico](https://eggerapps.at/postico2/) to connect to the database on the local port you mounted._

## Kafka

### Brokers

Get a list of brokers for the Kafka instance running in an environment:

```bash
nb kafka:brokers --env {env}
```

### UI

Connect to the Kafka UI running in an environment by mounting a local port:

```bash
nb  kafka:ui --env {env} --port {localPort}
```

_Note: You can then access the UI by going to http://localhost:{localPort}_

## Service

### List

Get a list of all services running in an environment:

```bash
nb service:list --env {env}
```

### Logs

Tail the logs of a service running in an environment:

```bash
nb service:logs --env {env} --service {service}
```

## Redis

### List

Get a list of Redis clusters running in an envionment:

```bash
nb redis:list --env {env}
```

### Connect

Connect to a Redis cluster running in an environment by mounting a local port:

```bash
nb redis:connect --env {env} --cluster {cluster} --port {localPort}
```

_Note: You can now use a tool like [RedisInsight](https://redis.com/redis-enterprise/redis-insight/) to connect to the Redis cluster on the port you mounted._

## Network

### IPs

Get a list of static IPs of the NAT Gateways in an environment. This is usually useful
for customers that need to whitelist the IPs of our services when we send webhooks to them.

```bash
nb network:ips --env {env}
```

## Bastion

### Connect

Start a terminal session connected to the bastion instance running in an environment:

```bash
nb bastion:connect --env {env}
```