README.md 6.7 KB
Newer Older
A
Avi Aryan 已提交
1

2
# ABC
A
Avi Aryan 已提交
3

4 5
1. [Intro](#intro)
2. [Installation](#installation)
A
Avi Aryan 已提交
6 7
	1. [Basic Installation](#basic-installation)
	2. [Using Docker](#using-docker)
8 9 10 11
3. [Build Variants](#build-variants)
4. [Features](#features)
	1. [Appbase features](#appbase-features)
	2. [Importer features](#importer-features)
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50


<a name="intro"></a>
## 1. Intro

ABC is a command-line client for appbase.io with nifty features to do data sync from on store to another.

It consists of two parts. 

1. Appbase module
2. Import module

To get the list of all commands supported by ABC, use -

```sh
abc --help
```


<a name="installation"></a>
## 2. Installation

ABC can be installed and used via the traditional `go build` or using a Docker image.


<a name="basic-installation"></a>
### 2.1 Basic installation

You can install ABC by building it locally and then moving the executable to anywhere you like. 

To build it, you require **Go 1.8** insalled on your system. 

```sh
go get github.com/appbaseio-confidential/abc
cd $GOPATH/src/github.com/appbaseio-confidential/abc
go build -tags 'oss' ./cmd/abc/...
./abc --help
```

51 52 53
Note - You might be wondering what is the tag `oss` doing there. That's covered in the section [Build Variants](#build-variants).


54 55 56 57 58 59
<a name="using-docker"></a>
### 2.2 Using Docker

```sh
git clone https://github.com/appbaseio-confidential/abc
cd abc
60
docker build --build-arg ABC_BUILD=oss -t abc .
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
docker volume create --name abc
```

Volume is used to store abc config files across containers.
Now `abc` can be ran through Docker like in the following example which starts google login.  

```sh
docker run -i --rm -v abc:/root abc login google
```

Some more examples

```sh
docker run -i --rm -v abc:/root abc user
docker run -i --rm -v abc:/root abc apps
```


79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
<a name="build-variants"></a>
## 3. Build Variants

The ABC project you see in this repository is not the complete project. Appbase.io works on a proprietary version of ABC using this project as the base.
Hence we use the tag 'oss' to specify that this is an open source build. 
If you are curious, we use the tag '!oss' to make our private builds. 


#### How to know build variant from the executable? 

If you are not sure which build of `abc` you are using, you can run `abc --help` and take note of the value under the version header. 

For open source build, you will see

```
VERSION
  oss
```

For the proprietary builds, you will see 

```
VERSION
  proprietary
```


106
<a name="features"></a>
107
## 4. Features
108 109 110 111 112 113 114

ABC's features can be broadly categorized into 2 components. 

1. Appbase features
2. Importer features


115 116
<a name="appbase-features"></a>
### 4.1 Appbase features
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135

Appbase features allows you to control your appbase.io account using ABC. You can see them under the *Appbase* heading in the list of commands.

```sh
APPBASE
  login     login into appbase.io
  user      get user details
  apps      display user apps
  app       display app details
  create    create app
  delete    delete app
```

You can look over help for each of these commands using the `--help` switch. 

```sh
abc login --help
```

A
Avi Aryan 已提交
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
#### Example

```sh
# display all commands
abc
# login into system
abc login google
# get user details
abc user
# get list of apps
abc apps
# get details of an app
abc app MyAppName
# delete that app
abc delete MyAppName
# create it again
abc create MyAppName
# view its metrics. It will be 0 as it is a new app
# here we are using AppID. We can use AppName too.
abc app -m 2489
```

158

159 160
<a name="importer-features"></a>
### 4.2 Importer features
A
Avi Aryan 已提交
161

A
Avi Aryan 已提交
162
ABC allows the user to configure a number of data adaptors as sources or sinks. These can be databases, files or other resources. Data is read from the sources, converted into a message format, and then send down to the sink where the message is converted into a writable format for its destination. The user can also create data transformations in JavaScript which can sit between the source and sink and manipulate or filter the message flow.
A
Avi Aryan 已提交
163

A
Avi Aryan 已提交
164
Adaptors may be able to track changes as they happen in source data. This "tail" capability allows a ABC to stay running and keep the sinks in sync.
A
Avi Aryan 已提交
165

A
Avi Aryan 已提交
166 167
ABC also contains support for being able to resume operations after being stopped. 
The feature is disabled by default and can be enabled as the following:
A
Avi Aryan 已提交
168 169 170 171

```
source = mongodb({"uri": "mongo://localhost:27017/source_db"})
sink = mongodb({"uri": "mongo://localhost:27017/sink_db"})
A
Avi Aryan 已提交
172
t.Config({"log_dir":"/data/ABC"})
A
Avi Aryan 已提交
173 174 175 176 177 178 179 180 181 182 183 184 185
  .Source("source", source)
  .Save("sink", sink)
```

When using the above pipeline, all messages will be appended to a commit log and 
successful processing of a message is handled via consumer/sink offset tracking.

Below is a list of each adaptor and its support of the feature:

```
+---------------+-------------+----------------+
|    adaptor    | read resume | write tracking |
+---------------+-------------+----------------+
186
| elasticsearch |             |       X        | 
A
Avi Aryan 已提交
187
|     file      |             |       X        | 
188 189
|    mongodb    |      X      |       X        |
|     mssql     |             |       N/A      | 
A
Avi Aryan 已提交
190 191 192 193 194 195
|  postgresql   |             |       X        | 
|   rabbitmq    |      X      |                | 
|   rethinkdb   |             |       X        | 
+---------------+-------------+----------------+
```

196
#### Adaptors
A
Avi Aryan 已提交
197 198 199 200 201 202

Each adaptor has its own README page with details on configuration and capabilities.

* [elasticsearch](./adaptor/elasticsearch)
* [file](./adaptor/file)
* [mongodb](./adaptor/mongodb)
203
* mssql
A
Avi Aryan 已提交
204 205 206 207
* [postgresql](./adaptor/postgres)
* [rabbitmq](./adaptor/rabbitmq)
* [rethinkdb](./adaptor/rethinkdb)

208

209
#### Native Functions
A
Avi Aryan 已提交
210 211 212

Each native function can be used as part of a `Transform` step in the pipeline.

A
Avi Aryan 已提交
213 214 215 216 217 218 219
* [goja](docs/transforms/goja.md)
* [omit](docs/transforms/omit.md)
* [otto](docs/transforms/otto.md)
* [pick](docs/transforms/pick.md)
* [pretty](docs/transforms/pretty.md)
* [rename](docs/transforms/rename.md)
* [skip](docs/transforms/skip.md)
A
Avi Aryan 已提交
220

221
#### Commands
A
Avi Aryan 已提交
222

223
The importer module has the following commands.
A
Avi Aryan 已提交
224 225

```
226 227 228 229 230 231
run       run pipeline loaded from a file
test      display the compiled nodes without starting a pipeline
about     show information about available adaptors
init      initialize a config and pipeline file based from provided adaptors
xlog      manage the commit log
offset    manage the offset for sinks
A
Avi Aryan 已提交
232 233
```

234
Details have been covered in the Wiki page : [Importer Commands](https://github.com/appbaseio-confidential/abc/wiki/Importer-Commands). 
A
Avi Aryan 已提交
235 236


237
## ABC Resources
A
Avi Aryan 已提交
238

A
Avi Aryan 已提交
239
Checkout [ABC Wiki](https://github.com/appbaseio-confidential/abc/wiki) for details on some ABC commands and topics.
A
Avi Aryan 已提交
240 241


242 243
## Contributing to ABC

A
Avi Aryan 已提交
244
Want to help out with ABC? Great! There are instructions to get you started [here](CONTRIBUTING.md).
A
Avi Aryan 已提交
245 246


247 248 249 250
## Licensing

ABC is licensed under the New BSD License. See [LICENSE](LICENSE) for full license text.