UNPKG

8.53 kBMarkdownView Raw
1[![Build Status](https://travis-ci.org/apigee-127/a127.svg?branch=master)](https://travis-ci.org/apigee-127/a127)
2
3# a127 reference
4
5This is the installation guide and command reference for `a127`, the command-line interface for Apigee 127.
6
7* Prerequisites
8* Installation
9* Commands
10
11# Prerequisites
12
13If you choose to install Apigee-127 using npm you will need npm version 1.3 or higher. You will also need [Node.js](http://nodejs.org/download/) version 0.10.24 or higher.
14
15# Installation
16
17You can install `apigee-127` either through npm or by cloning and linking the code from GitHub. This document covers the installation details for installing from npm.
18
19## Installation from npm
20
21The `apigee-127` module and its dependencies are designed for Node.js and is available through npm using the following command:
22
23### Linux / Mac from a Terminal Window:
24```bash
25$ sudo npm install -g apigee-127
26```
27
28> NOTE: The npm installation requires permission to create a folder in the ~/.a127 directory. When installing apigee-127 you may need to add the flag --unsafe-perm to the install command. For example:
29 ```bash
30 $sudo npm install -g apigee-127 --unsafe-perm
31 ```
32
33> NOTE: `sudo` may be required with the `-g` option which places the `a127` command-line commands in you PATH. If you do not use `-g`, then you need to add the `apigee-127/bin `directory to your PATH manually.
34>
35> Typically, the `-g` option places modules in: `/usr/local/lib/node_modules/apigee-127` on *nix-based machines.
36
37
38### Windows, from a Command Prompt
39
40```
41npm install -g apigee-127
42```
43
44## Location of files
45
46Apigee-127 places most of its files that it depends on at a global level in `~/.a127`. This includes an `accounts` file that has details about the configured accounts and an optional `usergrid` directory if you choose to download and use Usergrid through the `a127` command line.
47
48## Dependencies
49
50For a list of dependencies and Node.js modules that are relevant to an Apigee-127 project, see [Apigee-127 modules](https://github.com/apigee-127/a127-documentation/wiki/Apigee-127-modules)
51
52# Command reference
53
54* project
55* account
56* usergrid
57* config
58* wiki
59
60## <a name="a127-project"></a>project
61
62Create and manage Apigee 127 projects on your local machine.
63
64`$ a127 project [options] [command]`
65
66**Examples:**
67
68`$ a127 project create`
69
70`$ a127 project start`
71
72`$ a127 project deploy`
73
74To print a list of valid options for a command:
75
76`$ a127 project [command] -h`
77
78**Commands:**
79
80* **create** - Creates a new Apigee 127 skeleton project populated with files from GitHub. See also "New Apigee 127 project structure" below.
81
82* **start** - Runs the main Node.js project file, app.js. The server automatically restarts when you make changes to the project.
83```bash
84 Options:
85 -h, --help output usage information
86 -d, --debug start in debug mode
87 -m, --mock start in mock mode
88 -o, --open open in browser
89 -a, --account <account> use the specified account for configuration
90 -d, --debug [port] start in remote debug mode
91 -b, --debug-brk [port] start in remote debug mode, wait for debugger connect
92```
93* **edit** - Opens the Swagger API editor.
94* **deploy** - Deploys the project to the currently configured cloud platform account.
95```bash
96 Options:
97 -h, --help output usage information
98 -a, --account [account] use specified account
99 -i, --import-only import project to provider, but don't deploy (Apigee only)
100 -n, --name [name] override deployment name
101 -m, --main [main] override deployment main file
102 -b, --base [path] override deployment base path (default is /projectName)
103```
104
105>Note: When you deploy your project to Apigee Edge, Node.js modules are installed or updated automatically for you on Edge. The command does not upload any files from your local `node_modules` directory.
106
107
108* **undeploy** - Undeploys the project from the currently configured cloud platform account.
109```bash
110 Options:
111 -h, --help output usage information
112 -a, --account [account] use specified account
113 -n, --name [name] override deployment name
114```
115
116## <a name="a127-account"></a>account
117
118Create and manage deployment provider accounts. Deployment providers are cloud-based platforms where you can deploy your Apigee 127 project.
119
120**Note:** Currently, the only option is deploying to Apigee Edge. Other providers will be added in the future.
121
122`$ a127 account [-options] [command] {account_name}`
123
124**Example:**
125
126`$ a127 account create myaccount`
127
128To print a list of valid options for a command:
129
130`a127 account [command] -h`
131
132**Commands:**
133
134* **create** - Creates a deployment account on a specified provider. Follow the command line prompts. The deploy command deploys your project to this provider account. Account information for each account that you configure is stored by default in `~/.a127/accounts`. The default provider is `apigee`.
135
136```bash
137 -h, --help output usage information
138 -p, --provider [provider] name of provider
139 -b, --baseuri [baseuri] base uri
140 -o, --organization [organization] organization
141 -u, --username [username] username
142 -w, --password [password] password
143 -e, --environment [environment] environment
144 -v, --virtualhosts [virtualhosts] virtual hosts -- by default "default,secure" is set, giving both http and https support. For http only, set this to default. For https only, set to https.
145```
146Example:
147
148```bash
149 $ a127 account create myaccount
150 [?] Provider? apigee
151 [?] Do you have an account? Yes
152 [?] Organization? jdoe
153 [?] User Id? jdoe@apigee.com
154 [?] Password? *********
155 [?] Environment? test
156```
157* **delete** - Deletes the specified account. Information for the account is removed from `~/.a127/accounts`.
158```bash
159 $ a127 account delete myaccount
160```
161* **update** - Updates the specified account. Follow the command line prompts.
162* **show** - Shows information about the specified account. If you do not specify an account name, you will see information for the current account.
163* **list|ls** - Lists the deployment accounts. The current account is identified with "+".
164* **select** - Makes the specified account the current account.
165
166 `$ a127 account select myaccount`
167
168* **providers** - Lists the available deployment providers. Currently, `apigee` is the only available provider. More will be added in the future.
169* **deployments** - Lists all all projects that are deployed to the current provider account.
170
171```bash
172 Options:
173
174 -h, --help output usage information
175 -l, --long long format (includes URIs)
176```
177
178* **setValue** -- Sets a value on the account.
179
180* **deleteValue** -- Deletes a value from the account.
181
182
183## <a name="a127-usergrid"></a>usergrid
184
185Manage an [Apache Usergrid](http://usergrid.incubator.apache.org/) service on your local machine. Usergrid is an open-source BaaS solution based on RESTful APIs.
186
187`$ a127 usergrid [options] [command]`
188
189Examples:
190
191`$ a127 usergrid start`
192
193`$ a127 usergrid portal`
194
195`$ a127 usergrid stop`
196
197To print a list of valid options for a command:
198
199`$ a127 usergrid [command] -h`
200
201**Commands:**
202
203* **start** - Starts a local instance of the Apache Usergrid service.
204* **stop** - Stops the running Usergrid service.
205
206 Note: If you are unsure if Usergrid is running, hit localhost:8080. If you get a "Page Not Found" error, Usergrid is not running. In that case, try stopping and then starting Usergrid using `a127 usergrid stop` and `a127 usergrid start`.
207
208* **download** - Downloads Apache Usergrid to your machine.
209* **portal** - Opens the Usergrid portal. Use the portal to manage Usergrid projects, create data sets, manage app security, and more. The default login credentials are test/test.
210
211 Note: You must download Usergrid before you can open the portal. Or, you can execute `a127 usergrid portal --download`.
212
213* **pid** - Print the pid of the currently running Usergrid service.
214* **tail** - Prints the tail of your local Usergrid service log.
215
216## config
217
218Prints config information for the Apigee 127 project.
219
220`$ a127 config`
221
222## <a name="a127-wiki"></a>wiki
223
224Opens the Apigee-127 documentation wiki in your default browser. The wiki is hosted on GitHub with the [apigee-127/a127-documentation](https://github.com/apigee-127/a127-documentation) project.