Exemple #1
0
func (s Filestore) NewHost(driver drivers.Driver) (*host.Host, error) {
	certDir := filepath.Join(s.Path, "certs")

	hostOptions := &host.Options{
		AuthOptions: &auth.Options{
			CertDir:          certDir,
			CaCertPath:       filepath.Join(certDir, "ca.pem"),
			CaPrivateKeyPath: filepath.Join(certDir, "ca-key.pem"),
			ClientCertPath:   filepath.Join(certDir, "cert.pem"),
			ClientKeyPath:    filepath.Join(certDir, "key.pem"),
			ServerCertPath:   filepath.Join(s.getMachinesDir(), "server.pem"),
			ServerKeyPath:    filepath.Join(s.getMachinesDir(), "server-key.pem"),
		},
		EngineOptions: &engine.Options{
			InstallURL:    "https://get.docker.com",
			StorageDriver: "aufs",
			TLSVerify:     true,
		},
		SwarmOptions: &swarm.Options{
			Host:     "tcp://0.0.0.0:3376",
			Image:    "swarm:latest",
			Strategy: "spread",
		},
	}

	return &host.Host{
		ConfigVersion: version.ConfigVersion,
		Name:          driver.GetMachineName(),
		Driver:        driver,
		DriverName:    driver.DriverName(),
		HostOptions:   hostOptions,
	}, nil
}