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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
under temporary service:start name.
- Loading branch information
Showing
4 changed files
with
67 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {flags} from '@oclif/command' | ||
import Command from '../../service-command' | ||
|
||
export default class ServiceDeployNew extends Command { | ||
static description = 'Start a service' | ||
|
||
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({id: args.SERVICE, env: flags.env}, (err, resp) => { | ||
if (err) { | ||
reject(err) | ||
this.spinner.stop(err) | ||
return | ||
} | ||
this.spinner.stop(`${resp.sid} (${resp.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"; | ||
|
||
package api; | ||
|
||
service Instance { | ||
rpc Create (CreateInstanceRequest) returns (CreateInstanceResponse) {} | ||
} | ||
|
||
message CreateInstanceRequest { | ||
string id = 1; // Service's sid or hash. | ||
repeated string env = 2; // Env vars to apply to service's instance on runtime. | ||
} | ||
|
||
message CreateInstanceResponse { | ||
string sid = 1; // Service's id. | ||
string hash = 2; // Service's instance hash. | ||
string serviceHash = 3; // Service's bare 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
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