You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Used for running a local Ethereum node with `ganache-cli` for automated tests in the `Ethereum Adapter` ([adapter/src/ethereum.rs](./adapter/src/ethereum.rs), also check [scripts/ethereum.sh](./scripts/ethereum.sh))
17
+
- Docker & Docker-compose
25
18
26
19
#### Linux
27
20
@@ -30,17 +23,25 @@ Requirements:
30
23
31
24
## Sentry
32
25
33
-
`Sentry` is the REST API that the [`Validator worker`](#validator-worker) uses for storing and retrieving information.
34
-
We need two services to be able to run `Sentry`: `Postgres` and `Redis`.
26
+
`Sentry` is the REST API that the [`Validator worker`](#running-the-validator-worker)
27
+
uses for storing and retrieving information.
28
+
29
+
Two services are needed to run `Sentry`: `Postgres` and `Redis`.
30
+
31
+
The easiest way to run these services locally is by using the provided `docker-compose` file:
35
32
36
-
### Running Postgres
33
+
`docker-compose -f ../docker-compose.harness.yml up -d adex-redis adex-postgres`
34
+
35
+
If you want to run them manually without `docker-compose`:
-`$HOME/docker/volumes/postgres` - your local storage for postgres (persist the data when we remove the container)
41
-
-`POSTGRES_PASSWORD=postgres` - the password of `postgres` user
42
+
-`POSTGRES_PASSWORD=postgres` - the password of the default `postgres` user
42
43
43
-
**NOTE:** Additionally you must setup 2 databases - `sentry_leader` & `sentry_follower` in order for the provided examples bellow to work.
44
+
**NOTE:** Additionally you must setup 2 databases - `sentry_leader` & `sentry_follower` in order for the provided examples below to work. Postgres comes with an environment variable `POSTGRES_DB` that you can use to change the default `postgres` database, but there is currently no way to create multiple using the official `postgres` image.
44
45
45
46
### Running Redis
46
47
@@ -56,47 +57,60 @@ cargo run -p sentry -- --help
56
57
57
58
Starting the Sentry API in will always run migrations, this will make sure the database is always up to date with the latest migrations, before starting and exposing the web server.
58
59
59
-
In `development` ( [`ENV` environment variable](#environment-variables) ) it will seed the database as well.
60
+
By default, we use the `development`environment ( [`ENV` environment variable](#environment-variables) ) as it will also seed the database.
60
61
61
-
#### Using the `Ethereum Adapter`
62
+
#### Using the `Ethereum` adapter
62
63
63
-
The password for the Keystore file can be set using the [environment variable `KEYSTORE_PWD`](#adapter).
64
+
The password for the keystore file can be set using the [`KEYSTORE_PWD` environment variable](#adapter).
65
+
These examples use the Leader and Follower addresses for testing locally with
66
+
`ganache` and the production configuration of the validator.
64
67
65
-
- Leader
66
-
```bash
67
-
POSTGRES_DB="sentry_leader" PORT=8005 KEYSTORE_PWD=adexvalidator cargo run -p sentry -- \
For full list, check out [primitives/src/util/tests/prep_db.rs#L29-L43](./primitives/src/util/tests/prep_db.rs#L29-L43)
@@ -106,114 +120,119 @@ For full list, check out [primitives/src/util/tests/prep_db.rs#L29-L43](./primit
106
120
-`ENV` - `production` or `development`; *default*: `development` - passing this env. variable will use the default configuration paths - [`docs/config/dev.toml`](./docs/config/dev.toml) (for `development`) or [`docs/config/prod.toml`](./docs/config/prod.toml) (for `production`). Otherwise you can pass your own configuration file path to the binary (check `cargo run -p sentry --help` for more information). In `development` it will make sure Sentry to seed the database.
107
121
-`PORT` - *default*: `8005` - The local port that Sentry API will be accessible at
108
122
-`IP_ADDR` - *default*: `0.0.0.0` - the IP address that the API should be listening to
109
-
- `ANALYTICS_RECORDER` - accepts any non-zero value - whether or not to start the `Analytics recorder` that will track analytics stats for payout events (`IMPRESSION`&`CLICK`)
123
+
110
124
##### Adapter
111
-
- `KEYSTORE_PWD` - Password for the `Keystore file`, only available when using `Ethereum Adapter` (`--adapter ethereum`)
125
+
-`KEYSTORE_PWD` - Password for the `Keystore file`, only available when using `Ethereum` adapter (`--adapter ethereum`)
- `ENV`: `production` or `development`(*default* ) - passing this env. variable will use the default configuration paths - [`docs/config/dev.toml`](./docs/config/dev.toml) (for `development`) or [`docs/config/prod.toml`](./docs/config/prod.toml) (for `production`). Otherwise you can pass your own configuration file path to the binary (check `cargo run -p sentry --help`for more information). In `development` it will make sure Sentry to seed the database.
202
+
-`ENV` - `production` or `development`-*default*: `development` - passing this env. variable will use the default configuration paths - [`docs/config/dev.toml`](./docs/config/dev.toml) (for `development`) or [`docs/config/prod.toml`](./docs/config/prod.toml) (for `production`). Otherwise you can pass your own configuration file path to the binary (check `cargo run -p sentry --help` for more information). In `development` it will make sure that Sentry seeds the database.
189
203
-`PORT` - The local port that Sentry API will accessible at
190
204
191
205
##### Adapter
206
+
192
207
-`KEYSTORE_PWD` - Password for the `Keystore file`, only available when using `Ethereum Adapter` (`--adapter ethereum`)
193
208
194
209
## Development environment
195
210
196
-
We use [`cargo-make`](https://github.com/sagiegurari/cargo-make#overview) for running automated checks (tests, builds, formatting, code linting, etc.) and building the project locally
197
-
as well as on our Continuous Integration (CI). For a complete list of out-of-the-box commands you can check
We use [`cargo-make`][cargo-make overview] for running automated checks
212
+
(tests, builds, formatting, code linting, etc.) and building the project locally
213
+
as well as on our Continuous Integration (CI).
214
+
215
+
For a complete list of out-of-the-box commands you can check out the [`Predefined Makefiles`](https://github.com/sagiegurari/cargo-make#usage-predefined-makefiles)
216
+
while locally defined commands can be found in the `Makefiles.toml` in each crate directory.
199
217
200
218
### Local development
201
219
202
-
Locally it's enough to ensure that the default development command is executing successfully:
220
+
It's enough to ensure that the default development command is executing successfully:
203
221
204
222
```bash
205
223
cargo make
206
224
```
207
225
208
-
It will run `rustfmt` for you as well as `clippy` (it will fail on warnings) and it will run all the tests thanks to `cargo` (doc tests, unit tests, integration tests, etc.).
226
+
It will format your code using `rustfmt` and will perform `clippy` checks (it will fail on warnings).
227
+
Thanks to `cargo` it will run all the tests (doc tests, unit tests, integration tests, etc.).
228
+
229
+
Using the provided `docker-compose.harness.yml` setup [`cargo-make`][cargo-make overview] will run
230
+
all the required services for the specific crate/application before executing the tests.
209
231
210
-
This will also run the [Automated tests](#automated-tests), so you must have `Redis` & `Postgres` running.
This requires [`cargo-make`](https://github.com/sagiegurari/cargo-make#overview) and since we have integration tests that require `Redis` ([see `Running Redis`](#running-redis)) & `Postgres` (see [`Running Postgres`](#running-postgres)), you need to be running those in order to run the automated tests:
215
235
216
-
`cargo make test`
236
+
### License
217
237
218
-
You can relate to the [`Makefile.stable.toml`](https://github.com/sagiegurari/cargo-make/blob/master/src/lib/Makefile.stable.toml)
219
-
for more commands and cargo-make as a whole.
238
+
This project is licensed under the [AGPL-3.0 license](./LICENSE)
0 commit comments