@wirelineio/console-cli
v0.1.54
Published
Wireline CLI.
Downloads
2
Keywords
Readme
Wireline CLI.
Commands Overview
$ wire help
wire [command]
Commands:
wire quit Quit [aliases: exit]
wire build Build deployment bundle.
wire create [serviceName] Create project from template.
wire custom_domain Custom domain support.
wire deployment Deploy API. [aliases: dep]
wire domain Organization domains. [aliases: dom]
wire service Registry API. [aliases: svc, s]
wire stack Stack management.
wire status Service status. [aliases: stat]
wire logs Service deployment logs.
wire user Manage users. [aliases: u]
wire organization Manage organizations. [aliases: o]
wire invoke service function [params] Invoke service.
wire login Login with Wireline User Authority.
wire dev Start local dev server.
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--endpoint [default: "https://api.wireline.ninja"]
--access_key, --accessKey
--github_token, --githubToken
[default: "675726f7eba53943b70468d17b3f00e6e1d75b48"]
--poll [default: 0]
--help Show help [boolean]
wire build
Build the deployment bundle using the
buildTool
specified inservice.yml
.
Available options for buildTool
are:
webpack
: Runs a globally installed webpack.yarn
: Useyarn run build
(*) to generate the bundle.npm
: Usenpm run build
(*) to generate the bundle.
If you want to define a specific task for wire
that overrides build
, you can define a task called build-wire
. If build-wire
is set, build
is ignored.
Build deployment bundle.
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--endpoint [default: "https://api.wireline.ninja"]
--access_key, --accessKey
--github_token, --githubToken
[default: "675726f7eba53943b70468d17b3f00e6e1d75b48"]
--poll [default: 0]
--help Show help [boolean]
wire create [serviceName]
Create project from template.
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--endpoint [default: "https://api.wireline.ninja"]
--access_key, --accessKey
--github_token, --githubToken
[default: "675726f7eba53943b70468d17b3f00e6e1d75b48"]
--poll [default: 0]
--help Show help [boolean]
--template, -t [default: "https://github.com/wirelineio/service-template"]
--path, -p
--domain
--serviceName, --service-name
--stackName, --stack-name
wire custom_domain
Custom domain support.
Commands:
wire custom_domain map Map custom domain. [aliases: m]
wire custom_domain unmap Unmap custom domain. [aliases: um]
wire custom_domain list List custom domains. [aliases: ls]
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--endpoint [default: "https://api.wireline.ninja"]
--access_key, --accessKey
--github_token, --githubToken
[default: "675726f7eba53943b70468d17b3f00e6e1d75b48"]
--poll [default: 0]
--help Show help [boolean]
--domain
--stack
--deployment
--subdomain
wire domain
Organization domains.
Commands:
wire domain list List domains. [aliases: ls]
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--endpoint [default: "https://api.wireline.ninja"]
--access_key, --accessKey
--github_token, --githubToken
[default: "675726f7eba53943b70468d17b3f00e6e1d75b48"]
--poll [default: 0]
--help Show help [boolean]
wire service
Registry API.
Commands:
wire service list List services. [aliases: ls]
wire service search Find services by name.
wire service versions List service versions. [aliases: v]
wire service register Register service.
wire service unregister-version Unregister service version.
wire service unregister Unregister service.
wire service __clean Clean/remove all services in a domain.
wire service upload-assets Upload service assets.
wire service list-assets List service assets.
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--endpoint [default: "https://api.wireline.ninja"]
--access_key, --accessKey
--github_token, --githubToken
[default: "675726f7eba53943b70468d17b3f00e6e1d75b48"]
--poll [default: 0]
--help Show help [boolean]
--domain
--name
--force Force clean to ignore the domain and service
whiteliest [boolean] [default: false]
--ver
wire stack
Stack management.
Commands:
wire stack deploy Deploy a stack.
wire stack undeploy Undeploy a stack.
wire stack list List stacks. [aliases: ls]
wire stack __clean Clean/remove all services in a domain.
wire stack list-deployments List stack deployments. [aliases: ld]
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--endpoint [default: "https://api.wireline.ninja"]
--access_key, --accessKey
--github_token, --githubToken
[default: "675726f7eba53943b70468d17b3f00e6e1d75b48"]
--poll [default: 0]
--help Show help [boolean]
--domain
--force Force new stack deployment
[boolean] [default: false]
--name
--service
wire logs
Service deployment logs.
Options:
--poll [default: 0]
--help Show help [boolean]
--domain
--stack
--deployment
--function
--startTime
wire user
Manage users.
Commands:
wire user list List users. [aliases: ls]
wire user update Update user.
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--endpoint [default: "https://api.wireline.ninja"]
--access_key, --accessKey
--github_token, --githubToken
[default: "675726f7eba53943b70468d17b3f00e6e1d75b48"]
--poll [default: 0]
--help Show help [boolean]
--userId
--organizationId
--enabled [boolean]
wire organization
Manage organizations.
Commands:
wire organization list List organizations.
wire organization create Create an organization.
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--endpoint [default: "https://api.wireline.ninja"]
--access_key, --accessKey
--github_token, --githubToken
[default: "675726f7eba53943b70468d17b3f00e6e1d75b48"]
--poll [default: 0]
--help Show help [boolean]
--userId
--name
--fullName
wire invoke service function [params]
Invoke service.
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--endpoint [default: "https://api.wireline.ninja"]
--access_key, --accessKey
--github_token, --githubToken
[default: "675726f7eba53943b70468d17b3f00e6e1d75b48"]
--poll [default: 0]
--help Show help [boolean]
--service, -s
--function, -f
--params, -p [default: "{}"]
wire login
Login with Wireline User Authority.
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--endpoint [default: "https://api.wireline.ninja"]
--github_token, --githubToken
--poll [default: 0]
--help Show help [boolean]
wire dev
Start local dev server.
Options:
--help Show help [boolean]
--port, -p
Local usage
wire
command will be available under darkstar root folder using npx
. We need to make sure it is built first:
$ cd darkstar/@wirelineio/cli
$ yarn build
$ cd ../..
$ npx wire help
Development
Use webpack --watch
or yarn build --watch
to watch the files during development. Then you can execute the binary ./bin/wire.js
Troubleshooting
If there are errors on running yarn build
or installing the cli globally, try again after the following cleanup steps:
$ npm uninstall -g "@wirelineio/cli"
$ cd darkstar
$ git clean -xdf
$ yarn
Bash Alias
A bash
alias can be created to run the CLI from source but appear like a global install.
$ cat ~/.bash_aliases
alias wire='babel-node ~/projects/wireline/darkstar/sub/cli/src/main.js'
$ source ~/.bash_aliases
$ wire status
{"version":"0.0.1"}
Authentication
An authenticated session with Wireline User Authority is required to use the CLI. Alternatively, an Access Key could be used. In case of missing, an error is displayed.
$ wire domain list
Error: Missing Access Key. Set WRL_ACCESS_KEY or create ~/.wireline/credentials
Obtaining a session
$ wire login
Access Key
An Access Key could be used as another authentication option.
Generating Access Key
The access key could be generated from profile page in console.
Setting Access Key
The access key can be set in multiple ways.
Command Line Argument
$ wire domain list --access-key abc123
Environment Variable
Set the 'WRL_ACCESS_KEY' environment variable in your shell session OR ~/.bash_profile (or equivalent).
export WRL_ACCESS_KEY=abc123
Credentials File
Set 'WRL_ACCESS_KEY' in ~/.wireline/credentials
.
$ cat ~/.wireline/credentials
WRL_ACCESS_KEY: abc123
GitHub Access Token
Creation of a new project from template requires github access token. This step is temporary and would be omitted once service-template is public.
See https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line for more info.
repo
scope is required.
Setting GitHub Access token
export WRL_GITHUB_TOKEN=token
- CLI param
--githubToken=token
Commands
Domain
List Domains.
$ wire domain list
Domain
-----------------
wireline.io
dev.wireline.io
qa.wireline.io
example.com
Service
Create from template:
$ wire create --template https://github.com/wirelineio/service-template --path my-service
By default, if no template is passed then https://github.com/wirelineio/service-template
is used. You can also provide a service name, stack name and domain to configure the service.yml
and stack.yml
files.
$ wire create my-service --stack-name my-stack --domain mydomain.com --path ./my-service
Creating...
Template downloaded.
Configuring Service.
Configuring Stack.
Done.
Next Steps:
- cd /Users/janedoe/wire/my-service
- npm install
- wire build
- wire service register --domain mydomain.com
- wire stack deploy
Build Service.
$ wire build
Building...
OK
Register Service.
$ wire service register --domain example.com
Domain Name Version Content Hash Versions
---------------------------------------------------------------------------------------------------------------------------------------------------
example.com my-service 0.0.1 a3fb985afeec9d8f84cbcd902ad7a0d8611bb4e1ca19416eb70b520ada722fa3
List Services.
$ wire service list --domain example.com
Domain Name Version Content Hash Versions
---------------------------------------------------------------------------------------------------------------------------------------------------
example.com my-service 0.0.1 a3fb985afeec9d8f84cbcd902ad7a0d8611bb4e1ca19416eb70b520ada722fa3 1
Search Services.
$ wire service search --name my
Domain Name Version Content Hash Versions
---------------------------------------------------------------------------------------------------------------------------------------------------
example.com my-service 0.0.1 a3fb985afeec9d8f84cbcd902ad7a0d8611bb4e1ca19416eb70b520ada722fa3 1
$ wire service search --domain example.com --name my
Domain Name Version Content Hash Versions
---------------------------------------------------------------------------------------------------------------------------------------------------
example.com my-service 0.0.1 a3fb985afeec9d8f84cbcd902ad7a0d8611bb4e1ca19416eb70b520ada722fa3 1
List Service Versions.
$ wire service versions --name my-service --domain example.com
Domain Name Version Content Hash
-----------------------------------------------------------------------------------------------------------------------------------------
example.com my-service 0.0.1 a3fb985afeec9d8f84cbcd902ad7a0d8611bb4e1ca19416eb70b520ada722fa3
Upload Service Assets.
$ wire service upload-assets --domain example.com
Service Version File Content Hash Upload Required URL
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
my-service 0.0.1 5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 Yes https://s3.amazonaws.com/wireline-service-static-assets/a379a6/my-service/0.0.1/a/b/hello.txt
my-service 0.0.1 e258d248fda94c63753607f7c4494ee0fcbe92f1a76bfdac795c9d84101eb317 Yes https://s3.amazonaws.com/wireline-service-static-assets/a379a6/my-service/0.0.1/a/b/world.txt
List Service Assets.
$ wire service list-assets --domain example.com --name my-service --ver 0.0.1
Service Version File Content Hash Upload Required URL
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
my-service 0.0.1 5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 https://s3.amazonaws.com/wireline-service-static-assets/a379a6/my-service/0.0.1/a/b/hello.txt
my-service 0.0.1 e258d248fda94c63753607f7c4494ee0fcbe92f1a76bfdac795c9d84101eb317 https://s3.amazonaws.com/wireline-service-static-assets/a379a6/my-service/0.0.1/a/b/world.txt
Unregister Service Version.
$ wire service unregister-version --domain example.com --name my-service --ver 0.0.1
Unregistered Service Versions:
Domain Name Version Content Hash Versions
---------------------------------------------------------------------------------------------------------------------------------------------------
example.com my-service 0.0.1 a3fb985afeec9d8f84cbcd902ad7a0d8611bb4e1ca19416eb70b520ada722fa3
Unregister Service. Removes all versions of a service.
$ wire service unregister --domain example.com --name my-service
Unregistered Service:
Domain Name Version Content Hash Versions
---------------------------------------------------------------------------------------------------------------------------------------------------
example.com my-service
Clean Services. Removes all versions of all services in a domain. Services that are in use by a stack will not be deleted.
$ wire service __clean --domain example.com
The following services were found in a stack. Can not delete service in use.
Domain Name Version Content Hash Versions
---------------------------------------------------------------------------------------------------------------------------------------------------
example.com testing 0.0.1 14572256c1ed05eb0a3243aa281d1d09e2392f466efe08c383aaccdff54cefdf 1
Deleting services.
Domain Name Version Content Hash Versions
---------------------------------------------------------------------------------------------------------------------------------------------------
example.com my-service-1
example.com my-service-2
example.com my-service-3
List all deployments by serviceId. The serviceId is a combination of domain and service name, domain-name/service-name.
$ wire deployment list --serviceId example.com/my-service
Domain Stack Name Name Service Endpoint Url Version Status
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
example.com my-stack-1 my-deployment-1 wrn::my-service https://7743ktnqcf.execute-api.us-east-1.amazonaws.com/dev 0.0.1 DONE
example.com my-stack-2 my-deployment-2 wrn::my-service https://okmg81ap65.execute-api.us-east-1.amazonaws.com/dev 0.0.1 DONE
Stack
Deploy Stack.
$ wire stack deploy
Name Service Version Status Content Hash Endpoint Custom Domain
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
my-deployment wrn::my-service 0.0.1 IN_PROGRESS db3d7f01cd04e3a5415889ea3465dec9ff591fece72fd9d1bf149de64cd33bb0 https://aycfckvvvc.execute-api.us-east-1.amazonaws.com/dev
$ wire stack deploy
Name Service Version Status Content Hash Endpoint Custom Domain
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
my-deployment wrn::my-service 0.0.1 DONE db3d7f01cd04e3a5415889ea3465dec9ff591fece72fd9d1bf149de64cd33bb0 https://aycfckvvvc.execute-api.us-east-1.amazonaws.com/dev
Force Deploy Stack.
$ wire stack deploy --force
Name Service Version Status Content Hash Endpoint Custom Domain
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
my-deployment wrn::my-service 0.0.1 IN_PROGRESS db3d7f01cd04e3a5415889ea3465dec9ff591fece72fd9d1bf149de64cd33bb0 https://aycfckvvvc.execute-api.us-east-1.amazonaws.com/dev
List Stacks.
$ wire stack list --domain example.com
Domain Name Status Deployments
---------------------------------------------------------------------------------
example.com my-stack DONE 1
List Deployments. If no options are specified the domain
and name
from the stack.yml file in the CWD are used.
$ wire stack list-deployments --domain example.com --name my-stack
Name Service Version Status Content Hash Endpoint Custom Domain
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
my-deployment wrn::my-service 0.0.1 DONE db3d7f01cd04e3a5415889ea3465dec9ff591fece72fd9d1bf149de64cd33bb0 https://aycfckvvvc.execute-api.us-east-1.amazonaws.com/dev
Undeploy Stack (Delete Stack).
$ wire stack undeploy
Name Service Version Status Content Hash Endpoint Custom Domain
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
my-deployment wrn::my-service 0.0.1 DELETE_IN_PROGRESS db3d7f01cd04e3a5415889ea3465dec9ff591fece72fd9d1bf149de64cd33bb0 https://aycfckvvvc.execute-api.us-east-1.amazonaws.com/dev
Clean Stacks (Delete all stacks in a domain).
$ wire stack __clean --domain example.com
Undeploying the following stacks
Domain Name Status Deployments
---------------------------------------------------------------------------------
example.com my-stack-1 DONE 1
example.com my-stack-2 DONE 1
example.com my-stack-3 DONE 1
Custom Domains
Map.
$ wire custom_domain map --deployment my-deployment --subdomain my-service.wireline.ninja
Domain Stack Deployment Custom Domain Endpoint
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
example.com my-stack my-deployment my-service.wireline.ninja https://aycfckvvvc.execute-api.us-east-1.amazonaws.com/dev
List ('Custom Domain' column).
$ wire stack list-deployments --domain example.com --name my-stack
Name Service Version Status Content Hash Endpoint Custom Domain
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
my-deployment wrn::my-service 0.0.1 DONE db3d7f01cd04e3a5415889ea3465dec9ff591fece72fd9d1bf149de64cd33bb0 https://aycfckvvvc.execute-api.us-east-1.amazonaws.com/dev my-service.wireline.ninja
Unmap.
$ wire custom_domain unmap --deployment my-deployment --subdomain my-service.wireline.ninja
Domain Stack Deployment Custom Domain Endpoint
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
example.com my-stack my-deployment https://aycfckvvvc.execute-api.us-east-1.amazonaws.com/dev
Logs
View Logs.
$ wire logs --domain example.com --stack my-stack --deployment my-deployment --function test
Timestamp Message
-----------------------------------------------------------------------------
1524810170579 START RequestId: 68e545da-49e3-11e8-882f-b33e49cd91ae Version: $LATEST
1524810170582 2018-04-27T06:22:50.582Z 68e545da-49e3-11e8-882f-b33e49cd91ae [[METRIC:START]]: {}
1524810170585 2018-04-27T06:22:50.585Z 68e545da-49e3-11e8-882f-b33e49cd91ae [[METRIC:SUCCESS]]: {}
1524810170586 END RequestId: 68e545da-49e3-11e8-882f-b33e49cd91ae
1524810170586 REPORT RequestId: 68e545da-49e3-11e8-882f-b33e49cd91ae Duration: 6.70 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 56 MB
Dev Server
Start a local dev server with:
$ wire dev
This will start an dev server on port 3000 (or you can specify the port with -p XXXX
).
It will read the service.yml
to configure the endpoints and the webpack.config.js
for watching and compiling the handlers.
Static assets
When the service.yml
includes a staticAssets
configuration a second server will be listening on port 8080
to serve static content. The static server will hotreload content using a webpack-dev-middleware
and reading a config file named webpack-client.config.js
.
This file can override the static port and config by using the devServer
configuration.
Local overrides
By default, services
and assets
can be overridden using wireline.yml
file. The dev server will look for a wireline_local.yml
and if present, automatically use it to override configurations.
Status
View API status.
$ wire status
{"version":"0.0.1"}