Command Line Interface (CLI) Guide
Our CLI gives full command line access to a realMethods platform instance to help manage models, technology stacks and resources to generate, commit, build/test, deploy and archive fully functional DevOps projects.
|User||init||user token||Must run first to initialize realMethods session. User account req’d|
|user_info||Information about the signed in user.|
|Model||list||[options] [scope]||List available models. Scope: public, private, community. Empty args returns all.|
|validate||model_file_path||Validate a model for possible usage later on.|
|publish||yaml_file [scope]||Publish a model using a YAML directives. Scope: public or private[default].|
|download||model_id output_file_path||Download a model file. Only owned or public models can be downloaded.|
|promote||model identifier||Promote an owned model from private scope to public.|
|demote||model identifier||Demote an owned model from public scope to private.|
|delete||model identifier||Delete a model. Can only delete an owned private model.|
|Tech Stack||list||[options] [scope]||List available tech stacks. Scope: public, private, community. Empty args returns all.|
|validate||tech stack package file-path||Validate a model for possible usage later on.|
|publish||yaml_file [scope]||Publish a stack using YAML directives. Scope: public or private [default].|
|download||tech_stack_id output_file_path||Download a tech stack as a single ZIP file. Only owned or public can be downloaded|
|promote||tech_stack_id||Promote an owned tech stack from private scope to public.|
|demote||tech_stack_id||Demote an owned tech stack from private scope to public.|
|delete||tech_stack_id||Delete a tech stack. Can only delete an owned private tech stack.|
|Resource||list||[options] [scope]||List available resources. Scope: public, private, community. Empty args returns all.|
|publish||yaml_file [scope]||Publish a resource. [type] [scope]
type: CI_CONFIG, GENERIC, DOCKERFILE, TERRAFORM
scope: public, community, private[default]
|download||resource_id output_file_path||Download a resource as a file. Only owned or public can be downloaded|
|promote||resource_id||Promote an owned resource from private scope to public.|
|demote||resource_stack_id||Demote an owned resource from private scope to public.|
|delete||resource_id||Delete a resource. Can only delete an owned private resource.|
|Application||generate||[options] yaml_file||Generates an app/project using the directives of a single YAML file.|
|download||app_id output_file_path||Download an app as ZIP file. Only owned or public can be downloaded.|
|delete||app_id||Delete an owned private generated app. Public and community cannot be deleted once generated.|
|promote||app_id||Promote an owned application from private scope to public.|
|demote||app_id||Demote an owned application from public scope to private.|
|list||[options] [scope]||List archived apps. Scope: public, private, community. Empty returns all.|
The realMethods CLI is stored as a packaged Node.js application, managed by npm @ npmjs.com. npm is distributed with Node.js - which means that when you download Node.js,
you automatically get npm installed on your computer.
With Node.js and npm installed, you are ready to install the realMethods CLI. Issue the following on the command line.
npm install realmethods_cli
Validate the install by typing
A list of commands and options should appear.
realmethods_cli init [token] [hostUrl]
where token is your unique token assigned when you signed up for an account at http://www.realmethods.com. It is available to copy under the API Token tab of the user preferences screen.
If you do not have a token, you will be prompted to provide one along with the URL of the your realMethods Community server instance. Leave it blank if using our hosted realMethods server instance.
Gets information about the signed in user.
To display the current user information:
List of Models
model_list [options] [scope] [filter]
List available models.
scope: public, private, community. Empty returns all.
filter: emf, sqlscript, uml, xmi, pojo, json Providing no value returns all.
To display all public models using pretty print:
realmethods_cli model_list public --output pretty
To display all your public and private models as json [default]:
To display all community sql script models as json:
realmethods_cli model_list community -f sqlscript
Validate a Model
Validate a model for possible usage later on.
To validate a UML XMI file:
realmethods_cli model_validate ./models/myuml.xmi
Publish a Model
Publish a model file or use a YAML with appropriate directives. Scope: public or private[default].
Publish a model using a YAML directives. Scope: public or private[default].
To publish a model as private:
realmethods_cli model_publish ./save-my-model.ecore
To publish a model as public:
realmethods_cli model_publish ./save-my-model.ecore public
Download a Model
Download a model file. Only owned or public models can be downloaded.
To download an delete:
realmethods_cli model_download 2 ./tmp/archive/mymodel.xmi'
Promote a Model
Any private model you own can be promoted to public. Making it public allows it to be accessed by the community.
Promote an owned model from private scope to public. Promotion cannot be undone. Confirmation is required.
To promote a model from being private to public, referenced by id=1000:
realmethods_cli model_promote 1000
Delete a Model
Delete a model. Can only delete an owned private model. Deletion cannot be undone.
To delete a model referenced by id=12, prompted to confirm:
realmethods_cli model_delete 12
List of Technology Stacks
stack_list [options] [scope] [filter]
List available tech stacks.
Scope: public, private, community
Filter: serverless, webapp, restfulapi, mobile
Default returns all of yours.
To display all your public tech stacks using pretty print:
realmethods_cli stack_list private --output pretty
To display all your serverless type tech stacks as json
realmethods_cli stack_list -f serverless
Download a Technology Stack's Options
Available stack application options, modifiable to allow customization of a generated application. Download as JSON
and provide as JSON during application generation.
<p\> To download the application options for the associated technology stack piped into a file as JSON with output turn to quiet:
realmethods_cli stack_options --quiet true 1 > app.options.json
Validate a Technology Stack
<p\> Validates the structure and contents of a technology stack as (ZIP file). Download an existing technology stack to view its contents
to understand what is required.
<p\> To validate a technology stack ZIP file:
realmethods_cli stack_validate './samples/techstacks/AWS_Lambda_RDS_Modified.zip'
Publish a Technology Stack
<p\> Publish a technology stack to make it available to others (public) and to make it available during application generation.
<p\> Publish a stack using YAML directives. Scope: public or private [default].
<p\> A published stack is first validated and if found to be valid it is persisted.
<p\> To publish a technology stack as public:
realmethods_cli stack_publish ./yamls/save-my-techstack.yml public'
Download a Technology Stack
<p\> Download a technology stack as a ZIP file. Only owned or public stacks can be downloaded.
<p\> If interested in creating and publishing a technology stack, it is best to first try to locate and download
an existing technology stack that closest meets your requirements.
<p\> To download a technology stack referenced by id=15:
realmethods_cli stack_download 15 ./tmp/archive/mystack.zip'
Delete a Technology Stack
<p\> Delete a technology stack. Can only delete an owned private technology stack. Confirmation is required.
<p\> To delete a tech stack referenced by id=256:
realmethods_cli stack_delete 256
Promote a Technology Stack
<p\> Promote an owned technology stack from private scope to public. Making it public gives it community access.
<p\> Promotion cannot be undone. Confirmation is required.
<p\> To promote a tech stack referenced by id=24:
realmethods_cli stack_promote 24
List of Resources
resource_list [options] [scope] [filter]
List available resources.
Scope: public, private, community
Filter: type: Dockerfile, CI_Config,Terraform, Generic
Default returns all of yours.
To display all your private resources using pretty print:
realmethods_cli resource_list private --output pretty
To display all community Dockerfile resources as json
realmethods_cli resource_list community -f DOCKEFILE
Publish a Resource
resource_publish [options] <resource_file> <unique_name> [type] [scope]
<p\> Publish a resource file. type: DOCKERFILE, CI_CONFIG, TERRAFORM, GENERIC; scope: public or private[default].
To publish a resource as private:
realmethods_cli resource_publish ./some_path/Dockerfile myFirstDockerFile DOCKERFILE
Download a Resource
<p\>Download a resource file. Only owned or public models can be downloaded.
To download a resource with id of 2:
realmethods_cli stack_download 2 ./tmp/archive/Dockerfile'
Delete a Resource
<p\> Delete a resource. Can only delete an owned private resource. Confirmation is required.
<p\> To delete a resource referenced by id=123:
realmethods_cli resource_delete 123
Promote a Resource
<p\> Promote an owned resource from private scope to public. Making it public gives it community access. Confirmation is required.
<p\> To promote a resource referenced by id=24:
realmethods_cli resource_promote 24
Demote a Resource
<p\> Demote an owned resource from public scope to private. Making it private removes community access. Use care since others may be referencing the resource. Confirmation is required.
<p\> To demote a resource referenced by id=24:
realmethods_cli resource_demote 24
Generate an Application
Generates an application using the directives of a YAML file. This YAML files contains
the application directives including a model identifier, technology stack identifier, GitHub options and more.
The easiest way to generate an application and all its required files is to do so in a single YAML file. For each supported tech stack, you can view sample "project-as-code" YAML files at https://github.com/realmethods-public/CLI/tree/master/samples/yamls/project.as.code.
Example Project-as-Code file:
app: techstack: id: Angular7MongoDB # options: ASPNETCore, LambdaNoSQL, Lambda, Angular7MongoDB, Django, GoogleFunctions # SparkMicroWeb, SpringCore, SpringMongoDB, Struts2, Apollo # To see the list of available tech stacks on a realMethods instance using command: # realmethods_cli stack_list --output pretty model: identifier: 4 # options: Unique id of an existing model or # full or relative path to a model file of a supported type # model types: UML, Eclipse Modeling Framework, JSON, SQL Script, JAR, EAR # To see the list of available model on a realMethods instance using command: # realmethods_cli model_list --output pretty # # DevOps Project Creation Options # options: # # Application parameters # application: name: angular7demo description: Demo Angular7 application generated by realMethods author: Dev Team email: email@example.com application logo URL: ./img/turnstone.biologics.png company name: Turnstone Biologics version: 0.0.1 # # Docker parameters # docker: userName: xxxxxxxxxxxx password: xxxxxxxxxxxx orgName: realmethods repo: angular7demo tag: latest # # CI/CD parameters # cicd: platform: codeship # options: codeship, circleci, # jenkins, azure, aws, gitlab, # bitbucket, buddy, semaphore AES key: XKyy2IDcSptIIvMY8KLMVMcxVs+ZK6AyNu1B4Wu1DPY= # # Git repository parameters # git: name: git_test_Angular7MongoDB username: tylertravismya password: 6969Cutlass!! repository: AngularForNutanix tag: latest host: bitbucket.org # # HashiCorp Terraform parameters # terraform: inUse: true provider: aws # options: aws, google, azure, nutanix region: us-east-1 # options: any cloud provider region ssh-fingerprint: 50:36:21:3f:3e:fd:de:fc:2f:1f:17:a6:09:6d:1b:dd # # AWS parameters # aws: key-pair-name: my-public-key vpc: vpc-c422e2a0 ec2-instance-type: t2.medium # options: any AWS instance type access-key: ASSIGN__ON_CICD_PLATFORM_AS_ENV_VARS secret-key: ASSIGN__ON_CICD_PLATFORM_AS_ENV_VARS # # Nutanix parameters # nutanix: inUse: true userName: firstname.lastname@example.org password: NTNXreal123! endpoint: 10.16.0.85 insecure: true port: 9440 clusterId: xxxxxx-xxxx-xxxx-xxxx email: email@example.com vmUserName: xxxxx vmPassword: xxxxxx vmHost: xxx.xxx.xxx.xxx vmOS: linux # linux or windows # # Kubernetes parameters: If not in use, and Terraform # is in use, physical infrastructure # will be provisioned on the provider # kubernetes: inUse: true host: https://xxx.xxx.xxx.xxx project: my-project-name region: us-central1-a # options: any provider region hostTarget: google # option: google, aws, azure username: admin password: xxxxxxxxxxxx exposeAsService: true serviceType: LoadBalancer # options: LoadBalancer, NodePort, ClusterIP useSessionAffinity: true # # Artifact repository for build dependencies and binaries # artifact-repo: inUse: false type: nexus # options: nexus, jfrog userName: admin password: xxxxxxxx email: firstname.lastname@example.org repoUrl: http://xxx.xxx.xxx.xxx:8081/repository/npm-public # # MongoDB parameters # mongodb: server address: localhost:27017 database name: angular7demo search size: 10 default collection name: default_collection auto-increment id name: _id auto-increment seq name: seq mongooseHost: http://localhost mongoosePort: 4000
To generate an application using the directives of a YAML file:
realmethods_cli app_generate ./samples/yamls/generate-django.yml
To generate an application overriding certain directives of an app generation YAML file:
realmethods_cli app_generate ./samples/yamls/generate-django.yml -g ./samples/git/test.git.yml -o ./samples/options/remote/Django.options.json --modelIdentifier ./samples/yamls/model.publish.yml
- -g, --gitFile : Git settings in YAML file, overrides app->options->git params
- -o, --optionsFile : App options in JSON file, overrides app->options params
- -m, --modelIdentifier : Either a Model YAML directive file or the ID of a previously registered model, overrides app.model.identifier param
Download an Application
Download a previously generated archived application ZIP file. Only owned or public applications can be downloaded.
To download an application archive file with identifier of 55 to a local file:
realmethod_cli app_download 55 ./myapplication.zip
Delete an Application
Delete a previously generated app. Can only delete an owned private application. Confirmation is required.
To delete an application with id of 256:
realmethods_cli app_delete 256
Promote an Application
Promote an owned application from private scope to public. Promotion cannot be undone. Confirmation is required.
To promote the app referenced by id=78:
realmethods_cli app_promote 78
List of Applications
app_list [options] [scope]
List previously generated applications that have been archive. Scope: public, private, community. Empty returns all.
To display all community archived applications using pretty print:
realmethods_cli app_list public --output pretty
To display all your public archived applications as json [default]:
realmethods_cli list_app public'
To display all your applications using pretty print:
realmethods_cli list_app -o pretty
To display all community applications using pretty print:
realmethods_cli list_app community -o pretty
Output the version number
Set to true or [false] to minimize output to only results with no status messages. For instance, use this to pipe JSON output.
Output usage information for the total system or for each command as follows:
realmethods_cli model_list -h
to display the help for the model_list command
View a full set of sample configurations here.