-
Notifications
You must be signed in to change notification settings - Fork 2
Default Warning logging, bounded container logs, remove Node.js implementation #49
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,4 @@ | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| .DS_Store | ||
| .idea | ||
|
|
||
| coverage | ||
| node_modules | ||
| build | ||
| public/static | ||
| .env.local | ||
| .env.development.local | ||
| .env.test.local | ||
| .env.production.local | ||
|
|
||
| src/config.ts | ||
|
|
||
| dev.sh | ||
| logs | ||
| *.log | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,86 +1,96 @@ | ||
| # [Ecency vision][ecency_vision] – API | ||
|
|
||
| ### Build instructions | ||
| The API proxy service behind [Ecency](https://ecency.com) — routes search, | ||
| auth, wallet/portfolio, and private-API traffic to the right backends with | ||
| health-aware failover across Hive RPC nodes. | ||
|
|
||
| ##### Requirements | ||
| Implemented in **C# / ASP.NET Core (.NET 10)** under [`dotnet/`](dotnet/). It | ||
| replaced the original Node/Express implementation as a verified drop-in | ||
| (byte-identical responses across a 300-case differential parity suite; the | ||
| history of that migration is in the git log and `dotnet/README.md`). The last | ||
|
Comment on lines
+7
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Align the documented parity case count. This says the suite has 300 cases, while 🤖 Prompt for AI Agents |
||
| Node build remains available as the `ecency/api:node-legacy` image tag. | ||
|
|
||
| - node ^12.0.0 | ||
| - yarn | ||
| ## Quick start | ||
|
|
||
| ##### Clone | ||
| `$ git clone https://github.com/ecency/vision-api` | ||
| Requirements: [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0) | ||
| (or just Docker). | ||
|
|
||
| `$ cd vision-api` | ||
|
|
||
| ##### Install dependencies | ||
| `$ yarn` | ||
| ```bash | ||
| git clone https://github.com/ecency/vision-api | ||
| cd vision-api/dotnet | ||
|
|
||
| ##### Edit config file or define environment variables | ||
| `$ nano src/config.ts` | ||
| dotnet build EcencyApi/EcencyApi.csproj # compile | ||
| dotnet test EcencyApi.Tests/EcencyApi.Tests.csproj # test suite | ||
|
|
||
| ##### Environment variables | ||
| API_PORT=4000 PRIVATE_API_ADDR=... dotnet run --project EcencyApi -c Release | ||
| curl http://localhost:4000/healthcheck.json | ||
| ``` | ||
|
|
||
| * `PRIVATE_API_ADDR` - private api endpoint | ||
| * `PRIVATE_API_AUTH` - private api auth | ||
| * `HIVESIGNER_SECRET` - hivesigner client secret | ||
| * `SEARCH_API_ADDR` - hivesearcher api endpoint | ||
| * `SEARCH_API_SECRET` - hivesearcher api auth token | ||
| * `BLOCKSTREAM_CLIENT_ID` - optional OAuth client identifier used to request temporary access tokens for the Blockstream Explorer Enterprise API (BTC fallback). | ||
| * `BLOCKSTREAM_CLIENT_SECRET` - optional OAuth client secret paired with the client identifier for generating Blockstream access tokens. | ||
| * `HELIUS_API_KEY` - optional Helius API key added as an extra Solana RPC fallback. | ||
| * `ETH_RPC_URLS` / `BNB_RPC_URLS` / `SOL_RPC_URLS` / `BTC_ESPLORA_URLS` - optional comma-separated endpoint lists overriding the built-in public provider pools (see `src/server/chain-providers.ts`). | ||
| Or with Docker: | ||
|
|
||
| ##### Start api in dev | ||
| `$ yarn start` | ||
| ```bash | ||
| cd dotnet | ||
| docker build -t ecency/api -f Dockerfile . | ||
| docker run -it --rm -p 4000:4000 \ | ||
| -e PRIVATE_API_ADDR=https://api.example.com \ | ||
| -e PRIVATE_API_AUTH=verysecret \ | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| ecency/api | ||
| ``` | ||
|
|
||
| ##### Pushing new code / Pull requests | ||
| ## Environment variables | ||
|
|
||
| - Make sure to branch off your changes from `main` branch. | ||
| - Make sure to run `yarn test` and add tests to your changes. | ||
| - Code on! | ||
| | variable | purpose | | ||
| |---|---| | ||
| | `API_PORT` | listen port (default `4000`) | | ||
| | `PRIVATE_API_ADDR` | private api endpoint | | ||
| | `PRIVATE_API_AUTH` | private api auth (base64-encoded JSON header object) | | ||
| | `HIVESIGNER_SECRET` | hivesigner client secret | | ||
| | `SEARCH_API_ADDR` | hivesearcher api endpoint | | ||
| | `SEARCH_API_SECRET` | hivesearcher api auth token | | ||
| | `STRIPE_INTERNAL_SECRET` | shared secret for the Stripe money endpoints (unset = they fail closed) | | ||
| | `TURNSTILE_SECRET` | Cloudflare Turnstile secret for account-create captcha | | ||
| | `CAPTCHA_MODE` | `hard` (default) or `off` (operator break-glass) | | ||
| | `BLOCKSTREAM_CLIENT_ID` / `BLOCKSTREAM_CLIENT_SECRET` | optional Blockstream Enterprise esplora auth (BTC fallback) | | ||
| | `HELIUS_API_KEY` | optional Helius API key added as an extra Solana RPC fallback | | ||
| | `ETH_RPC_URLS` / `BNB_RPC_URLS` / `SOL_RPC_URLS` / `BTC_ESPLORA_URLS` | optional comma-separated endpoint lists overriding the built-in chain provider pools | | ||
| | `Logging__LogLevel__Default` | log level (default `Warning`; set `Information` for per-request logs) | | ||
|
|
||
| ## Docker | ||
| ## Swarm | ||
|
|
||
| You can use official `ecency/api:latest` image to run Vision locally, deploy it to staging or even production environment. The simplest way is to run it with following command: | ||
| Deploy with the example stack file (which also bounds container log size): | ||
|
|
||
| ```bash | ||
| docker run -it --rm -p 3000:3000 ecency/vision:latest | ||
| cd dotnet | ||
| docker stack deploy -c docker-compose.yml vision-api | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the Swarm path documented here, Useful? React with 👍 / 👎. |
||
| ``` | ||
|
|
||
| Configure the instance using following environment variables: | ||
|
|
||
| * `PRIVATE_API_ADDR` | ||
| * `PRIVATE_API_AUTH` | ||
| * `HIVESIGNER_SECRET` | ||
| * `SEARCH_API_ADDR` | ||
| * `SEARCH_API_SECRET` | ||
| * `BLOCKSTREAM_CLIENT_ID` | ||
| * `BLOCKSTREAM_CLIENT_SECRET` | ||
| * `HELIUS_API_KEY` | ||
| * `ETH_RPC_URLS` | ||
| * `BNB_RPC_URLS` | ||
| * `SOL_RPC_URLS` | ||
| * `BTC_ESPLORA_URLS` | ||
| ## Deployment & rollback | ||
|
|
||
| CI (`.github/workflows/main.yml`) tests every PR; on merge to main it builds | ||
| the image, pushes `ecency/api:latest` + `ecency/api:sha-<commit>`, and rolls | ||
| out by immutable digest. Roll back by redeploying any previous tag: | ||
|
|
||
| ```bash | ||
| docker run -it --rm -p 3000:3000 -e PRIVATE_API_ADDR=https://api.example.com -e PRIVATE_API_AUTH=verysecretpassword ecency/api:latest | ||
| docker service update --image ecency/api:sha-<previous-commit> vision_vapi | ||
| docker service update --image ecency/api:node-legacy vision_vapi # pre-rewrite Node build | ||
|
Comment on lines
+77
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Fix the rollback service target. The stack is deployed as 🤖 Prompt for AI Agents |
||
| ``` | ||
|
|
||
| ### Swarm | ||
| ## Pushing new code / Pull requests | ||
|
|
||
| You can easily deploy a set of vision instances to your production environment, using example `docker-compose.yml` file. Docker Swarm will automatically keep it alive and load balance incoming traffic between the containers: | ||
| - Branch off your changes from the `main` branch. | ||
| - Run `dotnet test dotnet/EcencyApi.Tests/EcencyApi.Tests.csproj` and add tests | ||
| for your changes (the test suite gates every PR in CI). | ||
| - Code on! | ||
|
|
||
| ```bash | ||
| docker stack deploy -c docker-compose.yml vision-api | ||
| ``` | ||
| ## More | ||
|
|
||
| `dotnet/README.md` has the full details: architecture and layout, the Hive RPC | ||
| failover design, the differential parity harness, benchmark methodology and | ||
| results, and how to regenerate the crypto golden vectors. | ||
|
|
||
| ## Issues | ||
|
|
||
| To report a non-critical issue, please file an issue on this GitHub project. | ||
|
|
||
| If you find a security issue please report details to: security@ecency.com | ||
|
|
||
| We will evaluate the risk and make a patch available before filing the issue. | ||
|
|
||
| [//]: # 'LINKS' | ||
| [ecency_vision]: https://ecency.com | ||
| [ecency_vision]: https://github.com/ecency/vision | ||
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.