Skip to content

Commit f9419bb

Browse files
committed
fix(service): tap-agent start script to use settings from .env variable and remove logging from indexer start script
1 parent 495a99c commit f9419bb

File tree

3 files changed

+122
-19
lines changed

3 files changed

+122
-19
lines changed

contrib/README.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Developer Setup Guide
2+
3+
This guide provides the step to set up a development workflow for the indexer-service project testing.
4+
Including how to build and deploy the required containers, and how to use hot-reload for faster dev iterations.
5+
6+
### Note
7+
8+
The current implementation leverages local-network for the common services and uses its testing configuration. We're specifically using an older [commit](https://github.com/edgeandnode/local-network/commit/ae72f1b8d57f18e7055a7fa29b873fe5bb8d9879) due to permissions issues with more recent versions, which fail when cloning the repository because of private git dependencies.
9+
10+
## Available Commands
11+
12+
We provide the following Make/Just commands to streamline your development workflow:
13+
14+
- `make setup` - Full setup of all services, dependencies and binary compilation
15+
- `make reload` - Rebuild Rust binaries and restart services after code changes
16+
- `make logs` - Watch log output from all services
17+
- `make down` - Stop all services
18+
- `make test-local` - Run integration tests against local services(Work in progress)
19+
20+
## Initial Setup
21+
22+
To get started with development:
23+
24+
1. Clone the repository
25+
2. Run the full setup to initialize all services:
26+
27+
```bash
28+
make setup
29+
```
30+
31+
This will:
32+
33+
- Clone the local-network repo if needed
34+
- Start core infrastructure services
35+
- Deploy contracts and required services
36+
- Set up and start the indexer services
37+
38+
## Development Workflow
39+
40+
After the initial setup, you can use the fast development workflow:
41+
42+
1. Make changes to the Rust code in `crates/`
43+
2. Run the reload command to rebuild and restart indexer and tap-agent services:
44+
45+
```bash
46+
make reload
47+
```
48+
49+
This workflow is much faster because:
50+
51+
- It only recompiles the Rust code
52+
- It doesn't rebuild Docker containers
53+
- It restarts only the necessary services
54+
55+
The `reload` command will automatically show the logs after restarting, so you can see if your changes are working properly.
56+
57+
## How It Works
58+
59+
The development workflow uses volume mounts to avoid rebuilding containers:
60+
61+
1. A base Docker image with all dependencies is created once
62+
2. Your code is compiled locally on your machine
63+
3. The compiled binaries are mounted into the containers
64+
4. Services are restarted with the new binaries
65+
66+
This approach avoids the time-consuming container rebuild process while still maintaining a consistent containerized environment.
67+
68+
## Viewing Logs
69+
70+
To monitor the services during development:
71+
72+
```bash
73+
make logs
74+
```
75+
76+
This will show a live stream of logs from all services, which is useful for debugging.
77+
78+
## Running Tests
79+
80+
To run integration tests against your local environment:
81+
82+
```bash
83+
make test-local
84+
```
85+
86+
This is currently a work in progress, and additional testing strategies are still being defined and implemented.
87+
88+
## Stopping Services
89+
90+
When you're done working:
91+
92+
```bash
93+
make down
94+
```
95+
96+
This will stop and remove all the containers defined in the docker-compose file.
97+
98+
## Testing Improvements
99+
100+
The current testing setup has some limitations that could be addressed in the future:
101+
102+
### Current Limitations
103+
104+
- Bash script for testing (`run-test-local.sh`) are not optimal
105+
- Limited test coverage of complex edge cases
106+
- Manual verification required for some functionality
107+
108+
## Complete End-to-End Environment
109+
110+
Note that the current test environment is a simplified version intended to emulate real-world operation. For a complete end-to-end testing environment, additional services are required but not currently deployed:
111+
112+
- `tap-escrow-manager` - Manages escrow accounts for payment channels
113+
- `subgraph-deploy` - Handles deployment of subgraphs for testing
114+
115+
These services are commented out in the setup script for simplicity but would be needed in a full production environment or complete integration testing setup.
116+
117+
### Note
118+
119+
It would be worth to keep updating local-network dependency and try to conciliate future permissions errors

contrib/indexer-service/start.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ ESCROW_DEPLOYMENT=$(curl -s "http://graph-node:8000/subgraphs/name/semiotic/tap"
4040

4141
stdbuf -oL echo "Escrow subgraph deployment ID: $ESCROW_DEPLOYMENT"
4242
stdbuf -oL echo "Using test Network subgraph deployment ID: $NETWORK_DEPLOYMENT"
43-
stdbuf -oL echo "Using test Escrow subgraph deployment ID: $ESCROW_DEPLOYMENT"
4443
stdbuf -oL echo "Using test Verifier address: $VERIFIER_ADDRESS"
4544
stdbuf -oL echo "Using test Indexer address: $RECEIVER_ADDRESS"
4645
stdbuf -oL echo "Using TAPVerifier address from contracts.json: $VERIFIER_ADDRESS"

contrib/tap-agent/start.sh

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,10 @@ set -eu
55
if [ -f /opt/.env ]; then
66
echo "Sourcing environment variables from .env file"
77
. /opt/.env
8-
else
9-
echo "WARNING: .env file not found!"
10-
# Set default values
11-
POSTGRES="5432"
12-
GRAPH_NODE_GRAPHQL="8000"
13-
GRAPH_NODE_STATUS="8030"
14-
INDEXER_SERVICE="7601"
15-
TAP_AGGREGATOR="7610"
168
fi
179

18-
# Override with test values taken from test-assets/src/lib.rs
19-
INDEXER_ADDRESS="0xd75c4dbcb215a6cf9097cfbcc70aab2596b96a9c"
20-
INDEXER_MNEMONIC="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
21-
ACCOUNT0_ADDRESS="0x9858EfFD232B4033E47d90003D41EC34EcaEda94" # TAP_SENDER address
22-
VERIFIER_ADDRESS="0x1111111111111111111111111111111111111111"
10+
# Extract TAPVerifier address from contracts.json
11+
VERIFIER_ADDRESS=$(jq -r '."1337".TAPVerifier.address' /opt/contracts.json)
2312
ALLOCATION_ID="0xfa44c72b753a66591f241c7dc04e8178c30e13af" # ALLOCATION_ID_0
2413

2514
# Wait for postgres to be ready with timeout
@@ -123,18 +112,14 @@ fi
123112

124113
echo "Escrow subgraph deployment ID: $ESCROW_DEPLOYMENT"
125114

126-
# Get verifier address from contracts.json
127-
VERIFIER_ADDRESS=$(jq -r '."1337".TAPVerifier.address' /opt/contracts.json)
128-
echo "Verifier address: $VERIFIER_ADDRESS"
129-
130115
# Copy the config template
131116
cp /opt/config/config.toml /opt/config.toml
132117

133118
# Replace the placeholders with actual values
134119
sed -i "s/NETWORK_DEPLOYMENT_PLACEHOLDER/$NETWORK_DEPLOYMENT/g" /opt/config.toml
135120
sed -i "s/ESCROW_DEPLOYMENT_PLACEHOLDER/$ESCROW_DEPLOYMENT/g" /opt/config.toml
136121
sed -i "s/VERIFIER_ADDRESS_PLACEHOLDER/$VERIFIER_ADDRESS/g" /opt/config.toml
137-
sed -i "s/INDEXER_ADDRESS_PLACEHOLDER/$INDEXER_ADDRESS/g" /opt/config.toml
122+
sed -i "s/INDEXER_ADDRESS_PLACEHOLDER/$RECEIVER_ADDRESS/g" /opt/config.toml
138123
sed -i "s/INDEXER_MNEMONIC_PLACEHOLDER/$INDEXER_MNEMONIC/g" /opt/config.toml
139124
sed -i "s/ACCOUNT0_ADDRESS_PLACEHOLDER/$ACCOUNT0_ADDRESS/g" /opt/config.toml
140125
sed -i "s/TAP_AGGREGATOR_PORT_PLACEHOLDER/$TAP_AGGREGATOR/g" /opt/config.toml

0 commit comments

Comments
 (0)