Skip to content
Closed
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
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.github
.git
.husky
.vscode
build
node_modules
*.log
.env
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

10 changes: 0 additions & 10 deletions .eslintrc

This file was deleted.

33 changes: 0 additions & 33 deletions .github/release-docker.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ jobs:
run: |
yarn install --immutable
yarn typecheck:ci
yarn lint:ci
yarn prettier:ci
yarn check:ci
29 changes: 21 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Release and deploy
name: Release
on:
push:
branches:
- main # change to main if needed
- next

jobs:
release:
runs-on: ubuntu-latest
Expand All @@ -27,13 +28,25 @@ jobs:
run: |
yarn install --immutable
yarn typecheck:ci
yarn lint:ci
yarn prettier:ci
yarn check:ci

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- uses: superfly/flyctl-actions/setup-flyctl@master
if: ${{ github.ref_name == 'main' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- run: flyctl deploy --strategy bluegreen --remote-only --env SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} --env LIDO_AUTH_TOKEN=${{ secrets.LIDO_AUTH_TOKEN }} --env RESOLV_AUTH_TOKEN=${{ secrets.RESOLV_AUTH_TOKEN }} --build-target app --dockerfile docker/Dockerfile.flyio --ha=false
if: ${{ github.ref_name == 'main' }}
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
with:
extra_plugins: |
@codedependant/semantic-release-docker
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
build
node_modules
.env
output.json
tmp

# Sentry Config File
.env.sentry-build-plugin
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22
24
16 changes: 6 additions & 10 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
{
"branches": [
{
"name": "main"
}
{ "name": "main" },
{ "name": "next", "channel": "next", "prerelease": "next" },
{ "name": "+([0-9])?(.{+([0-9]),x}).x" }
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"successComment": false,
"failTitle": false
}
{ "successComment": false, "failTitle": false }
],
[
"@codedependant/semantic-release-docker",
Expand All @@ -21,9 +18,8 @@
"{{#if prerelease.[0]}}{{prerelease.[0]}}{{else}}latest{{/if}}",
"{{version}}"
],
"dockerArgs": {
"PACKAGE_VERSION": "{{version}}"
},
"dockerArgs": { "PACKAGE_VERSION": "{{version}}" },
"dockerPlatform": ["linux/amd64", "linux/arm64"],
"dockerImage": "apy-server",
"dockerRegistry": "ghcr.io",
"dockerProject": "gearbox-protocol",
Expand Down
6 changes: 1 addition & 5 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"nomicfoundation.hardhat-solidity",
"dbaeumer.vscode-eslint"
]
"recommendations": ["biomejs.biome"]
}
38 changes: 31 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,40 @@
{
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "biomejs.biome"
},
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity"
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"biome.enabled": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"source.action.useSortedKeys.biome": "explicit",
"source.fixAll.biome": "explicit",
"source.fixAll.eslint": "never",
"source.organizeImports.biome": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.tabSize": 2,
"eslint.validate": ["javascript", "typescript"],
"files.eol": "\n"
"eslint.enable": false,
"files.eol": "\n",
"search.exclude": {
"**/node_modules": true,
"**/cache": true,
"**/lib": true,
"**/build": true,
"**/dist": true,
"**/forge-out": true
}
}
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM node:24.11 AS dev

ENV YARN_CACHE_FOLDER=/root/.yarn

ARG SENTRY_AUTH_TOKEN
ARG SENTRY_ORG
ARG SENTRY_PROJECT

ENV SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}
ENV SENTRY_ORG=${SENTRY_ORG}
ENV SENTRY_PROJECT=${SENTRY_PROJECT}

WORKDIR /app

COPY . .

RUN --mount=type=cache,id=yarn,target=/root/.yarn \
corepack enable \
&& yarn install --immutable \
&& yarn build

# Production npm modules

FROM node:24.11 AS prod

ENV YARN_CACHE_FOLDER=/root/.yarn

WORKDIR /app

COPY --from=dev /app/package.json /app/yarn.lock /app/.yarnrc.yml /app/
COPY --from=dev /app/build/ /app/build

RUN --mount=type=cache,id=yarn,target=/root/.yarn \
corepack enable \
&& yarn workspaces focus --all --production

# Final image

FROM gcr.io/distroless/nodejs24-debian12
ARG PACKAGE_VERSION
ENV PACKAGE_VERSION=${PACKAGE_VERSION:-0.0.0}
ENV NODE_ENV=production
LABEL org.opencontainers.image.version="${PACKAGE_VERSION}"

WORKDIR /app
COPY --from=prod /app /app
CMD ["--enable-source-maps", "/app/build/index.mjs"]
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@

for fetching the apy of different asset on diferrent protocols. For protocols Like for curve, lido, sky, pendle, defillama etc.

### Running locally
## Developing

Run `yarn start` to launch app. It will save output to `output.json` file by default. See [config](./src/core/config.ts) for env variables.

## Running as docker

```
yarn
npx ts-node main.ts
docker run --rm \
-e OUTPUT_JSON=/output/output.json \
-v "$(pwd)/tmp:/output" \
ghcr.io/gearbox-protocol/apy-server
```

### Running via github actions on fly.io
### History

- https://fly.io/docs/launch/continuous-deployment-with-github-actions/
Historically, this was a backend API deployed on fly.io and providing several endpoints:

### Deploying changes via github actions
- `/api/rewards/gear-apy`
- `/api/rewards/pools/all`
- `/api/rewards/tokens/all`

- Create a PR to the main branch.
- On merger the changes will be applied to apy-server.fly.dev
Currently, this mode is still supported, but we're transitioning to one-shot mode, that runs on schedule, and dumps all results into file that is served via CDN later
24 changes: 24 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
"extends": ["@gearbox-protocol/biome-config"],
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"includes": [
"**",
"!node_modules",
"!build",
"!output",
"!.yarn",
"!cache",
"!dist",
"!forge-out",
"!lib",
"!contracts"
],
"ignoreUnknown": true
}
}
13 changes: 0 additions & 13 deletions build.mjs

This file was deleted.

26 changes: 0 additions & 26 deletions docker/Dockerfile.flyio

This file was deleted.

Loading