haz-cli
Version:
205 lines (148 loc) • 4.97 kB
Markdown
HAZ
=================
HAZ is a CLI tool that helps you manage your docker containers. It is designed to be used in conjunction with docker-compose.
[](https://codecov.io/gh/brianclogan/haz)
[](https://npmjs.org/package/haz-cli)
[](https://npmjs.org/package/haz-cli)
## Table of Contents
<!-- toc -->
* [Docker Configuration](#docker-configuration)
<!-- tocstop -->
## Usage
<!-- usage -->
```sh-session
$ npm install -g haz-cli
$ haz COMMAND
running command...
$ haz (--version)
haz-cli/0.0.4 darwin-arm64 node-v21.7.1
$ haz --help [COMMAND]
USAGE
$ haz COMMAND
...
```
<!-- usagestop -->
## Configuration
To configure haz, create a `.haz` file in the root of your project. It will be formatted as a yaml file, and will contain the configuration for your docker services and other settings.
```yaml
# Docker Configuration
docker:
# Service Configuration
# The name of the service in your docker-compose file
web:
# Setup Commands
###
# These should only be run if you need something to be installed after the container is built.
# If it is something that can be done during the build process, it should be done in the Dockerfile.
###
setup:
- npm i -g yarn
- yarn install
# Unit Test Command
unit: YourUnitTestCommand
# Coverage Test Command
coverage: YourCoverageTestCommand
db:
unit: YourUnitTestCommand
coverage: YourCoverageTestCommand
```
## Commands
<!-- commands -->
* [`haz docker:down`](#haz-dockerdown)
* [`haz docker:pull [SERVICE]`](#haz-dockerpull-service)
* [`haz docker:setup`](#haz-dockersetup)
* [`haz docker:stop`](#haz-dockerstop)
* [`haz docker:up`](#haz-dockerup)
* [`haz test:coverage SERVICE`](#haz-testcoverage-service)
* [`haz test:unit SERVICE`](#haz-testunit-service)
## `haz docker:down`
Bring docker containers down
```
USAGE
$ haz docker:down [-v]
FLAGS
-v, --verbose Run with verbose logging
DESCRIPTION
Bring docker containers down
Bring docker containers down
```
_See code: [src/commands/docker/down.ts](https://github.com/brianclogan/haz/blob/v0.0.4/src/commands/docker/down.ts)_
## `haz docker:pull [SERVICE]`
Pull Docker Images
```
USAGE
$ haz docker:pull [SERVICE] [-v] [--dry-run] [--ignore-buildable] [--ignore-pull-failures] [--include-deops]
[--policy missing|always]
ARGUMENTS
SERVICE The service you want to pull the image for.
FLAGS
-v, --verbose Run with verbose logging
--dry-run Show what would be done, but do not actually do anything
--ignore-buildable Ignore imgages than can be built
--ignore-pull-failures Pull what it can and ignore failures
--include-deops Include dependencies
--policy=<option> Apply pull policy
<options: missing|always>
```
_See code: [src/commands/docker/pull.ts](https://github.com/brianclogan/haz/blob/v0.0.4/src/commands/docker/pull.ts)_
## `haz docker:setup`
Setup the docker environment
```
USAGE
$ haz docker:setup [-v] [-s]
FLAGS
-s, --start Start the stack after setup.
-v, --verbose Run with verbose logging
DESCRIPTION
Setup the docker environment
This command will pull the docker images down, and cycle through the .haz file
to setup the environment.
```
_See code: [src/commands/docker/setup.ts](https://github.com/brianclogan/haz/blob/v0.0.4/src/commands/docker/setup.ts)_
## `haz docker:stop`
Stop the docker containers
```
USAGE
$ haz docker:stop [-v]
FLAGS
-v, --verbose Run with verbose logging
DESCRIPTION
Stop the docker containers
Stop the docker containers
```
_See code: [src/commands/docker/stop.ts](https://github.com/brianclogan/haz/blob/v0.0.4/src/commands/docker/stop.ts)_
## `haz docker:up`
Bring docker containers up
```
USAGE
$ haz docker:up [-v]
FLAGS
-v, --verbose Run with verbose logging
```
_See code: [src/commands/docker/up.ts](https://github.com/brianclogan/haz/blob/v0.0.4/src/commands/docker/up.ts)_
## `haz test:coverage SERVICE`
Run coverage tests on a container.
```
USAGE
$ haz test:coverage SERVICE [-v]
ARGUMENTS
SERVICE The service you want to run tests on.
FLAGS
-v, --verbose Run with verbose logging
DESCRIPTION
Run coverage tests on a container.
Run coverage tests on a container.
```
_See code: [src/commands/test/coverage.ts](https://github.com/brianclogan/haz/blob/v0.0.4/src/commands/test/coverage.ts)_
## `haz test:unit SERVICE`
Run unit tests on a container.
```
USAGE
$ haz test:unit SERVICE [-v]
ARGUMENTS
SERVICE The service you want to run tests on.
FLAGS
-v, --verbose Run with verbose logging
```
_See code: [src/commands/test/unit.ts](https://github.com/brianclogan/haz/blob/v0.0.4/src/commands/test/unit.ts)_
<!-- commandsstop -->