Skip to content

Commit 4af922e

Browse files
committed
Update README
1 parent 75fc168 commit 4af922e

File tree

1 file changed

+47
-52
lines changed

1 file changed

+47
-52
lines changed

README.md

+47-52
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
# RapidPro Indexer
1+
# Indexer
22

33
[![Build Status](https://github.com/nyaruka/rp-indexer/workflows/CI/badge.svg)](https://github.com/nyaruka/rp-indexer/actions?query=workflow%3ACI)
44
[![codecov](https://codecov.io/gh/nyaruka/rp-indexer/branch/main/graph/badge.svg)](https://codecov.io/gh/nyaruka/rp-indexer)
55
[![Go Report Card](https://goreportcard.com/badge/github.com/nyaruka/rp-indexer)](https://goreportcard.com/report/github.com/nyaruka/rp-indexer)
66

7-
Simple service for indexing RapidPro contacts into ElasticSearch.
7+
Service for indexing RapidPro/TextIt contacts into Elasticsearch.
88

9-
# Deploying
9+
## Deploying
1010

11-
As Indexer is a Go application, it compiles to a binary and that binary along with the config file is all
11+
As it is a Go application, it compiles to a binary and that binary along with the config file is all
1212
you need to run it on your server. You can find bundles for each platform in the
13-
[releases directory](https://github.com/nyaruka/rp-indexer/releases). You should only run a single indexer
13+
[releases directory](https://github.com/nyaruka/rp-indexer/releases). You should only run a single
1414
instance for a deployment.
1515

16-
Indexer can run in two modes:
16+
It can run in two modes:
1717

1818
1) the default mode, which simply queries the ElasticSearch database, finds the most recently
19-
modified contact, then on a schedule queries the `contacts_contact` table on the RapidPro
19+
modified contact, then on a schedule queries the `contacts_contact` table in the
2020
database for contacts to add or delete. You should run this as a long running service which
21-
constantly keeps ElasticSearch in sync with your RapidPro contacts.
21+
constantly keeps ElasticSearch in sync with your contacts.
2222

2323
2) a rebuild mode, started with `--rebuild`. This builds a brand new index from nothing, querying
2424
all contacts on RapidPro. Once complete, this switches out the alias for the contact index
2525
with the newly build index. This can be run on a cron (in parallel with the mode above) to rebuild
2626
your index occasionally to get rid of bloat.
2727

28-
# Configuration
28+
## Configuration
2929

30-
Indexer uses a tiered configuration system, each option takes precendence over the ones above it:
30+
The service uses a tiered configuration system, each option takes precendence over the ones above it:
3131

3232
1. The configuration file
3333
2. Environment variables starting with `INDEXER_`
3434
3. Command line parameters
3535

36-
We recommend running Indexer with no changes to the configuration and no parameters, using only
36+
We recommend running it with no changes to the configuration and no parameters, using only
3737
environment variables to configure it. You can use `% rp-indexer --help` to see a list of the
3838
environment variables and parameters and for more details on each option.
3939

40-
## RapidPro Configuration
40+
### RapidPro
4141

4242
For use with RapidPro, you will want to configure these settings:
4343

@@ -48,9 +48,42 @@ Recommended settings for error reporting:
4848

4949
* `INDEXER_SENTRY_DSN`: The DSN to use when logging errors to Sentry
5050

51-
# Development
51+
### Reference
5252

53-
Once you've checked out the code, you can build Indexer with:
53+
These are the configuration options that can be provided as parameters or environment variables. If using environment
54+
varibles, convert to uppercase, replace dashes with underscores and prefix the name with `INDEXER_`, e.g. `-log-level`
55+
becomes `INDEXER_LOG_LEVEL`.
56+
57+
```
58+
-cleanup
59+
whether to remove old indexes after a rebuild
60+
-db string
61+
the connection string for our database (default "postgres://localhost/rapidpro?sslmode=disable")
62+
-debug-conf
63+
print where config values are coming from
64+
-elastic-url string
65+
the url for our elastic search instance (default "http://localhost:9200")
66+
-help
67+
print usage information
68+
-index string
69+
the alias for our contact index (default "contacts")
70+
-librato-username
71+
the Librato username for metrics reporting
72+
-librato-token
73+
the Librato token for metrics reporting
74+
-log-level string
75+
the log level, one of error, warn, info, debug (default "info")
76+
-poll int
77+
the number of seconds to wait between checking for updated contacts (default 5)
78+
-rebuild
79+
whether to rebuild the index, swapping it when complete, then exiting (default false)
80+
-sentry-dsn string
81+
the sentry configuration to log errors to, if any
82+
```
83+
84+
## Development
85+
86+
Once you've checked out the code, you can build the service with:
5487

5588
```
5689
go build github.com/nyaruka/rp-indexer/cmd/rp-indexer
@@ -69,41 +102,3 @@ To run all of the tests:
69102
```
70103
go test ./... -p=1
71104
```
72-
73-
# Usage
74-
75-
```
76-
Indexes RapidPro contacts to ElasticSearch
77-
78-
Usage of indexer:
79-
-cleanup
80-
whether to remove old indexes after a rebuild
81-
-db string
82-
the connection string for our database (default "postgres://localhost/rapidpro?sslmode=disable")
83-
-debug-conf
84-
print where config values are coming from
85-
-elastic-url string
86-
the url for our elastic search instance (default "http://localhost:9200")
87-
-help
88-
print usage information
89-
-index string
90-
the alias for our contact index (default "contacts")
91-
-log-level string
92-
the log level, one of error, warn, info, debug (default "info")
93-
-poll int
94-
the number of seconds to wait between checking for updated contacts (default 5)
95-
-rebuild
96-
whether to rebuild the index, swapping it when complete, then exiting (default false)
97-
-sentry-dsn string
98-
the sentry configuration to log errors to, if any
99-
100-
Environment variables:
101-
INDEXER_CLEANUP - bool
102-
INDEXER_DB - string
103-
INDEXER_ELASTIC_URL - string
104-
INDEXER_INDEX - string
105-
INDEXER_LOG_LEVEL - string
106-
INDEXER_POLL - int
107-
INDEXER_REBUILD - bool
108-
INDEXER_SENTRY_DSN - string
109-
```

0 commit comments

Comments
 (0)