Skip to main content

A simple python CLI for Play With Docker

Project description

A simple python CLI for your on-premise instance of Play With Docker

Create a 5 node Cluster Swarm in 5 seconds!

Purpose

This is a CLI that allows you to create, connecte to, view, and delete instances of Play-With-Docker.

The Goal of this project is to allow you or your users to quickly create ready to uses clusters swarm, and uses it without leaving your terminal.

Installation

The easiest way is to install from Pypi library:

$ pip install pwdc

Usage

You can just uses the following commands to create and use your cluster:

$ pwdc init --pwd-url=http://<your-pwd-server>

Initialise the pwdc configuration file in ~/.pwdc. You need to update the ~/.pwdc value with the url of your PWD instance if not given the –pwd-url parameter:

$ pwdc create

This will uses the PWD instance from your ~/.pwdc file, then :

  • create a PWD session

  • create 5 nodes

  • init a swarm with a master on node1

  • join the swarm from the node2 to node5

  • provides informations on your cluster

The Cluster is ready to uses, just point your docker CLI on the new Swarm:

$ eval $(pwdc env)
$ docker info

>From then, you can manipulaite the swarm cluster with your docker or docker-compose CLI:

$ pwdc info

Show you the informations about your PWD session.

You can have multiple PWD session, this is manage with the –session_file parameter, which locally store your PWD session informations.

After a while, the session will be aumatically deleted, but you can also delete it manually when you are done with your session:

$ pwdc delete
$ eval $(pwdc env -u)

the last eval if to reset your docker client config

Contribution

If you’ve cloned this project, and want to install the library (and all development dependencies), the command you’ll want to run is:

$ pip install -e .[test]

If you’d like to run all tests for this project (assuming you’ve written some), you would run the following command:

$ python setup.py test

This will trigger py.test, along with its popular coverage plugin.

Lastly, if you’d like to cut a new release of this CLI tool, and publish it to the Python Package Index (PyPI), you can do so by running:

$ python setup.py sdist bdist_wheel
$ twine upload dist/*

This will build both a source tarball of your CLI tool, as well as a newer wheel build (and this will, by default, run on all platforms).

The twine upload command (which requires you to install the twine tool) will then securely upload your new package to PyPI so everyone in the world can use it!

Crédit

This Works is based on the [skele-cli](https://github.com/rdegges/skele-cli) python cli project skeleton and uses the powerfull opensource project [Play-With-Docker](https://github.com/franela/play-with-docker).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pwdc-0.0.3.tar.gz (8.8 kB view hashes)

Uploaded Source

Built Distribution

pwdc-0.0.3-py2.py3-none-any.whl (14.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page