Welcome to Utils2devops documentation!

Build status Test coverage status Requirements Status pypi download python supported licence PyPi version Maintainability Documentation status PyPi wheel

Contents

Create your local cluster of docker-machine

This script will create x nodes docker-machine named node-1 to name-n, the purpose of this script is for local debug or tests, you can after access to these by:

docker-machine ssh node-n

required:

install Docker-machine:
https://docs.docker.com/machine/install-machine/

run:

./utils2devops/bin/docker-machine-cluster.sh
started...
usage:
  docker-machine-cluster [-h | --help] To get this help
  docker-machine-cluster [-c | --create x]
      Where x is the number of manager node to create/add in the swarm.
  docker-machine-cluster [-d | --destroy x]
      Where x is the number of manager node to create/add in the swarm.

Create a cluster of 4 node:

./utils2devops/bin/docker-machine-cluster.sh -c 5

Destroy it:

./utils2devops/bin/docker-machine-cluster.sh -d 5

Create a Docker Swarm on nodes docker-machine

This script will create a swarm on nodes docker-machine named node-1 to name-n, the purpose of this script is for local debug or tests, you can after access to these by:

docker-machine ssh node-n

required:

install Docker Swarm:
https://docs.docker.com/engine/swarm/

run:

./utils2devops/bin/swarm.sh
started...
usage:
  swarm [-h | --help] To get this help
      If the docker-swarm don't exist it will be created
  swarm -c|--create [-m|--count_manager x -w|--count_worker y] To create node to a swarm
      Where x is the number of manager node to create/add in the swarm.
      Where y is the number of worker node to create/add in the swarm.
  swarm -r|--remove x] To destroy a swarm
      Where x is the number of node in the swarm..

Create a docker swarm of 3 manager and 2 worker:

./utils2devops/bin/swarm.sh -c -m 3 -w 2

Destroy it:

./utils2devops/bin/swarm.sh -r 5

Testing

You can run the tests by

tox

or by

python setup.py test

or by

pytest

If you Use Aws

Create an AWS account (it’s free):

https://aws.amazon.com/

Aws secret required ???:: TODO WORK IN PROGESS

APPNAME_USERNAME_PASSWD => a client API password SECRET_KEY => the secret key

Aws Env required:

AWS_REGION_NAME => default="eu-east-1"
AWS_APPNAME_SECRET_NAME =>The name of the secret bucket

TODO the documentation of existing functionnalities TODO implementation WORK IN PROGESS

To use lxd_module

require:

sudo apt-get install python-pylxd lxd

delete object except container:

sudo python3 utils2devops/lxd_lxc/lxc_delete.py

usage: lxc_delete.py [-h] [-v] [-e ENDPOINT] [-c CERT] [-sure SURE]
                     [-deleteAllImages] [-deleteAllNetworks]
                     [-deleteAllProfiles] [-deleteAllStorages]

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -deleteAllImages      DELETE all lxc image
  -deleteAllNetworks    DELETE all lxc network
  -deleteAllProfiles    DELETE all lxc profile
  -deleteAllStorages    DELETE all lxc storage

  -e ENDPOINT, --endpoint ENDPOINT
                        the endpoint if not local
  -c CERT, --cert CERT  tuple of (cert, key) like ('/path/to/client.crt',
                        '/path/to/client.key')
  -sure SURE            Required for all deleteAll* with value YES_I_AM_SURE

container management:

sudo python3 utils2devops/lxd_lxc/lxc_container.py

usage: lxc_container.py [-h] [-v] [-e ENDPOINT] [-c CERT] [-sure SURE]
                        (-statusAll | -deleteAll | -startAll | -stopAll)
                        [-controller_uuid CONTROLLER_UUID]
                        [-model_uuid MODEL_UUID]
lxc_container.py: error: one of the arguments -statusAll -deleteAll -startAll -stopAll is required

TODO the documentation of existing functionnalities TODO implementation WORK IN PROGESS

Releases Notes

  • 0.1.3: add deploy local stack swarm
    add sub module docker-elk and swarmprom
  • 0.1.2: refactor tests
  • 0.1.1: add single_sourcing_package_version
    add documentation (first draft)
  • 0.1.0: Initial publication version

Indices and tables

Infrastructure As Code

Utils2devops is a package that contain python 3 functions and class that can be helpfull in the all working day. Any help for develop, test, validate, documentation are welcome!

TAKE CARE THIS LIBRARY AND THE TOOLS will do what ever you ask to do, even for destroy image, network, container, …

One of my main principles is not to reinvent the wheel, and if someone has already created a function, a class and sharing it, and if I like its implementation, I will use this function / class and say a big thank you to this person in all respect of the Copyright and the Licence. This library is in development and the folder structure will change certainly

We will use

- `AWS Tools`_
- `GPC tools`_
- `Docker`_
- `Traefik`_
- `Portainer`_
- `Terraform`_
- ...

To develop or improve this library you can run it with the env DEBUG_OR_IMPROVE

Something disturb you in the code? Don’t hesitate to open a an issue and contribute.

WORK IN PROGESS… Online documentation is here on Readthedoc Online source code available on Github