Skip to content

Instantly share code, notes, and snippets.

@jasonmoo
Created July 18, 2014 01:46
Show Gist options
  • Save jasonmoo/dff77e65230068ca001f to your computer and use it in GitHub Desktop.
Save jasonmoo/dff77e65230068ca001f to your computer and use it in GitHub Desktop.
// using goamz grab a region
region := ec2.New(aws.Auth{
AccessKey: "XXXXXXX",
SecretKey: "XXXXXXX",
}, Instance_Region)
// get a list of public dns names by the server’s class
servers := pd.GetPublicDNS(region, Instance_ClassName)
// build a pool of servers and specify the concurrency
pool := pd.NewPool(Instance_User, Instance_PubKey, servers, DefaultConcurrency)
// build the target binary
pd.BuildGoBinary("$GOPATH/src/github.com/prevoty/testapp", "testapp", "linux", "amd64")
// ensure all ports are open
pool.WaitForPort(22)
// push the new binary
pd.Must(pool.Rsync("-az", "$GOPATH/src/github.com/prevoty/testapp/testapp", "/var/testapp/testapp"))
pd.Must(pool.Sudo("restart testapp")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment