https://github.com/131/docker-dspp
A docker stack compiler
https://github.com/131/docker-dspp
Last synced: about 1 year ago
JSON representation
A docker stack compiler
- Host: GitHub
- URL: https://github.com/131/docker-dspp
- Owner: 131
- Created: 2021-04-28T14:57:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-12T16:51:46.000Z (almost 2 years ago)
- Last Synced: 2024-11-05T16:53:10.036Z (over 1 year ago)
- Language: JavaScript
- Size: 250 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[dspp](https://github.com/131/dspp) is a **d**ocker **s**tack **p**re**p**rocessor
[](https://github.com/131/docker-dspp/actions/workflows/test.yml)
[](https://coveralls.io/github/131/docker-dspp?branch=master)
[](https://www.npmjs.com/package/dspp)
[](http://opensource.org/licenses/MIT)
# Motivation
Complex docker stack will be composed out of dozen/hundreds of microservices, volumes, and config.
Wrapping all of them in a single compose file is tedious, and lacks flexibility.
dspp allows you to split your compose file, define YAML macros/anchor, use services as metadata references, inline configuration contents, use directories as provided.
# Features
* Write your Docker stack as individual YAML service files, use dspp to compile it
* Deploy an entire stack or filtered by service name
* Availability of YAML macros
* Each YAML file is parsed as a JavaScript literal: they can have embedded JS code
* Configs can be written as files, directories, bundles, embedded YAML converted to JSON on the fly, or other formats
# Usage
`production.yml`
```yaml
version: "3.3"
name: my-stack
services:
service1:
image: httpd:2.4
```
On the entire stack:
```bash
# interactive session
dspp production.yml
# then use "plan" and "apply" command in the interactive session
# alternatively
dspp production.yml --ir://raw --ir://run=parse --write | docker stack deploy --compose-file - my-stack
```
On a specific service in the stack:
```bash
# Use
dspp production.yml service1
# to work only on the specific "service1" service
```
See all available commands in [Commands docs](./docs/CLI_COMMANDS.md).
# Installation instructions
```bash
# requires git, most & colordiff
apt-get install git most colordiff
npx dspp my-stack.yml
```
# The dspp stack file: syntax and examples
The [dspp stack file](./docs/SYNTAX_STACK_FILE.md) is classic compose file that can include / reference other ones, to compile all them in a stack.
To add [configs](./docs/SYNTAX_CONFIGS.md) and other native Compose Spec elements to your services, follow the same rules as the services. Split them into individual files, reference them in your dspp stack file, and redeploy.
# Advanced usage
[Interpolating JavaScript variables in plain YAML files](./docs/ADVANCED_INTERPOLATE.md)
[Reusable snippets with YAML macros](./docs/ADVANCED_MACROS.md)
[Command-line flags](./docs/CLI_FLAGS.md)
[YAML object merging: overrides, or how to set up qa/staging/local alternate stacks](./docs/ADVANCED_MERGING.md)
# Credits
* [131](https://github.com/131)