https://github.com/yearn/yearn-caching-api
🍕 Lightweight Rest API shim for yearn's SDK
https://github.com/yearn/yearn-caching-api
Last synced: over 1 year ago
JSON representation
🍕 Lightweight Rest API shim for yearn's SDK
- Host: GitHub
- URL: https://github.com/yearn/yearn-caching-api
- Owner: yearn
- Created: 2021-08-05T17:16:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-09T14:01:18.000Z (over 3 years ago)
- Last Synced: 2025-03-20T19:07:23.913Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 712 KB
- Stars: 5
- Watchers: 5
- Forks: 25
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Yearn API
Small SDK shim + Metadata endpoint for Yearn
This codebase hosts non user specific data provided by the [SDK](https://github.com/yearn/yearn-sdk) to increase the speed of providing this data as well as reducing the number of web3 calls
## Setting up GitHub Actions
The service can be deployed using GitHub actions. The service is deployed on the infrastructure described [here](https://github.com/numan/yearn-api-infra).
To set up GitHub actions, you will first need to create a AWS User with the proper IAM policy to deploy the service.
Here is the minimal policy you need:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "RegisterTaskDefinition",
"Effect": "Allow",
"Action": [
"ecs:RegisterTaskDefinition",
"ecs:DescribeTaskDefinition"
],
"Resource": "*"
},
{
"Sid": "PassRolesInTaskDefinition",
"Effect": "Allow",
"Action": [
"iam:PassRole"
],
"Resource": [
"arn:aws:iam:::role/",
"arn:aws:iam:::role/"
]
},
{
"Sid": "DeployService",
"Effect": "Allow",
"Action": [
"ecs:UpdateService",
"ecs:DescribeServices"
],
"Resource": [
"arn:aws:ecs:*::service/yearn-api-cluster/YearnAPIService"
]
},
{
"Sid": "GetAuthorizationToken",
"Effect": "Allow",
"Action": [
"ecr:GetAuthorizationToken"
],
"Resource": "*"
},
{
"Sid": "AllowPush",
"Effect": "Allow",
"Action": [
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
"ecr:BatchCheckLayerAvailability",
"ecr:PutImage",
"ecr:InitiateLayerUpload",
"ecr:UploadLayerPart",
"ecr:CompleteLayerUpload"
],
"Resource": "arn:aws:ecr:us-east-1::repository/yearn-api-repo"
}
]
}
```
Replace the following placeholders:
- `` - Your aws account id
- `` - The name of the task definition execution role. This should be automatically created when your create the [infrastructure](https://github.com/numan/yearn-api-infra)
- `` - The name of the task definition task role. This should be automatically created when you create the [infrastructure](https://github.com/numan/yearn-api-infra)
Create a new AWS user and attach the newly created policy to that user.
Create a new [GitHub environment](https://github.com/numan/yearn-api/settings/environments/new) in the repo called `production`. Add the following secrets in the new environment (use the credentials of the new user you just created):
1. AWS_ACCESS_KEY_ID
2. AWS_SECRET_ACCESS_KEY
**IMPORTANT**
Optionally, setup [environment protection rules](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#environment-protection-rules) to control who is able to deploy a new version of the app.
## Deploying a new version
To deploy, run the build and deploy workflow from the [actions](https://github.com/numan/yearn-api/actions/workflows/ecs-build-deploy.yaml) page.
## Starting
```
$ make
```
## Stopping
```
$ make down
```
## Production deployment
```
$ PROD=true make
```