Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hansehe/SwarmManagement
Swarm Management is a python application, installed with pip. The application makes it easy to manage a Docker Swarm by configuring a single *.yml file describing which stacks to deploy, and which networks, configs or secrets to create.
https://github.com/hansehe/SwarmManagement
containers deployment docker docker-swarm
Last synced: 2 months ago
JSON representation
Swarm Management is a python application, installed with pip. The application makes it easy to manage a Docker Swarm by configuring a single *.yml file describing which stacks to deploy, and which networks, configs or secrets to create.
- Host: GitHub
- URL: https://github.com/hansehe/SwarmManagement
- Owner: hansehe
- License: mit
- Fork: true (DIPSAS/SwarmManagement)
- Created: 2021-09-22T23:41:51.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-02T16:20:50.000Z (5 months ago)
- Last Synced: 2024-10-02T23:18:27.352Z (3 months ago)
- Topics: containers, deployment, docker, docker-swarm
- Language: Python
- Homepage:
- Size: 68.4 KB
- Stars: 14
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-docker - SwarmManagement - Swarm Management is a python application, installed with pip. The application makes it easy to manage a Docker Swarm by configuring a single yaml file describing which stacks to deploy, and which networks, configs or secrets to create. (Container Operations / Deployment and Infrastructure)
README
# Docker Swarm Management
[![PyPI version](https://badge.fury.io/py/SwarmManagement.svg)](https://badge.fury.io/py/SwarmManagement)
[![Build Status](https://travis-ci.com/hansehe/SwarmManagement.svg?branch=master)](https://travis-ci.com/hansehe/SwarmManagement)
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)Swarm Management is a python application, installed with pip.
The application makes it easy to manage a Docker Swarm by configuring a single *.yml file describing which stacks to deploy, and which networks, configs or secrets to create.## Install Or Upgrade
- pip install --upgrade SwarmManagement## Verify Installation
- `swm -help`## Example
1. Create a `swarm.management.yml` file describing all properties of the swarm.
- The `swarm.management.yml` file contains following properties:
```yaml
stacks:
:
networks:
:
encrypted: false
driver: overlay
attachable: true
options:
- --ipv6
configs:
:
secrets:
:
volumes:
:
driver: local
driverOptions:
- type=tmpfs
- device=tmpfs
- o=size=100m,uid=1000
env_files:
-
```2. Manage Swarm:
- Start Swarm with:
- -> swm -start
- Stop Swarm with:
- -> swm -stop
- Restart Swarm with:
- -> swm -restart
- Wait for all services to start in Swarm with:
- -> swm -wait
- Deploy/Update or Remove a single stack:
- -> swm -stack -deploy ``
- -> swm -stack -remove ``
- Or deploy/remove all stacks with the `all` attribute:
- -> swm -stack -deploy all
- -> swm -stack -remove all
- Create or Remove a single network:
- -> swm -network -create ``
- -> swm -network -remove ``
- Or create/remove all networks with the `all` attribute:
- -> swm -network -create all
- -> swm -network -remove all
- Create or Remove a single config:
- -> swm -config -create ``
- -> swm -config -remove ``
- Or create/remove all configs with the `all` attribute:
- -> swm -stack -create all
- -> swm -stack -remove all
- Create or Remove a single secret:
- -> swm -secret -create ``
- -> swm -secret -remove ``
- Or create/remove all secrets with the `all` attribute:
- -> swm -secret -create all
- -> swm -secret -remove all
- Create or Remove a single volume:
- -> swm -volume -create ``
- -> swm -volume -remove ``
- Or create/remove all volumes with the `all` attribute:
- -> swm -volume -create all
- -> swm -volume -remove all
- SwarmManagement uses the `swarm.management.yml` file by default to configure the swarm.
- Specify a single or multiple *.yml files to use for configuring the swarm using the `-f` attribute:
- -> swm -start -f swarm-stacks.yml -f swarm-networks.yml
- Additional info is found by asking SwarmManagement:
- -> swm -help
- -> swm -stack -help
- -> swm -network -help
- -> swm -config -help
- -> swm -secret -help
- -> swm -volume -helpPlease have a look at an example of use here:
- https://github.com/hansehe/SwarmManagement/tree/master/example## Section Features
## Start/Stop or Restart Swarm
Deploy the swarm with `swm -start`, and stop the swarm with `swm -stop`.
Restart the swarm with `swm -restart `. The `` argument is optional, and defaults to 10 seconds if not given.
Wait for all services in the swarm to start with `swm -wait `. The `` argument is optional, and defaults to 120 seconds if not given. The `` argument is optional, and is a list of specific service names to target.### Stacks
The `stacks` section lists all stacks to be deployed as: `: `### Networks
The `networks` section lists all networks to be created as, and each network is created with the following default properties:
* `encrypted: false`
* `driver: overlay`
* `attachable: true`
* `options:`
- ``### Configs
The `configs` section lists all configs to be created as: `: `### Secrets
The `secrets` section lists all secrets to be created as: `: `### Volumes
The `volumes` section lists all volumes to be created as, and each volumes is created with the following default properties:
* `driver: local`
* `driverOptions:`
- ``### Environment variables
The `env_files` section lists all environmnet (`.env`) files with environment variables to expose.
By convention, a present `.env` file will automatically be loaded.## Prerequisites
- Docker:
- https://www.docker.com/get-docker
- Install Dependencies:
- pip install -r requirements.txt## Additional Info
- The pip package may be located at:
- https://pypi.org/project/SwarmManagement## Publish New Version.
1. Configure setup.py with new version.
2. Install build tools: `pip install twine wheel`
3. Build: python setup.py bdist_wheel
4. Check: twine check dist/*
5. Publish: twine upload dist/*## Run Unit Tests
- python -m unittest discover -p *Test*.py