Skip to content

Commit

Permalink
📝 update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dzove855 committed Aug 12, 2024
1 parent c12ad28 commit 3780633
Showing 1 changed file with 231 additions and 88 deletions.
319 changes: 231 additions & 88 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,138 +24,281 @@ PROG=paashup-cli source autocompletion.bash

## Usage

`paashup-cli` provides multiple commands categorized under platforms, Docker resources, Netbox configurations, and stack deployments.

### Global Flags

- `--format, -f`: Choose between `yaml`, `json`, `json-pretty` (Default: `json`)
- `--format, -f`: Choose between `yaml`, `json`, or `json-pretty` formats. Default is `json`.

### Commands
### Commands Overview

#### Netbox
The CLI is structured with several main commands, each with its own set of subcommands.

The `netbox` command allows you to manage Netbox configurations. It has the following subcommands:
#### 1. Platform Commands

- **set-config**: Set Netbox configuration.
```sh
paashup-cli netbox set-config NAME NETBOX_URL NETBOX_TOKEN
```
Manage platforms within your paashup environment.

- **use**: Use a specific Netbox configuration.
```sh
paashup-cli netbox use NAME
- **Create an Account**

```bash
paashup-cli platform account create <username> <password>
```

#### Docker
Creates a new account. Example:

The `docker` command allows you to manage Docker containers, hosts, and images. It has the following subcommands:
```bash
paashup-cli platform account create user1 password123
```

##### Container
- **Initialize a Platform**

- **list**: List all containers, optionally for a specific host.
```sh
paashup-cli docker container ls [hostname]
```bash
paashup-cli platform init <username> <password>
```
- Aliases: `ps`, `ls`

- **logs**: Get logs of a container.
```sh
paashup-cli docker container logs <hostname> <containername>
```
Initializes a platform. Example:

- **start**: Start a container. Optionally, wait for the container to start.
```sh
paashup-cli docker container start [--nowait] <hostname> <containername>
```bash
paashup-cli platform init user1 password123
```
- `--nowait, -w`: Do not wait for the container to start.

- **stop**: Stop a container. Optionally, wait for the container to stop.
```sh
paashup-cli docker container stop [--nowait] <hostname> <containername>
```
- `--nowait, -w`: Do not wait for the container to stop.

- **inspect**: Inspect a container.
```sh
paashup-cli docker container inspect <hostname> <containername>
```
#### 2. Netbox Commands

Manage Netbox configurations for your paashup environment.

- **Set Netbox Configuration**

- **exec**: Execute a command in a container.
```sh
paashup-cli docker container exec <hostname> <containername> '<command>'
```bash
paashup-cli netbox set-config NAME NETBOX_URL NETBOX_TOKEN
```

##### Host
Sets a Netbox configuration. Example:

- **list**: List all Docker hosts.
```sh
paashup-cli docker host list
```bash
paashup-cli netbox set-config myconfig http://netbox.example.com token123
```
- Aliases: `ls`, `ps`

- **inspect**: Inspect a Docker host.
```sh
paashup-cli docker host inspect <hostname>
- **Use Netbox Configuration**

```bash
paashup-cli netbox use NAME
```

##### Image
Selects a Netbox configuration by name. Example:

- **list**: List all Docker images.
```sh
paashup-cli docker image list
```bash
paashup-cli netbox use myconfig
```
- Aliases: `ls`, `ps`

## Examples
#### 3. Stack Commands

Here are a few examples of how to use `paashup-cli`:
Manage and deploy stacks.

- Set a Netbox configuration:
```sh
paashup-cli netbox set-config myconfig http://netbox.local mytoken
```
- **Deploy a Stack**

- Use a specific Netbox configuration:
```sh
paashup-cli netbox use myconfig
```bash
paashup-cli stack deploy YAMLFILE
```

- List all containers:
```sh
paashup-cli docker container ls
```
Deploys a stack from a YAML file. Example:

- Get logs of a container:
```sh
paashup-cli docker container logs myhostname mycontainer
```bash
paashup-cli stack deploy stack.yaml
```

- Start a container and wait for it to start:
```sh
paashup-cli docker container start myhostname mycontainer
```
#### 4. Docker Commands

- Stop a container without waiting:
```sh
paashup-cli docker container stop --nowait myhostname mycontainer
```
Manage Docker resources including containers, hosts, images, volumes, and registries.

- Inspect a container:
```sh
paashup-cli docker container inspect myhostname mycontainer
```
- **Docker Container Commands**

- Execute a command in a container:
```sh
paashup-cli docker container exec myhostname mycontainer 'ls -la'
```
- **List Containers**

```bash
paashup-cli docker container ls [hostname]
```

Lists all containers. Example:

```bash
paashup-cli docker container ls myhost
```

- **Get Logs**

```bash
paashup-cli docker container logs <hostname> <containername>
```

Fetches logs for a specific container. Example:

```bash
paashup-cli docker container logs myhost mycontainer
```

- **Start a Container**

```bash
paashup-cli docker container start [--nowait] <hostname> <containername>
```

Starts a specific container. Example:

```bash
paashup-cli docker container start --nowait myhost mycontainer
```

- **Stop a Container**

```bash
paashup-cli docker container stop [--nowait] <hostname> <containername>
```

Stops a specific container. Example:

```bash
paashup-cli docker container stop --nowait myhost mycontainer
```

- **Inspect a Container**

```bash
paashup-cli docker container inspect <hostname> <containername>
```

Inspects a specific container. Example:

```bash
paashup-cli docker container inspect myhost mycontainer
```

- **Execute Command in a Container**

```bash
paashup-cli docker container exec <hostname> <containername> '<command>'
```

Executes a command within a specific container. Example:

```bash
paashup-cli docker container exec myhost mycontainer 'ls -la'
```

- **Docker Host Commands**

- **List Hosts**

```bash
paashup-cli docker host ls
```

Lists all hosts. Example:

```bash
paashup-cli docker host ls
```

- **Inspect a Host**

```bash
paashup-cli docker host inspect <hostname>
```

Inspects a specific host. Example:

```bash
paashup-cli docker host inspect myhost
```

- **Docker Image Commands**

- **List Images**

```bash
paashup-cli docker image ls
```

Lists all images. Example:

```bash
paashup-cli docker image ls
```

- **Docker Volume Commands**

- **List Volumes**

```bash
paashup-cli docker volume ls
```

Lists all volumes. Example:

```bash
paashup-cli docker volume ls
```

- **Docker Registry Commands**

- **List Registries**

```bash
paashup-cli docker registry ls
```

Lists all registries. Example:

```bash
paashup-cli docker registry ls
```

## Example Workflows

### Set Up a New Environment

1. **Set Netbox Configuration**

```bash
paashup-cli netbox set-config myconfig http://netbox.example.com token123
```

2. **Initialize a Platform**

```bash
paashup-cli platform init
```

3. **Deploy a Stack**

```bash
paashup-cli stack deploy stack.yaml
```

### Manage Docker Containers

1. **List All Containers**

```bash
paashup-cli docker container ls
```

2. **Start a Container**

```bash
paashup-cli docker container start --nowait myhost mycontainer
```

3. **Get Logs from a Container**

```bash
paashup-cli docker container logs myhost mycontainer
```

## Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

## License

`paashup-cli` is released under the BSD 3-Clause License. See the `LICENSE` file for more information.

---

This README provides a general overview of `paashup-cli` and how to use it. For more detailed documentation and examples, please refer to the official documentation.
This project is licensed under the MIT License. See the LICENSE file for details.

0 comments on commit 3780633

Please sign in to comment.