Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ endif
$(call build_binary,infrakit,github.com/docker/infrakit/cmd/cli)
$(call build_binary,infrakit-manager,github.com/docker/infrakit/cmd/manager)
$(call build_binary,infrakit-group-default,github.com/docker/infrakit/cmd/group)
$(call build_binary,infrakit-flavor-combo,github.com/docker/infrakit/pkg/example/flavor/combo)
$(call build_binary,infrakit-flavor-swarm,github.com/docker/infrakit/pkg/example/flavor/swarm)
$(call build_binary,infrakit-flavor-vanilla,github.com/docker/infrakit/pkg/example/flavor/vanilla)
$(call build_binary,infrakit-flavor-zookeeper,github.com/docker/infrakit/pkg/example/flavor/zookeeper)
$(call build_binary,infrakit-instance-file,github.com/docker/infrakit/pkg/example/instance/file)
$(call build_binary,infrakit-instance-terraform,github.com/docker/infrakit/pkg/example/instance/terraform)
$(call build_binary,infrakit-instance-vagrant,github.com/docker/infrakit/pkg/example/instance/vagrant)
$(call build_binary,infrakit-flavor-combo,github.com/docker/infrakit/examples/flavor/combo)
$(call build_binary,infrakit-flavor-swarm,github.com/docker/infrakit/examples/flavor/swarm)
$(call build_binary,infrakit-flavor-vanilla,github.com/docker/infrakit/examples/flavor/vanilla)
$(call build_binary,infrakit-flavor-zookeeper,github.com/docker/infrakit/examples/flavor/zookeeper)
$(call build_binary,infrakit-instance-file,github.com/docker/infrakit/examples/instance/file)
$(call build_binary,infrakit-instance-terraform,github.com/docker/infrakit/examples/instance/terraform)
$(call build_binary,infrakit-instance-vagrant,github.com/docker/infrakit/examples/instance/vagrant)

install:
@echo "+ $@"
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ Executables will be placed in the `./build` directory.
This will produce binaries for tools and several reference Plugin implementations:
+ [`infrakit`](cmd/cli/README.md): a command line interface to interact with plugins
+ [`infrakit-group-default`](cmd/group/README.md): the default [Group plugin](./pkg/spi/group)
+ [`infrakit-instance-file`](pkg/example/instance/file): an Instance plugin using dummy files to represent instances
+ [`infrakit-instance-terraform`](pkg/example/instance/terraform):
+ [`infrakit-instance-file`](examples/instance/file): an Instance plugin using dummy files to represent instances
+ [`infrakit-instance-terraform`](examples/instance/terraform):
an Instance plugin integrating [Terraform](https://www.terraform.io)
+ [`infrakit-instance-vagrant`](pkg/example/instance/vagrant):
+ [`infrakit-instance-vagrant`](examples/instance/vagrant):
an Instance plugin using [Vagrant](https://www.vagrantup.com/)
+ [`infrakit-flavor-vanilla`](pkg/example/flavor/vanilla):
+ [`infrakit-flavor-vanilla`](examples/flavor/vanilla):
a Flavor plugin for plain vanilla set up with user data and labels
+ [`infrakit-flavor-zookeeper`](pkg/example/flavor/zookeeper):
+ [`infrakit-flavor-zookeeper`](examples/flavor/zookeeper):
a Flavor plugin for [Apache ZooKeeper](https://zookeeper.apache.org/) ensemble members
+ [`infrakit-flavor-swarm`](pkg/example/flavor/swarm):
+ [`infrakit-flavor-swarm`](examples/flavor/swarm):
a Flavor plugin for Docker in [Swarm mode](https://docs.docker.com/engine/swarm/).

All provided binaries have a `help` sub-command to get usage and a `version` sub-command to identify the build revision.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ INFO[0000] Listening at: ~/.infrakit/plugins/flavor-combo

Using the [example](example.json) configuration, commit a group:
```shell
$ build/infrakit group commit example/flavor/combo/example.json
$ build/infrakit group commit examples/flavor/combo/example.json
Committed combo
```

Expand Down Expand Up @@ -91,4 +91,3 @@ $ cat tutorial/instance-4039631736808433938
}
}
```

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fetched from. In this case, we are pointing at the yet-to-be-created Swarm mana
Next, create the [manager node](swarm-vagrant-manager.json) and initialize the cluster:

```shell
$ build/infrakit group commit example/flavor/swarm/swarm-vagrant-manager.json
$ build/infrakit group commit examples/flavor/swarm/swarm-vagrant-manager.json
```

Once the first node has been successfully created, confirm that the Swarm was initialized:
Expand All @@ -77,7 +77,7 @@ exid5ftbv15pgqkfzastnpw9n * infrakit Ready Active Leader

Now the [worker group](swarm-vagrant-workers.json) may be created:
```shell
$ build/infrakit group commit example/flavor/swarm/swarm-vagrant-workers.json
$ build/infrakit group commit examples/flavor/swarm/swarm-vagrant-workers.json
```

Once completed, the cluster contains two nodes:
Expand Down
56 changes: 56 additions & 0 deletions examples/flavor/swarm/e2e-plugins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[
{
"Plugin" : "group-default",
"Launch" : {
"Exec" : "os",
"Properties": {
"Cmd" : "infrakit-group-default --poll-interval 500ms --name group-stateless --log 5 > {{env "LOG_DIR"}}/group-default-{{unixtime}}.log 2>&1 &",
"SamePgID" : true
}
}
}
,
{
"Plugin" : "instance-file",
"Launch" : {
"Exec" : "os",
"Properties" : {
"Cmd" : "infrakit-instance-file --dir {{env "TUTORIAL_DIR"}} --log 5 > {{env "LOG_DIR"}}/instance-file-{{unixtime}}.log 2>&1",
"SamePgID" : true
}
}
}
,
{
"Plugin" : "instance-vagrant",
"Launch" : {
"Exec" : "os",
"Properties" : {
"Cmd" : "infrakit-instance-vagrant --log 5 > {{env "LOG_DIR"}}/instance-vagrant-{{unixtime}}.log 2>&1",
"SamePgID" : true
}
}
}
,
{
"Plugin" : "flavor-vanilla",
"Launch" : {
"Exec" : "os",
"Properties" : {
"Cmd" : "infrakit-flavor-vanilla --log 5 > {{env "LOG_DIR"}}/flavor-vanilla-{{unixtime}}.log 2>&1",
"SamePgID" : true
}
}
}
,
{
"Plugin" : "flavor-swarm",
"Launch" : {
"Exec" : "os",
"Properties" : {
"Cmd" : "infrakit-flavor-swarm --host {{env "SWARM_MANAGER"}} --log 5 > {{env "LOG_DIR"}}/flavor-swarm-{{unixtime}}.log 2>&1",
"SamePgID" : true
}
}
}
]
13 changes: 9 additions & 4 deletions scripts/e2e-swarm.sh → examples/flavor/swarm/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -o errexit
set -o nounset

HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$HERE/.."
cd "$HERE/../../.."

export PATH=$PWD/build:$PATH

Expand Down Expand Up @@ -59,7 +59,7 @@ export E2E_SWARM_DIR=$E2E_SWARM_DIR
export SWARM_MANAGER="tcp://192.168.2.200:4243"

# note -- on exit, this won't clean up the plugins started by the cli since they will be in a separate process group
infrakit plugin start --wait --config-url file:///$PWD/scripts/e2e-test-plugins.json --os group-default instance-vagrant flavor-swarm flavor-vanilla &
infrakit plugin start --wait --config-url file:///$PWD/examples/flavor/swarm/e2e-plugins.json --os group-default instance-vagrant flavor-swarm flavor-vanilla &

starterpid=$!
echo "plugin start pid=$starterpid"
Expand Down Expand Up @@ -106,7 +106,7 @@ expect_output_lines "7 plugins should be discoverable" "infrakit plugin ls -q" "
expect_output_lines "0 instances should exist" "infrakit instance describe -q --name instance-vagrant" "0"

echo "Commiting manager"
infrakit group commit pkg/example/flavor/swarm/swarm-vagrant-manager.json
infrakit group commit examples/flavor/swarm/swarm-vagrant-manager.json

echo 'Waiting for group to be provisioned'
sleep 60
Expand All @@ -116,7 +116,7 @@ expect_output_lines "1 instances should exist in group" "infrakit group describe
expect_output_lines "1 instances should exist" "infrakit instance describe -q --name instance-vagrant" "1"

echo "Commiting workers"
infrakit group commit pkg/example/flavor/swarm/swarm-vagrant-workers.json
infrakit group commit examples/flavor/swarm/swarm-vagrant-workers.json

echo 'Waiting for group to be provisioned'
sleep 120
Expand All @@ -125,6 +125,11 @@ expect_output_lines "Should be watching two groups" "infrakit group ls -q" "2"
expect_output_lines "2 instances should exist in group" "infrakit group describe swarm-workers -q" "2"
expect_output_lines "3 instances should exist" "infrakit instance describe -q --name instance-vagrant" "3"

echo "Checking Docker Swarm"

docker -H $SWARM_MANAGER node ls


echo "Destroying workers"
infrakit group destroy swarm-workers
expect_output_lines "1 instances should exist" "infrakit instance describe -q --name instance-vagrant" "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This is a plugin for handling Zookeeper ensemble.

Begin by building plugin [binaries](/README.md#binaries).

Start the [vagrant instance plugin](/example/instance/vagrant):
Start the [vagrant instance plugin](/examples/instance/vagrant):

```shell
$ build/infrakit-instance-vagrant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ See the [CLI Doc](/cmd/cli/README.md) for details on accessing the instance plug
Start the plugin:

```shell
$ build/infrakit-instance-terraform --dir=./example/instance/terraform/aws-two-tier/
$ build/infrakit-instance-terraform --dir=./examples/instance/terraform/aws-two-tier/
INFO[0000] Listening at: ~/.infrakit/plugins/instance-terraform
```

Expand All @@ -127,7 +127,7 @@ Now lets try to validate something. Instead of reading from stdin we are loadin
to avoid problems with bad bash substitution beacuse Terrafrom configs use `$` to indicate variables.

```shell
$ cat example/instance/terraform/aws-two-tier/instance-plugin-properties.json
$ cat examples/instance/terraform/aws-two-tier/instance-plugin-properties.json
{
"type" : "aws_instance",
"value" : {
Expand All @@ -145,14 +145,14 @@ $ cat example/instance/terraform/aws-two-tier/instance-plugin-properties.json
}
}
}
$ build/infrakit instance --name instance-terraform validate example/instance/terraform/aws-two-tier/instance-plugin-properties.json
$ build/infrakit instance --name instance-terraform validate examples/instance/terraform/aws-two-tier/instance-plugin-properties.json
validate:ok
```

Now we can provision:

```shell
$ cat example/instance/terraform/aws-two-tier/instance-plugin-spec.json
$ cat examples/instance/terraform/aws-two-tier/instance-plugin-spec.json
{
"Properties" : {
"type" : "aws_instance",
Expand All @@ -176,7 +176,7 @@ $ cat example/instance/terraform/aws-two-tier/instance-plugin-spec.json
},
"Init" : "#!/bin/sh; sudo apt-get -y update; sudo apt-get -y install nginx; sudo service nginx start"
}
$ build/infrakit instance --name instance-terraform provision example/instance/terraform/aws-two-tier/instance-plugin-spec.json
$ build/infrakit instance --name instance-terraform provision examples/instance/terraform/aws-two-tier/instance-plugin-spec.json
instance-1475004829
```

Expand Down