Skip to content

Commit

Permalink
Merge branch 'release/2.12.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Algo-devops-service committed Jun 22, 2022
2 parents 7285fb1 + 5ef6459 commit d4a7e91
Show file tree
Hide file tree
Showing 40 changed files with 1,414 additions and 2,489 deletions.
20 changes: 6 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: 2.1
orbs:
go: circleci/go@1.7.0
slack: circleci/slack@4.7.1
codecov: codecov/codecov@3.1.1

parameters:
ubuntu_image:
Expand All @@ -17,7 +18,7 @@ workflows:
name: test_with_go_<< matrix.go_version >>
matrix: &go-version-matrix
parameters:
go_version: ["1.14.7", "1.15.15"]
go_version: ["1.17.9"]

circleci_build_and_test_nightly:
triggers:
Expand All @@ -32,7 +33,7 @@ workflows:
context: slack-secrets
matrix: &go-version-matrix
parameters:
go_version: ["1.14.7", "1.15.15"]
go_version: ["1.17.9"]
- indexer_vs_algod_nightly:
name: nightly_test_indexer_vs_algod
context: slack-secrets
Expand All @@ -49,7 +50,7 @@ jobs:
version: << parameters.go_version >>
- install_dependencies
- run_tests
- upload_coverage
- codecov/upload
test_nightly:
machine:
image: << pipeline.parameters.ubuntu_image >>
Expand All @@ -61,7 +62,7 @@ jobs:
version: << parameters.go_version >>
- install_dependencies
- run_tests
- upload_coverage
- codecov/upload
- slack/notify: &slack-fail-event
event: fail
custom: |
Expand Down Expand Up @@ -120,7 +121,7 @@ commands:

- run:
name: Install golint
command: go get -u golang.org/x/lint/golint
command: go install golang.org/x/lint/golint@latest

run_tests:
steps:
Expand All @@ -142,12 +143,3 @@ commands:
run_indexer_vs_algod:
steps:
- run: make indexer-v-algod

upload_coverage:
description: Collect coverage reports and upload them
steps:
- run:
name: Upload Coverage Reports
no_output_timeout: 10m
command: |
scripts/upload_coverage.sh || true
14 changes: 14 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
codecov:
require_ci_to_pass: no
branch: develop

coverage:
precision: 2
round: down
range: "70...100"
status:
patch:
default:
target: auto
threshold: 0%
project: off
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.11.1
2.12.0
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ VERSION := $(shell $(SRCPATH)/mule/scripts/compute_build_number.sh)
OS_TYPE ?= $(shell $(SRCPATH)/mule/scripts/ostype.sh)
ARCH ?= $(shell $(SRCPATH)/mule/scripts/archtype.sh)
PKG_DIR = $(SRCPATH)/tmp/node_pkgs/$(OS_TYPE)/$(ARCH)/$(VERSION)
ifeq ($(OS_TYPE), darwin)
ifeq ($(ARCH), arm64)
export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib
endif
endif

# TODO: ensure any additions here are mirrored in misc/release.py
GOLDFLAGS += -X github.com/algorand/indexer/version.Hash=$(shell git log -n 1 --pretty="%H")
Expand All @@ -28,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 get github.com/vektra/mockery/.../
cd idb && mockery -name=IndexerDb
go install github.com/vektra/mockery/v2@v2.12.3
cd idb && mockery --name=IndexerDb

# check that all packages (except tests) compile
check: go-algorand
Expand Down
56 changes: 33 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +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-dir | INDEXER_DATA |

## Command line

Expand All @@ -204,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 @@ -244,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
3 changes: 1 addition & 2 deletions api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ indexer.oas3.yml: .3tmp.json
curl -s -X POST "https://converter.swagger.io/api/convert" -H "accept: application/json" -H "Content-Type: application/json" -d @./indexer.oas2.json -o .3tmp.json

oapi-codegen: .PHONY
# This weirdness is to workaround incompatible dependencies in our go.mod
cd /tmp && GO111MODULE=on go get "github.com/algorand/oapi-codegen/cmd/oapi-codegen@v1.3.5-algorand5"
go install "github.com/algorand/oapi-codegen/...@v1.3.7"

.PHONY:
Loading

0 comments on commit d4a7e91

Please sign in to comment.