SwarmManagement


NameSwarmManagement JSON
Version 1.1.78 PyPI version JSON
download
home_pagehttps://github.com/hansehe/SwarmManagement
SummaryA library for managing Docker Swarm.
upload_time2024-08-02 16:20:20
maintainerNone
docs_urlNone
authorHans Erik Heggem
requires_pythonNone
licenseNone
keywords docker swarm management
VCS
bugtrack_url
requirements DockerBuildSystem
Travis-CI
coveralls test coverage No coveralls.
            # 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:
        <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>
    ```

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 `<stack_name>`
        - -> swm -stack -remove `<stack_name>`
        - 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 `<network_name>`
        - -> swm -network -remove `<network_name>`
        - 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 `<config_name>`
        - -> swm -config -remove `<config_name>`
        - 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 `<secret_name>`
        - -> swm -secret -remove `<secret_name>`
        - 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 `<volume_name>`
        - -> swm -volume -remove `<volume_name>`
        - 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 -help

Please 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 <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: false`
* `driver: overlay`
* `attachable: true`
* `options:`
    - `<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: local`
* `driverOptions:`
    - `<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:
    - 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


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansehe/SwarmManagement",
    "name": "SwarmManagement",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Docker Swarm Management",
    "author": "Hans Erik Heggem",
    "author_email": "hans.erik.heggem@gmail.com",
    "download_url": null,
    "platform": null,
    "description": "# Docker Swarm Management\n\n[![PyPI version](https://badge.fury.io/py/SwarmManagement.svg)](https://badge.fury.io/py/SwarmManagement)\n[![Build Status](https://travis-ci.com/hansehe/SwarmManagement.svg?branch=master)](https://travis-ci.com/hansehe/SwarmManagement)\n[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)\n\nSwarm Management is a python application, installed with pip.\nThe 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.\n\n## Install Or Upgrade\n- pip install --upgrade SwarmManagement\n\n## Verify Installation\n- `swm -help`\n\n## Example\n1. Create a `swarm.management.yml` file describing all properties of the swarm.\n    - The `swarm.management.yml` file contains following properties:\n    ```yaml\n    stacks:\n        <stack_name>: <compose_file>\n    networks:\n        <network_name>: \n            encrypted: false\n            driver: overlay\n            attachable: true\n            options:\n              - --ipv6\n    configs:\n        <config_name>: <config_file>\n    secrets:\n        <secret_name>: <secret_file>\n    volumes:\n        <volume_name>:\n            driver: local\n            driverOptions:\n              - type=tmpfs\n              - device=tmpfs\n              - o=size=100m,uid=1000\n    env_files:\n        - <environment_file>\n    ```\n\n2. Manage Swarm:\n    - Start Swarm with:\n        - -> swm -start\n    - Stop Swarm with:\n        - -> swm -stop\n    - Restart Swarm with:\n        - -> swm -restart\n    - Wait for all services to start in Swarm with:\n        - -> swm -wait\n    - Deploy/Update or Remove a single stack:\n        - -> swm -stack -deploy `<stack_name>`\n        - -> swm -stack -remove `<stack_name>`\n        - Or deploy/remove all stacks with the `all` attribute:\n            - -> swm -stack -deploy all\n            - -> swm -stack -remove all\n    - Create or Remove a single network:\n        - -> swm -network -create `<network_name>`\n        - -> swm -network -remove `<network_name>`\n        - Or create/remove all networks with the `all` attribute:\n            - -> swm -network -create all\n            - -> swm -network -remove all\n    - Create or Remove a single config:\n        - -> swm -config -create `<config_name>`\n        - -> swm -config -remove `<config_name>`\n        - Or create/remove all configs with the `all` attribute:\n            - -> swm -stack -create all\n            - -> swm -stack -remove all\n    - Create or Remove a single secret:\n        - -> swm -secret -create `<secret_name>`\n        - -> swm -secret -remove `<secret_name>`\n        - Or create/remove all secrets with the `all` attribute:\n            - -> swm -secret -create all\n            - -> swm -secret -remove all\n    - Create or Remove a single volume:\n        - -> swm -volume -create `<volume_name>`\n        - -> swm -volume -remove `<volume_name>`\n        - Or create/remove all volumes with the `all` attribute:\n            - -> swm -volume -create all\n            - -> swm -volume -remove all\n    - SwarmManagement uses the `swarm.management.yml` file by default to configure the swarm.\n        - Specify a single or multiple *.yml files to use for configuring the swarm using the `-f` attribute:\n            - -> swm -start -f swarm-stacks.yml -f swarm-networks.yml\n    - Additional info is found by asking SwarmManagement:\n        - -> swm -help\n        - -> swm -stack -help\n        - -> swm -network -help\n        - -> swm -config -help\n        - -> swm -secret -help\n        - -> swm -volume -help\n\nPlease have a look at an example of use here:\n- https://github.com/hansehe/SwarmManagement/tree/master/example\n\n## Section Features\n\n## Start/Stop or Restart Swarm\nDeploy the swarm with `swm -start`, and stop the swarm with `swm -stop`.\nRestart 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.\nWait 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.\n\n### Stacks\nThe `stacks` section lists all stacks to be deployed as: `<stack_name>: <compose_file>`\n\n### Networks\nThe `networks` section lists all networks to be created as, and each network is created with the following default properties:\n* `encrypted: false`\n* `driver: overlay`\n* `attachable: true`\n* `options:`\n    - `<list_of_network_options>`\n\n### Configs\nThe `configs` section lists all configs to be created as: `<config_name>: <config_file>`\n\n### Secrets\nThe `secrets` section lists all secrets to be created as: `<secret_name>: <secret_file>`\n\n### Volumes\nThe `volumes` section lists all volumes to be created as, and each volumes is created with the following default properties:\n* `driver: local`\n* `driverOptions:`\n    - `<list_of_driver_options>`\n\n### Environment variables\nThe `env_files` section lists all environmnet (`.env`) files with environment variables to expose.\nBy convention, a present `.env` file will automatically be loaded.\n\n## Prerequisites\n- Docker:\n    - https://www.docker.com/get-docker\n- Install Dependencies:\n    - pip install -r requirements.txt\n\n## Additional Info\n- The pip package may be located at:\n    - https://pypi.org/project/SwarmManagement\n\n## Publish New Version.\n1. Configure setup.py with new version.\n2. Install build tools: `pip install twine wheel`\n3. Build: python setup.py bdist_wheel\n4. Check: twine check dist/*\n5. Publish: twine upload dist/*\n\n## Run Unit Tests\n- python -m unittest discover -p *Test*.py\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A library for managing Docker Swarm.",
    "version": "1.1.78",
    "project_urls": {
        "Funding": "https://donate.pypi.org",
        "Homepage": "https://github.com/hansehe/SwarmManagement",
        "Say Thanks!": "http://saythanks.io/to/example",
        "Source": "https://github.com/hansehe/SwarmManagement"
    },
    "split_keywords": [
        "docker",
        "swarm",
        "management"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ef9272269ed882e833aa9b9928786694f2c32e9caf5c10292a4c9e6e5600737",
                "md5": "489f32908b08c2dd2aa8be8e942d6fd0",
                "sha256": "59fbfb964f63a8007e6b9c131320c02f7c64c703315f6d60b595a92dcf53393e"
            },
            "downloads": -1,
            "filename": "SwarmManagement-1.1.78-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "489f32908b08c2dd2aa8be8e942d6fd0",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 12569,
            "upload_time": "2024-08-02T16:20:20",
            "upload_time_iso_8601": "2024-08-02T16:20:20.056598Z",
            "url": "https://files.pythonhosted.org/packages/5e/f9/272269ed882e833aa9b9928786694f2c32e9caf5c10292a4c9e6e5600737/SwarmManagement-1.1.78-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-02 16:20:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansehe",
    "github_project": "SwarmManagement",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "DockerBuildSystem",
            "specs": [
                [
                    ">=",
                    "1.1.61"
                ]
            ]
        }
    ],
    "lcname": "swarmmanagement"
}
        
Elapsed time: 0.26533s