Docker Swarm Management
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
-
Create a
swarm.management.ymlfile describing all properties of the swarm.- The
swarm.management.ymlfile contains following properties:
stacks: <stack_name>: <compose_file> networks: <network_name>: encrypted: false driver: overlay attachable: true options: - --ipv6 configs: <config_name>: <config_file> secrets: <secret_name>: <secret_file> volumes: <volume_name>: driver: local driverOptions: - type=tmpfs - device=tmpfs - o=size=100m,uid=1000 env_files: - <environment_file>
- The
-
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
<stack_name> - -> swm -stack -remove
<stack_name> - Or deploy/remove all stacks with the
allattribute:- -> swm -stack -deploy all
- -> swm -stack -remove all
- -> swm -stack -deploy
- Create or Remove a single network:
- -> swm -network -create
<network_name> - -> swm -network -remove
<network_name> - Or create/remove all networks with the
allattribute:- -> swm -network -create all
- -> swm -network -remove all
- -> swm -network -create
- Create or Remove a single config:
- -> swm -config -create
<config_name> - -> swm -config -remove
<config_name> - Or create/remove all configs with the
allattribute:- -> swm -stack -create all
- -> swm -stack -remove all
- -> swm -config -create
- Create or Remove a single secret:
- -> swm -secret -create
<secret_name> - -> swm -secret -remove
<secret_name> - Or create/remove all secrets with the
allattribute:- -> swm -secret -create all
- -> swm -secret -remove all
- -> swm -secret -create
- Create or Remove a single volume:
- -> swm -volume -create
<volume_name> - -> swm -volume -remove
<volume_name> - Or create/remove all volumes with the
allattribute:- -> swm -volume -create all
- -> swm -volume -remove all
- -> swm -volume -create
- SwarmManagement uses the
swarm.management.ymlfile by default to configure the swarm.- Specify a single or multiple *.yml files to use for configuring the swarm using the
-fattribute:- -> swm -start -f swarm-stacks.yml -f swarm-networks.yml
- Specify a single or multiple *.yml files to use for configuring the swarm using the
- Additional info is found by asking SwarmManagement:
- -> swm -help
- -> swm -stack -help
- -> swm -network -help
- -> swm -config -help
- -> swm -secret -help
- -> swm -volume -help
- Start Swarm with:
Please have a look at an example of use here:
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 <restart_delay_in_seconds>. The <restart_delay_in_seconds> argument is optional, and defaults to 10 seconds if not given.
Wait for all services in the swarm to start with swm -wait <timeout_in_seconds> <service_to_target>. The <timeout_in_seconds> argument is optional, and defaults to 120 seconds if not given. The <service_to_target> argument is optional, and is a list of specific service names to target.
Stacks
The stacks section lists all stacks to be deployed as: <stack_name>: <compose_file>
Networks
The networks section lists all networks to be created as, and each network is created with the following default properties:
encrypted: falsedriver: overlayattachable: trueoptions:<list_of_network_options>
Configs
The configs section lists all configs to be created as: <config_name>: <config_file>
Secrets
The secrets section lists all secrets to be created as: <secret_name>: <secret_file>
Volumes
The volumes section lists all volumes to be created as, and each volumes is created with the following default properties:
driver: localdriverOptions:<list_of_driver_options>
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:
- Install Dependencies:
- pip install -r requirements.txt
Additional Info
- The pip package may be located at:
Publish New Version.
- Configure setup.py with new version.
- Install build tools:
pip install twine wheel - Build: python setup.py bdist_wheel
- Check: twine check dist/*
- Publish: twine upload dist/*
Run Unit Tests
- python -m unittest discover -p Test.py
Metadata
Release files for swarmmanagement 1.1.82
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmmanagement-1.1.82-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Release files / swarmmanagement-1.1.82-py2.py3-none-any.whl
| Download URL | swarmmanagement-1.1.82-py2.py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
5161f1b542321ef12a51b16ba9a160dade62154b98fb143c43d6c8386533a8f8
|
|
BLAKE2b-256 checksum How to use checksums |
c91cf40b1731c6205e4a8f9795fd8e3584b25917c02bbc614dcf55ecede6320d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.17
|
Security for swarmmanagement 1.1.82
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.