Documentation ¶
Overview ¶
Package gce provides tools to deploy Camlistore on Google Compute Engine.
Index ¶
- Constants
- Variables
- func NewDeployHandler(host, prefix string) (http.Handler, error)
- func NewDeployHandlerFromConfig(host, prefix, configFile string) (http.Handler, error)
- func NewOAuthConfig(clientID, clientSecret string) *oauth2.Config
- type Config
- type DeployHandler
- type Deployer
- type InstanceConf
- type TemplateData
Constants ¶
const ( // default instance configuration values. // TODO(mpl): they can probably be lowercased now that handler.go is in the same // package. Just need to verify camdeploy does not need them. InstanceName = "camlistore-server" Machine = "g1-small" Zone = "us-central1-a" ConsoleURL = "https://console.developers.google.com" HelpCreateProject = "Go to " + ConsoleURL + " to create a new Google Cloud project" HelpEnableAPIs = `` /* 192-byte string literal not displayed */ HelpManageSSHKeys = `` /* 175-byte string literal not displayed */ HelpManageHTTPCreds = `` /* 232-byte string literal not displayed */ )
Variables ¶
var ( // DevHandler: if true, use HTTP instead of HTTPS, force permissions prompt for OAuth, // do not actually create an instance. It has no effect if set after NewHandler is // called. DevHandler bool )
var ( // Verbose enables more info to be printed. Verbose bool )
Functions ¶
func NewDeployHandler ¶
NewDeployHandler initializes a DeployHandler that serves at https://host/prefix/ and returns it. A Google account client ID should be set in CAMLI_GCE_CLIENTID with its corresponding client secret in CAMLI_GCE_CLIENTSECRET.
func NewDeployHandlerFromConfig ¶
NewDeployHandlerFromConfig initializes a DeployHandler from the JSON config file. Host and prefix have the same meaning as for NewDeployHandler.
func NewOAuthConfig ¶
NewOAuthConfig returns an OAuth configuration template.
Types ¶
type Config ¶
type Config struct { ClientID string `json:"clientID"` // handler's credentials for OAuth. required. ClientSecret string `json:"clientSecret"` // handler's credentials for OAuth. required. Project string `json:"project"` // any Google Cloud project we can query to get the valid Google Cloud zones. optional. ServiceAccount string `json:"serviceAccount"` // JSON file with credentials to Project. optional. DataDir string `json:"dataDir"` // where to store the instances configurations and states. optional. }
Config is the set of parameters to initialize the DeployHandler.
type DeployHandler ¶
DeployHandler serves a wizard that helps with the deployment of Camlistore on Google Compute Engine. It must be initialized with NewDeployHandler.
func (*DeployHandler) AddTemplateTheme ¶
func (h *DeployHandler) AddTemplateTheme(text string) error
AddTemplateTheme allows to enhance the aesthetics of the default template. To that effect, text can provide the template definitions for "header", "banner", "toplinks", and "footer".
func (*DeployHandler) ServeHTTP ¶
func (h *DeployHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*DeployHandler) SetLogger ¶
func (h *DeployHandler) SetLogger(logger *log.Logger)
type Deployer ¶
type Deployer struct { Client *http.Client Conf *InstanceConf // contains filtered or unexported fields }
Deployer creates and starts an instance such as defined in Conf.
type InstanceConf ¶
type InstanceConf struct { Name string // Name given to the virtual machine instance. Project string // Google project ID where the instance is created. Machine string // Machine type. Zone string // Geographic zone. SSHPub string // SSH public key. CertFile string // HTTPS certificate file. KeyFile string // HTTPS key file. Hostname string // Fully qualified domain name. Password string // Camlistore HTTP basic auth password. Defaults to project ID. Ctime time.Time // Timestamp for this configuration. // contains filtered or unexported fields }
InstanceConf is the configuration for the Google Compute Engine instance that will be deployed.
type TemplateData ¶
type TemplateData struct { Title string Help map[string]template.HTML // help bits within the form. Hints []string // helping hints printed in case of an error. Defaults map[string]string // defaults values for the form fields. Err error Prefix string // handler prefix. InstanceKey string // instance creation identifier, for the JS code to regularly poll for progress. PiggyGIF string // URI to the piggy gif for progress animation. Conf *InstanceConf // Configuration requested by the user InstanceIP string // instance IP address that we display after successful creation. CertFingerprintSHA1 string // SHA-1 fingerprint of the self-signed HTTPS certificate. CertFingerprintSHA256 string // SHA-256 fingerprint of the self-signed HTTPS certificate. ProjectConsoleURL string ZoneValues []string MachineValues []string }
TemplateData is the data passed for templates of tplHTML.