[ARVADOS] updated: e96966556520e3d7cd27ad253418656892355c0d
Git user
git at public.curoverse.com
Thu Mar 2 01:04:34 EST 2017
Summary of changes:
cmd/arvados-admin/test-debian8/Dockerfile | 2 +-
.../test-docker-compose/docker-compose.yml | 6 ++--
lib/agent/agent.go | 1 +
lib/setup/setup.go | 42 ++++++++++++++++++++++
4 files changed, 47 insertions(+), 4 deletions(-)
via e96966556520e3d7cd27ad253418656892355c0d (commit)
from c78289e5956a55c7540c2a3f6a543f16b1eec7c2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit e96966556520e3d7cd27ad253418656892355c0d
Author: Tom Clegg <tom at curoverse.com>
Date: Thu Mar 2 01:04:27 2017 -0500
11183: Add "setup -wait" flag
diff --git a/cmd/arvados-admin/test-debian8/Dockerfile b/cmd/arvados-admin/test-debian8/Dockerfile
index 645aec2..6886fd3 100644
--- a/cmd/arvados-admin/test-debian8/Dockerfile
+++ b/cmd/arvados-admin/test-debian8/Dockerfile
@@ -11,4 +11,4 @@ RUN ["bash", "-c", "echo en_US.utf8 UTF-8 | tee -a /etc/locale.gen && locale-gen
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends ca-certificates locales nginx postgresql runit
-CMD ["bash", "-c", "runsvdir /etc/sv & arvados-admin setup && arvados-admin setup"]
+CMD ["bash", "-c", "runsvdir /etc/sv & arvados-admin setup -init-vault && arvados-admin setup -wait"]
diff --git a/cmd/arvados-admin/test-docker-compose/docker-compose.yml b/cmd/arvados-admin/test-docker-compose/docker-compose.yml
index 34e7cd4..aa5cb48 100644
--- a/cmd/arvados-admin/test-docker-compose/docker-compose.yml
+++ b/cmd/arvados-admin/test-docker-compose/docker-compose.yml
@@ -11,7 +11,7 @@ services:
- ./encrypt-key.txt:/var/lib/arvados/encrypt-key.txt:ro
- ./master-token.txt:/var/lib/arvados/master-token.txt:ro
- vault:/var/lib/arvados/vault
- command: ["bash", "-c", "runsvdir /etc/sv & arvados-admin setup -unseal=true -init-vault=true && wait"]
+ command: ["bash", "-c", "runsvdir /etc/sv & arvados-admin setup -init-vault=true -wait"]
sys1:
build: ../test-debian8
cap_add:
@@ -23,7 +23,7 @@ services:
- ./encrypt-key.txt:/var/lib/arvados/encrypt-key.txt:ro
- ./master-token.txt:/var/lib/arvados/master-token.txt:ro
- vault:/var/lib/arvados/vault
- command: ["bash", "-c", "runsvdir /etc/sv & arvados-admin setup -unseal=true && wait"]
+ command: ["bash", "-c", "runsvdir /etc/sv & arvados-admin setup -wait"]
sys2:
build: ../test-debian8
cap_add:
@@ -35,6 +35,6 @@ services:
- ./encrypt-key.txt:/var/lib/arvados/encrypt-key.txt:ro
- ./master-token.txt:/var/lib/arvados/master-token.txt:ro
- vault:/var/lib/arvados/vault
- command: ["bash", "-c", "runsvdir /etc/sv & arvados-admin setup -unseal=true && wait"]
+ command: ["bash", "-c", "runsvdir /etc/sv & arvados-admin setup -wait"]
volumes:
vault:
diff --git a/lib/agent/agent.go b/lib/agent/agent.go
index 52a3d83..2456423 100644
--- a/lib/agent/agent.go
+++ b/lib/agent/agent.go
@@ -91,6 +91,7 @@ func Command() *Agent {
DataDir: "/var/lib/arvados",
UsrDir: "/usr/local/arvados",
RunitSvDir: "/etc/sv",
+ Unseal: true,
}
}
diff --git a/lib/setup/setup.go b/lib/setup/setup.go
index 379ccb2..25c4d25 100644
--- a/lib/setup/setup.go
+++ b/lib/setup/setup.go
@@ -5,6 +5,7 @@ import (
"fmt"
"log"
"os"
+ "time"
"git.curoverse.com/arvados.git/lib/agent"
"git.curoverse.com/arvados.git/sdk/go/config"
@@ -29,6 +30,7 @@ type Setup struct {
InitVault bool
LANHost string
PreloadDir string
+ Wait bool
encryptKey string
masterToken string
@@ -40,6 +42,7 @@ func (s *Setup) ParseFlags(args []string) error {
fs.StringVar(&s.ClusterID, "cluster-id", s.ClusterID, "five-character cluster ID")
fs.BoolVar(&s.InitVault, "init-vault", s.InitVault, "initialize the vault if needed")
fs.BoolVar(&s.Unseal, "unseal", s.Unseal, "unseal the vault automatically")
+ fs.BoolVar(&s.Wait, "wait", s.Wait, "wait for all nodes to come up before exiting")
return fs.Parse(args)
}
@@ -61,6 +64,45 @@ func (s *Setup) Run() error {
return err
}
}
+
+ wait := 2 * time.Second
+ for ok := false; s.Wait && !ok; time.Sleep(wait) {
+ cc, err := s.consulMaster()
+ if err != nil {
+ log.Printf("setup: consulMaster(): %s", err)
+ continue
+ }
+ ok = true
+ svcs, _, err := cc.Catalog().Services(nil)
+ if err != nil {
+ log.Printf("setup: consul.Catalog().Services(): %s", err)
+ continue
+ }
+ for svc := range svcs {
+ checks, _, err := cc.Health().Checks(svc, nil)
+ if err != nil {
+ log.Printf("setup: consul.Health().Checks(%q): %s", svc, err)
+ continue
+ }
+
+ for _, check := range checks {
+ if check.Status != "passing" {
+ log.Printf("waiting for node %q service %q check %q state %q", check.Node, check.ServiceName, check.CheckID, check.Status)
+ ok = false
+ }
+ }
+ }
+ if ok {
+ log.Printf("All services are passing: %+v", svcs)
+ // Wait to ensure any other "setup -wait"
+ // processes have a chance to see the
+ // all-passing state before we return (if this
+ // is a test or image-building scenario, the
+ // whole system might shut down and stop
+ // passing as soon as we return).
+ time.Sleep(2 * wait)
+ }
+ }
return nil
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list