<commit_before># docker-swarm-api

Ruby compatible API for managing Docker Swarm clusters.

MIT License

Must use Docker API Version of 1.24 or above.

This project leverages swipely/docker-api (https://github.com/swipely/docker-api), and adds Docker Swarm capability.

Warning: cannot create overlay network in Docker Engine versions less than 1.13 (which is still categoriezed as Dev, not as stable).  

Sample Usage
------------
```ruby
 # Create a Swarm cluster
master_connection = Docker::Swarm::Connection.new('http://10.20.30.1:2375')

 # Manager node intializes swarm
swarm_init_options = {
"ListenAddr" => "0.0.0.0:2377",
}
swarm = Docker::Swarm::Swarm.init(swarm_init_options, master_connection)

expect(swarm).to_not be nil

nodes = Docker::Swarm::Node.all({}, master_connection)
expect(nodes.length).to eq 1

 # Worker joins swarm
worker_connection = Docker::Swarm::Connection.new('http://10.20.30.2:2375')
swarm.join(worker_ip, worker_connection)

 # Gather all nodes of swarm
nodes = swarm.nodes

 # Create a network which connect services
network = swarm.create_network(network_name)
<commit_msg>Fix up of readme<commit_after># docker-swarm-api

Ruby compatible API for managing Docker Swarm clusters.

MIT License

Must use Docker API Version of 1.24 or above.

This project leverages swipely/docker-api (https://github.com/swipely/docker-api), and adds Docker Swarm capability.

Warning: cannot create overlay network in Docker Engine versions less than 1.13 (which is still categoriezed as Dev, not as stable).  

Sample Usage
------------
```ruby
 # Make a connection to the Swarm manager's API.  (Assumes port 2375 exposed for API)
master_connection = Docker::Swarm::Connection.new('http://10.20.30.1:2375')

 # Manager node intializes swarm
swarm_init_options = { "ListenAddr" => "0.0.0.0:2377" }
swarm = Docker::Swarm::Swarm.init(swarm_init_options, master_connection)

expect(swarm).to_not be nil

nodes = Docker::Swarm::Node.all({}, master_connection)
expect(nodes.length).to eq 1

 # Worker joins swarm
worker_connection = Docker::Swarm::Connection.new('http://10.20.30.2:2375')
swarm.join(worker_ip, worker_connection)

 # Gather all nodes of swarm
nodes = swarm.nodes

 # Create a network which connect services
network = swarm.create_network(network_name)

{'fraction_non_alphanumeric': 0.11777583187390543, 'fraction_numerical': 0.03415061295971979, 'mean_word_length': 4.829081632653061, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '691869', 'n_tokens_mistral': 792, 'n_tokens_neox': 699, 'n_words': 219}