Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localledger merge #1036

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ idb/postgres/internal/schema/setup_postgres_sql.go: idb/postgres/internal/schema
cd idb/postgres/internal/schema && go generate

idb/mocks/IndexerDb.go: idb/idb.go
go install github.com/vektra/mockery/.../
cd idb && mockery -name=IndexerDb
go install github.com/vektra/mockery/[email protected]
cd idb && mockery --name=IndexerDb

# check that all packages (except tests) compile
check: go-algorand
Expand Down
57 changes: 33 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ Settings can be provided from the command line, a configuration file, or an envi
| default-balances-limit | | default-balances-limit | INDEXER_DEFAULT_BALANCES_LIMIT |
| max-applications-limit | | max-applications-limit | INDEXER_MAX_APPLICATIONS_LIMIT |
| default-applications-limit | | default-applications-limit | INDEXER_DEFAULT_APPLICATIONS_LIMIT |
| data-dir | i | data | INDEXER_DATA |
| data-dir | i | data-dir | INDEXER_DATA |

## Command line

Expand All @@ -205,33 +205,23 @@ The command line arguments always take priority over the config file and environ
~$ ./algorand-indexer daemon --pidfile /var/lib/algorand/algorand-indexer.pid --algod /var/lib/algorand --postgres "host=mydb.mycloud.com user=postgres password=password dbname=mainnet"`
```

## Configuration file
Default values are placed in the configuration file. They can be overridden with environment variables and command line arguments.
## Data Directory

The configuration file must named **indexer**, **indexer.yml**, or **indexer.yaml**. The filepath may be set on the CLI using `--configfile` or `-c`.
When the filepath is not provided on the CLI, it must also be in the correct location. Only one configuration file is loaded, the path is searched in the following order:
* `./` (current working directory)
* `$HOME`
* `$HOME/.algorand-indexer`
* `$HOME/.config/algorand-indexer`
* `/etc/algorand-indexer/`
The Indexer data directory is the location where the Indexer can store and/or load data needed for runtime operation and configuration.

Here is an example **indexer.yml** file:
```
postgres-connection-string: "host=mydb.mycloud.com user=postgres password=password dbname=mainnet"
pidfile: "/var/lib/algorand/algorand-indexer.pid"
algod-data-dir: "/var/lib/algorand"
```
**It is a required argument for Indexer daemon operation. Supply it to the Indexer via the `--data-dir` flag.**

If it is in the current working directory along with the indexer command we can start the indexer daemon with:
```
~$ ./algorand-indexer daemon
```

If it is not in the current working directory along with the indexer command we can start the indexer daemon with:
```
~$ ./algorand-indexer daemon -c <full-file-location>/indexer.yml
```
### Auto-Loading Configuration

The Indexer will scan the data directory at startup and load certain configuration files if they are present. The files are as follows:

- `indexer.yml` - Indexer Configuration File
- `api_config.yml` - API Parameter Enable/Disable Configuration File
-
**NOTE:** It is not allowed to supply both the command line flag AND have an auto-loading configuration file in the data directory. Doing so will result in an error.

To see an example of how to use the data directory to load a configuration file check out the [Disabling Parameters Guide](docs/DisablingParametersGuide.md).

## Example environment variable

Expand All @@ -245,6 +235,25 @@ The same indexer configuration from earlier can be made in bash with the followi
~$ ./algorand-indexer daemon
```


## Configuration file
Default values are placed in the configuration file. They can be overridden with environment variables and command line arguments.

The configuration file must named **indexer.yml** and placed in the data directory (see above). The filepath may be set on the CLI using `--configfile` or `-c` but this functionality is deprecated.

Here is an example **indexer.yml** file:
```
postgres-connection-string: "host=mydb.mycloud.com user=postgres password=password dbname=mainnet"
pidfile: "/var/lib/algorand/algorand-indexer.pid"
algod-data-dir: "/var/lib/algorand"
```

Place this file in the data directory (`/tmp/data-dir` in this example) and supply it to the Indexer daemon:
```
~$ ./algorand-indexer daemon --data-dir /tmp/data-dir
```


# Systemd

`/lib/systemd/system/algorand-indexer.service` can be partially overridden by creating `/etc/systemd/system/algorand-indexer.service.d/local.conf`. The most common things to override will be the command line and pidfile. The overriding local.conf file might be this:
Expand Down
Loading