Metadata-Version: 2.1
Name: containers-sugar
Version: 1.11.2
Summary: Simplify the usage of containers
License: BSD 3 Clause
Author: Ivan Ogasawara
Author-email: ivan.ogasawara@gmail.com
Requires-Python: >=3.8.1,<4
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: Jinja2 (>=2)
Requires-Dist: colorama (>=0.4.6)
Requires-Dist: plotille (>=5)
Requires-Dist: python-dotenv (>=0.21.1)
Requires-Dist: pyyaml (>=6)
Requires-Dist: rich (>=13.7)
Requires-Dist: sh (>=2.0.0)
Requires-Dist: textual (>=0.48)
Description-Content-Type: text/markdown

# sugar

Simplify the usage of containers.

You may be thinking, why do I need a new library that wrap-up
docker-compose or podman-compose if they are already really simple to use?

Yes, they are simple to use, but if you have some other parameters to
the compose command line, it could be very tedious to write them every time
such as `--env-file`, `--project-name`, `--file`, etc.

So, in this case we could use something like a script or `make`, right?

Yes, and just for one project it would be good enough. But, if you maintain
or collaborate a bunch of projects, it would be like a boiler plate.

Additionally, if you are maintaining some extra scripts in order to improve
your containers stack, these scripts would be like a boilerplate as well.

So, the idea of this project is to organize your stack of containers,
gathering some useful scripts and keeping this information centralized in a
configuration file. So the command line would be very simple.


* Software License: BSD 3 Clause
* Documentation: https://osl-incubator.github.io/sugar

## How to Install

```bash
$ pip install containers-sugar
```

## Features

The commands from docker-compose available are:

* build
* config
* create
* down
* events
* exec
* images
* kill
* logs
* pause
* port
* ps
* pull
* push
* restart
* rm
* run
* start
* stop
* top
* unpause
* up
* version

These commands are available in the main profile/plugin, so
you don't need to specify any extra parameter to access them.

For extra commands, we are gathering them into a profile/plugin called
`ext`, so you can access them using something like: `sugar ext restart`.

The current available **ext** commands are:

* start -> alias for `up`
* restart -> runs `stop` and `up`


## How to use it

First you need to place the config file `.sugar.yaml` in the root
of your project. This is an example of a configuration file:

```yaml
version: 1.0
compose-app: docker compose
default:
  group: {{ env.ENV }}
groups:
  group1:
    project-name: project1
    compose-path:
      - containers/tests/group1/compose.yaml
    env-file: .env
    services:
      default: service1,service3
      available:
        - name: service1
        - name: service2
        - name: service3
  group2:
    project-name: null
    compose-path: containers/tests/group2/compose.yaml
    env-file: .env
    services:
      available:
        - name: service1
        - name: service3
```

Some examples of how to use it:

* build the defaults services (service1,service3) for group1:
  `sugar build --group group1`

* build the all services (there is no default service defined) for group2:
  `sugar build --group group2`

* build all services (ignore default) for group1:
  `sugar build --group group1 --all`

* start the default services for group1:
  `sugar ext start --group group1`

* restart all services (ignore defaults) for group1:
  `sugar ext restart --group group1 --all`

* restart service1 and service2 for group1:
  `sugar ext restart --group group1 --services service1,service2`


**NOTE**: If you use: ```default: group: {{ env.ENV }}```, you don't need to
give `--group <GROUP_NAME>`, except if you want a different group than the
default one.

