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

2
[![latest version](https://img.shields.io/badge/version-0.10.1-yellow.svg)](https://github.com/appbaseio/abc/releases/latest)
A
Avi Aryan 已提交
3
[![Go Report Card](https://goreportcard.com/badge/github.com/appbaseio/abc)](https://goreportcard.com/report/github.com/appbaseio/abc)
4
[![Travis branch](https://travis-ci.org/appbaseio/abc.svg?branch=dev)]()
A
Avi Aryan 已提交
5 6
[![license](https://img.shields.io/github/license/appbaseio/abc.svg)]()

A
Avi Aryan 已提交
7 8 9

![abc banner image](https://user-images.githubusercontent.com/4047597/29240054-14e0e19a-7f7b-11e7-898b-ba6bad756b1d.png)

10
# ABC
A
Avi Aryan 已提交
11

S
Slobodan Mišković 已提交
12
ABC is a command-line tool to interact with appbase.io.
13 14
It can also serve as a swiss army knife to import data from any popular data source (Postgres, SQL, Mongo) to ElasticSearch.
This feature works with minimum configuration and is totally automatic.
A
Avi Aryan 已提交
15
In certain sources like Postgres and Mongo, you can even keep the database and ElasticSearch cluster in sync such that any change from source gets added in destination as well.
A
Avi Aryan 已提交
16 17


18
1. [Intro](#intro)
A
Avi Aryan 已提交
19 20 21
2. [Key Benefits](#key-benefits)
3. [Getting Started](#getting-started)
4. [Features](#features)
A
Avi Aryan 已提交
22 23
	1. [Appbase features](#appbase-features)
	2. [Importer features](#importer-features)
A
Avi Aryan 已提交
24
5. [Development setup](#development)
A
Avi Aryan 已提交
25 26
	1. [Local Setup](#local-setup)
	2. [Docker Setup](#docker-setup)
27
	3. [Build Variants](#build-variants)
A
Avi Aryan 已提交
28
6. [ABC Resources](#abc-resources)
S
Siddharth Kothari 已提交
29 30
	1. [Contributing to ABC](#contributing-to-abc)
	2. [Licensing](#licensing)
31 32 33 34

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

35
ABC consists of two parts.
36 37

1. Appbase module
A
Avi Aryan 已提交
38
2. Import module (closed source)
39 40 41 42 43 44 45 46

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

```sh
abc --help
```


A
Avi Aryan 已提交
47 48 49 50 51
<a name="key-benefits"></a>
## 2. Key Benefits

ABC comes with a lots of benefits over any other traditional solution to the same problem. Some of the key points are as follows -

52
- Whether your data resides in Postgres or a JSON file or MongoDB or in all three places, abc can index the data into Elasticsearch. Besides these, it also supports CSV, MySQL, SQLServer, Kafka and Elasticsearch itself to an Elasticsearch index.
A
Avi Aryan 已提交
53 54
- It can keep the Elasticsearch index synced in realtime with the data source. (Note: Currently only supported for MongoDB and Postgres)
- `abc import` is a single line CLI command that allows doing all of the above. It doesn’t require any external dependencies, takes zero lines of code configuration, and runs as an isolated process with a minimal resource footprint.
C
Craig Bovis 已提交
55
- abc also supports configurable user defined transformations for advanced uses to map data types, columns or transform the data itself before it gets indexed into Elasticsearch.
A
Avi Aryan 已提交
56 57


58

A
Avi Aryan 已提交
59
<a name="getting-started"></a>
A
Avi Aryan 已提交
60
## 3. Getting Started
61

62
ABC can be downloaded as an executable as well as through a Docker image.
63

A
Avi Aryan 已提交
64 65
#### Using Executable

A
Avi Aryan 已提交
66
Download `abc`'s executable [from releases](https://github.com/appbaseio/abc/releases/latest) for your platform and preferrably put it in a PATH directory.
A
Avi Aryan 已提交
67
The access it as -
68 69

```sh
A
Avi Aryan 已提交
70
> abc
71 72
```

A
Avi Aryan 已提交
73 74
You should see a list of commands that `abc` supports.
Try logging in for example.
75

A
Avi Aryan 已提交
76 77
#### Using Docker

78
To use the Docker image, pull it as
79 80

```sh
A
Avi Aryan 已提交
81
docker pull appbaseio/abc
82 83
```

A
Avi Aryan 已提交
84
Then create the volume to store config files across containers.
85 86

```sh
A
Avi Aryan 已提交
87
docker volume create --name abc
88 89
```

A
Avi Aryan 已提交
90
Finally you should be able to use `abc`
91 92

```sh
A
Avi Aryan 已提交
93
docker run -i --rm -v abc:/root appbaseio/abc
94 95
```

96
This command may look too long to you. We can create an alias to make things better.
97

A
Avi Aryan 已提交
98 99
```sh
# create alias
S
Siddharth Kothari 已提交
100
alias abc='docker run -i --rm -v abc:/root appbaseio/abc'
A
Avi Aryan 已提交
101 102
# run a command
abc login google
103 104 105 106
```



S
Siddharth Kothari 已提交
107
<a name="features"></a>
A
Avi Aryan 已提交
108
## 4. Features
109

110
ABC's features can be broadly categorized into 2 components.
111 112 113 114

1. Appbase features
2. Importer features

S
Siddharth Kothari 已提交
115
<a name="appbase-features"></a>
A
Avi Aryan 已提交
116
### 4.1 Appbase features
117 118 119 120

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
A
Avi Aryan 已提交
121
COMMANDS
122 123 124 125 126 127
  login     login into appbase.io
  user      get user details
  apps      display user apps
  app       display app details
  create    create app
  delete    delete app
A
Avi Aryan 已提交
128
  logout    logout session
A
Avi Aryan 已提交
129
  import    import data from various sources into appbase app
130 131
```

132
You can look over help for each of these commands using the `--help` switch.
A
Avi Aryan 已提交
133 134
Alternatively we have detailed docs for them at [docs/appbase folder](docs/appbase).

135 136 137 138 139

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

A
Avi Aryan 已提交
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
#### 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
```

S
Siddharth Kothari 已提交
162
<a name="importer-features"></a>
A
Avi Aryan 已提交
163
### 4.2 Importer features
A
Avi Aryan 已提交
164

A
Avi Aryan 已提交
165
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 已提交
166

A
Avi Aryan 已提交
167
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 已提交
168
For more details on adaptors, see [Import docs](docs/appbase/import.md).
A
Avi Aryan 已提交
169

A
Avi Aryan 已提交
170 171


172
<a name="development"></a>
A
Avi Aryan 已提交
173
## 5. Development
A
Avi Aryan 已提交
174

A
Avi Aryan 已提交
175
ABC can be built locally via the traditional `go build` or by building a Docker image.
A
Avi Aryan 已提交
176

A
Avi Aryan 已提交
177
<a name="local-setup"></a>
A
Avi Aryan 已提交
178
### 5.1 Local Setup
A
Avi Aryan 已提交
179

180
You can install ABC by building it locally and then moving the executable to anywhere you like.
A
Avi Aryan 已提交
181

182
To build it, you will require **Go 1.8** or above installed on your system.
A
Avi Aryan 已提交
183 184

```sh
S
Siddharth Kothari 已提交
185
go get github.com/appbaseio/abc # alternatively, clone the repo in the `$GOPATH/src/github.com/appbaseio/abc` dir
A
Avi Aryan 已提交
186 187
cd $GOPATH/src/github.com/appbaseio/abc
go build -tags 'oss' ./cmd/abc/...
S
Siddharth Kothari 已提交
188
./abc --help  # voila, you just built abc from source!
A
Avi Aryan 已提交
189 190 191 192
```

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

A
Avi Aryan 已提交
193
<a name="docker-setup"></a>
A
Avi Aryan 已提交
194
### 5.2 Docker Setup
A
Avi Aryan 已提交
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212

```sh
git clone https://github.com/appbaseio/abc
cd abc
docker build --build-arg ABC_BUILD=oss -t abc .
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
A
Avi Aryan 已提交
213
# setting alias for easy usage
S
Siddharth Kothari 已提交
214
alias abc='docker run -i --rm -v abc:/root abc'
A
Avi Aryan 已提交
215 216 217
# using alias now :)
abc user
abc apps
A
Avi Aryan 已提交
218 219 220
```

<a name="build-variants"></a>
A
Avi Aryan 已提交
221
### 5.3 Build Variants
A
Avi Aryan 已提交
222 223

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.
224 225
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.
A
Avi Aryan 已提交
226 227


228
#### How to know build variant from the executable?
A
Avi Aryan 已提交
229

230
If you are not sure which build of `abc` you are using, you can run `abc version` and take note of the value under the VERSION header.
A
Avi Aryan 已提交
231 232 233 234

For open source build, you will see

```
A
Avi Aryan 已提交
235 236
VERSION
  ... (oss)
A
Avi Aryan 已提交
237 238
```

239
For the proprietary builds, you will see
A
Avi Aryan 已提交
240 241

```
A
Avi Aryan 已提交
242 243
VERSION
  ... (!oss)
A
Avi Aryan 已提交
244 245 246 247
```



S
Siddharth Kothari 已提交
248
<a name="abc-resources"></a>
A
Avi Aryan 已提交
249
## 6. ABC Resources
A
Avi Aryan 已提交
250

A
Avi Aryan 已提交
251
Checkout the [docs folder](docs/) for details on some ABC commands and topics.
A
Avi Aryan 已提交
252

S
Siddharth Kothari 已提交
253
<a name="contributing-to-abc"></a>
254

A
Avi Aryan 已提交
255
### 6.1 Contributing to ABC
256

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

S
Siddharth Kothari 已提交
259
<a name="licensing"></a>
260

A
Avi Aryan 已提交
261
### 6.2 Licensing
262

263
ABC's oss variant is licensed under the Apache 2.0 License. See [LICENSE](LICENSE) for full license text. ABC's !oss (read non-oss) variant which includes the `abc import` command and bundled in the binary is free to use while in beta.