|
| 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 |
0 commit comments