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

refactor: change default ports so it's easier to run indexer alongside MASP indexer #126

Merged
merged 1 commit into from
Oct 1, 2024
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
2 changes: 1 addition & 1 deletion .env_sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DATABASE_URL=postgres://postgres:password@postgres:5432/namada-indexer
TENDERMINT_URL=http://host.docker.internal:27657
CACHE_URL=redis://dragonfly:6379
WEBSERVER_PORT=5000
WEBSERVER_PORT=5001
DATABASE_URL_TEST=postgres://postgres:[email protected]:5432
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ cp .env_sample .env
- Install rust/cargo
- Update the `.env` values to match your setup, for example:
```env
DATABASE_URL=postgres://postgres:[email protected]:5435/namada-indexer
DATABASE_URL=postgres://postgres:[email protected]:5433/namada-indexer
TENDERMINT_URL=http://127.0.0.1:27657
CACHE_URL=redis://[email protected]:6379
PORT=5000
PORT=5001
```
- Use the `run.sh` script inside each package. Keep in mind that PoS package have to be run always while other service might not

Expand All @@ -54,6 +54,6 @@ cp .env_sample .env
Instead of fetching data from a running network, for testing porpuses it's also possible to populate the databse with some random data.

- `cargo build`
- `cd seeder && cargo run -- --database-url postgres://postgres:[email protected]:5435/namada-indexer`
- `cd seeder && cargo run -- --database-url postgres://postgres:[email protected]:5433/namada-indexer`

It's possible to only run the webserver and have access to the data via API.
6 changes: 4 additions & 2 deletions docker-compose-db.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
services:
postgres:
image: postgres:16-alpine
command: -c 'max_connections=200'
command: ["postgres", "-c", "listen_addresses=0.0.0.0", "-c", "max_connections=200", "-p", "5433"]
expose:
- "5433" # Publishes 5432 to other containers but NOT to host machine
ports:
- 5435:5432
- "5433:5433"
environment:
POSTGRES_PASSWORD: password
POSTGRES_USER: postgres
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ services:
PACKAGE: webserver
command: "./service"
ports:
- ${WEBSERVER_PORT}:5000
- ${WEBSERVER_PORT}:5001
environment:
<<: *env-vars
healthcheck:
test: curl --fail http://localhost:5000/health || exit 1
test: curl --fail http://localhost:5001/health || exit 1
interval: 15s
timeout: 10s
retries: 3
Expand Down
2 changes: 1 addition & 1 deletion swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ info:
email: [email protected]
url: https://github.com/anoma/namada-indexer
servers:
- url: http://localhost:5000
- url: http://localhost:5001
paths:
/health:
get:
Expand Down
2 changes: 1 addition & 1 deletion webserver/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub enum CargoEnv {

#[derive(clap::Parser, Clone)]
pub struct AppConfig {
#[clap(long, env, default_value = "5000")]
#[clap(long, env, default_value = "5001")]
pub port: u16,

#[clap(long, env)]
Expand Down
Loading