agent

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2016 License: Apache-2.0, BSD-3-Clause, MIT Imports: 36 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AgentHome    = "/etc/dockercloud/agent/"
	DockerHome   = "/usr/bin/"
	AgentLibHome = "/usr/lib/dockercloud/"
	LogDir       = "/var/log/dockercloud/"

	DockerLogFileName = "docker.log"
	AgentLogFileName  = "agent.log"
	KeyFileName       = "key.pem"
	CertFileName      = "cert.pem"
	CAFileName        = "ca.pem"
	ConfigFileName    = "dockercloud-agent.conf"
	DockerBinaryName  = "docker"
	DockerTarName     = "docker.tgz"
	DockerTarSigName  = "docker.tgz.sig"
	NgrokBinaryName   = "ngrok"
	NgrokLogName      = "ngrok.log"
	NgrokConfName     = "ngrok.conf"
	AgentPidFile      = "/var/run/dockercloud-agent.pid"

	RegEndpoint       = "api/agent/v1/node/"
	DockerDefaultHost = "unix:///var/run/docker.sock"

	MaxWaitingTime    = 200 //seconds
	HeartBeatInterval = 5   //seconds

	RenicePriority  = -10
	ReniceSleepTime = 5 //seconds

	DockerHostPort = "2375"

	DialTimeOut = 10 //seconds
)
View Source
const (
	VERSION = "1.1.0"
)

Variables

View Source
var (
	FlagDebugMode     *bool
	FlagLogToStdout   *bool
	FlagStandalone    *bool
	FlagSkipNatTunnel *bool
	FlagDockerHost    *string
	FlagDockerOpts    *string
	FlagHost          *string
	FlagToken         *string
	FlagUUID          *string
	FlagNgrokHost     *string
	FlagVersion       *bool

	Conf                      Configuration
	Logger                    *log.Logger
	DockerProcess             *os.Process
	ScheduleToTerminateDocker = false
	ScheduledShutdown         = false
	DockerTarURL              = ""
	NgrokTarURL               = ""
	NgrokHost                 = ""
)

Functions

func CreateCerts

func CreateCerts(keyFilePath, certFilePath, host string)

func CreatePidFile

func CreatePidFile(pidFile string)

func DownloadDocker

func DownloadDocker(url, dockerHome string)

func DownloadNgrok

func DownloadNgrok(url, ngrokHome string)

func GetCertificate

func GetCertificate(certFilePath string) (*string, error)

func GetDockerClientVersion

func GetDockerClientVersion(dockerBinPath string) (version string)

func HandleSig

func HandleSig()

func HttpGet

func HttpGet(url string) ([]byte, error)

func LoadDefaultConf

func LoadDefaultConf()

func NatTunnel

func NatTunnel(url, ngrokHome, ngrokLogPath, ngrokConfPath, uuid string)

func ParseFlag

func ParseFlag()

func RegPatch

func RegPatch(url, caFilePath, certFilePath, configFilePath string) error

func RegPost

func RegPost(url, caFilePath, configFilePath string) error

func SaveConf

func SaveConf(configFile string, conf Configuration) error

func SendError

func SendError(err error, msg string, extra map[string]interface{})

func SendRequest

func SendRequest(method, url string, data_bytes []byte, headers []string) ([]byte, error)

func SetConfigFile

func SetConfigFile(configFilePath string)

func SetLogger

func SetLogger(logFile string)

func StartDocker

func StartDocker(dockerBinPath, keyFilePath, certFilePath, caFilePath string)

func StopDocker

func StopDocker()

func UpdateDocker

func UpdateDocker(dockerHome, dockerTarPath, dockerTarSigPath, keyFilePath, certFilePath, caFilePath string)

func VerifyRegistration

func VerifyRegistration(url string)

Types

type Configuration

type Configuration struct {
	CertCommonName string
	DockerHost     string
	Host           string
	Token          string
	UUID           string
	DockerOpts     string
}

func LoadConf

func LoadConf(configFile string) (*Configuration, error)

type ReachableForm

type ReachableForm struct {
	Reachable bool `json:"reachable"`
}

type RegGetForm

type RegGetForm struct {
	AgentVersion string `json:"agent_version"`
	DockerUrl    string `json:"docker_url"`
	ExternalFqdn string `json:"external_fqdn"`
	NgrokUrl     string `json:"ngrok_url"`
	PublicCert   string `json:"public_cert"`
	ResourceUri  string `json:"resource_uri"`
	State        string `json:"state"`
	Tunnel       string `json:"tunnel"`
	UserCaCert   string `json:"user_ca_cert"`
	UUID         string `json:"uuid"`
	NgrokHost    string `json:"ngrok_server_addr"`
}

type RegPatchForm

type RegPatchForm struct {
	Public_cert   string `json:"public_cert"`
	AgentVersion  string `json:"agent_version"`
	DockerVersion string `json:"docker_version,omitempty"`
}

type RegPostForm

type RegPostForm struct {
	AgentVersion string `json:"agent_version"`
}

type RegResponseForm

type RegResponseForm struct {
	UserCaCert      string `json:"user_ca_cert"`
	UUID            string `json:"uuid"`
	CertCommonName  string `json:"external_fqdn"`
	DockerTarURL    string `json:"docker_url"`
	NgrokTarURL     string `json:"ngrok_url"`
	PublicIpAddress string `json:"public_ip"`
}

type TargetDef

type TargetDef struct {
	Version             string `json: "version"`
	Download_url        string `json: "download_url"`
	Checksum_md5_url    string `json: "checksum_md5_url"`
	Checksum_sha256_url string `json: "checksum_sha256_url"`
}

type TunnelPatchForm

type TunnelPatchForm struct {
	Tunnel  string `json:"tunnel"`
	Version string `json:"agent_version"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL