This repository has been archived by the owner on Nov 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
implement new service start command #45
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
253e8a3
implement new service start command
ilgooz d932b5b
update instance proto for newstart command
ilgooz 7b1dec0
merge master
ilgooz 8a57d0b
fix lint
ilgooz 3ef7b4e
command/newstart: fix description
ilgooz 83cbe39
update proto files for Instance
ilgooz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {flags} from '@oclif/command' | ||
|
||
import Command from '../../service-command' | ||
|
||
export default class ServiceDeployNew extends Command { | ||
static description = 'Start a service instance' | ||
|
||
static flags = { | ||
...Command.flags, | ||
env: flags.string({ | ||
description: 'set env defined in mesg.yml (configuration.env)', | ||
multiple: true, | ||
helpValue: 'FOO=BAR' | ||
}) | ||
} | ||
|
||
static args = [{ | ||
name: 'SERVICE', | ||
required: true, | ||
description: 'Service\'s sid or hash' | ||
}] | ||
|
||
static hidden = true | ||
|
||
async run(): Promise<string> { | ||
const {args, flags} = this.parse(ServiceDeployNew) | ||
this.spinner.start('Start service') | ||
return new Promise<string>((resolve, reject) => { | ||
this.instanceAPI.Create({serviceHash: args.SERVICE, env: flags.env}, (err, resp) => { | ||
if (err) { | ||
reject(err) | ||
this.spinner.stop(err) | ||
return | ||
} | ||
this.spinner.stop(resp.instance.hash) | ||
resolve(resp.hash) | ||
}) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
syntax = "proto3"; | ||
|
||
import "protobuf/definition/instance.proto"; | ||
|
||
package api; | ||
|
||
service Instance { | ||
rpc Create (CreateInstanceRequest) returns (CreateInstanceResponse) {} | ||
} | ||
|
||
message CreateInstanceRequest { | ||
string serviceHash = 1; // Service's sid or hash. | ||
repeated string env = 2; // Env vars to apply to service's instance on runtime. | ||
} | ||
|
||
message CreateInstanceResponse { | ||
definition.Instance instance = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
syntax = "proto3"; | ||
|
||
package definition; | ||
option go_package = "github.com/mesg-foundation/core/protobuf/definition"; | ||
|
||
// Instance represents service's instance. | ||
message Instance { | ||
string hash = 1; | ||
string serviceHash = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export default { | ||
engine: 'v0.10.1' | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be named differently,
ServiceStartNew
,InstanceCreate
...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when previous start cmd removed, this one will get its name. there is no reason to perfect the name of this temp cmd