This commit is contained in:
Ian Eyberg 2019-10-31 17:07:56 -07:00
parent a1a508ca8f
commit c3d55353f9
3 changed files with 19 additions and 2 deletions

View File

@ -71,6 +71,12 @@ Then you can run it like so:
ops load node_v11.5.0 -p 8083 -f -n -a hi.js
```
Want to push your app out to the cloud?
For Google: https://nanovms.gitbook.io/ops/google_cloud
For AWS: https://nanovms.gitbook.io/ops/aws
Languages:
* [Golang](https://nanovms.gitbook.io/ops/basic_usage#running-golang-hello-world)

View File

@ -61,11 +61,13 @@ func instanceCreateCommandHandler(cmd *cobra.Command, args []string) {
func instanceCreateCommand() *cobra.Command {
var imageName, config, flavor string
var cmdInstanceCreate = &cobra.Command{
Use: "create",
Short: "create nanos instance",
Run: instanceCreateCommandHandler,
}
cmdInstanceCreate.PersistentFlags().StringVarP(&config, "config", "c", "", "config for nanos")
cmdInstanceCreate.PersistentFlags().StringVarP(&imageName, "imagename", "i", "", "image name [required]")
cmdInstanceCreate.PersistentFlags().StringVarP(&flavor, "flavor", "f", "g1-small", "flavor name for GCP")
@ -76,16 +78,20 @@ func instanceCreateCommand() *cobra.Command {
func instanceListCommandHandler(cmd *cobra.Command, args []string) {
provider, _ := cmd.Flags().GetString("target-cloud")
p := getCloudProvider(provider)
c := api.Config{}
projectID, _ := cmd.Flags().GetString("projectid")
if projectID == "" {
if projectID == "" && provider == "gcp" {
exitForCmd(cmd, "projectid argument missing")
}
zone, _ := cmd.Flags().GetString("zone")
if zone == "" {
exitForCmd(cmd, "zone argument missing")
}
c.CloudConfig.ProjectID = projectID
c.CloudConfig.Zone = zone
ctx := api.NewContext(&c, &p)
@ -108,10 +114,13 @@ func instanceDeleteCommandHandler(cmd *cobra.Command, args []string) {
provider, _ := cmd.Flags().GetString("target-cloud")
p := getCloudProvider(provider)
c := api.Config{}
projectID, _ := cmd.Flags().GetString("projectid")
if projectID == "" {
if projectID == "" && provider == "gcp" {
exitForCmd(cmd, "projectid argument missing")
}
zone, _ := cmd.Flags().GetString("zone")
if zone == "" {
exitForCmd(cmd, "zone argument missing")

View File

@ -50,6 +50,7 @@ func setDefaultImageName(cmd *cobra.Command, c *api.Config) {
// TODO : use factory or DI
func getCloudProvider(providerName string) api.Provider {
var provider api.Provider
if providerName == "gcp" {
provider = &api.GCloud{}
} else if providerName == "onprem" {
@ -60,6 +61,7 @@ func getCloudProvider(providerName string) api.Provider {
fmt.Fprintf(os.Stderr, "error:Unknown provider %s", providerName)
os.Exit(1)
}
provider.Initialize()
return provider
}