Skip to content

Commit

Permalink
Merge pull request #105 from perpetual-protocol/develop
Browse files Browse the repository at this point in the history
Deploy to production
  • Loading branch information
lnxrp committed Dec 7, 2023
2 parents 354d8ba + d945051 commit 93af41f
Show file tree
Hide file tree
Showing 8 changed files with 4,402 additions and 3,744 deletions.
42 changes: 1 addition & 41 deletions .github/workflows/deploy-optimism-goerli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,48 +26,8 @@ jobs:
npx graph auth --product hosted-service ${{ secrets.THE_GRAPH_ACCESS_TOKEN }}
npm run deploy-the-graph:optimism-goerli
deploy-self-hosted-cluster:
runs-on: ubuntu-latest
environment: optimism-goerli
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "16"

- name: Install
run: npm ci

- name: Configure AWS Credentials - aws eks update-kubeconfig
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: "${{ secrets.AWS_SUBGRAPH_DEPLOYER_ACCESS_KEY_ID }}"
aws-secret-access-key: "${{ secrets.AWS_SUBGRAPH_DEPLOYER_SECRET_ACCESS_KEY }}"
aws-region: ap-northeast-1

- name: Setup kubeconfig
env:
AWS_REGION: ap-northeast-1
AWS_EKS_CLUSTER: perp-staging
run: |
aws eks --region $AWS_REGION update-kubeconfig --name $AWS_EKS_CLUSTER
# https://github.com/aws/aws-cli/issues/6920
- name: Fix invalid apiVersion client.authentication.k8s.io/v1alpha1
uses: azure/setup-kubectl@v2.0
with:
version: "v1.23.6"

- name: Deploy to Self-hosted Graph Node
run: |
kubectl port-forward service/graph-node 8020:8020 &
npm run deploy-self-hosted:optimism-goerli
notify:
needs: [deploy-the-graph, deploy-self-hosted-cluster]
needs: [deploy-the-graph]
runs-on: ubuntu-latest
steps:
- name: Send message to Discord
Expand Down
42 changes: 1 addition & 41 deletions .github/workflows/deploy-optimism.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,6 @@ jobs:
npx graph auth --product hosted-service ${{ secrets.THE_GRAPH_ACCESS_TOKEN }}
npm run deploy-the-graph:optimism
deploy-self-hosted:
runs-on: ubuntu-latest
environment: optimism
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "16"

- name: Install
run: npm ci

- name: Configure AWS Credentials - aws eks update-kubeconfig
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: "${{ secrets.AWS_SUBGRAPH_DEPLOYER_ACCESS_KEY_ID }}"
aws-secret-access-key: "${{ secrets.AWS_SUBGRAPH_DEPLOYER_SECRET_ACCESS_KEY }}"
aws-region: ap-southeast-1

- name: Setup kubeconfig
env:
AWS_REGION: ap-southeast-1
AWS_EKS_CLUSTER: perp-production
run: |
aws eks --region $AWS_REGION update-kubeconfig --name $AWS_EKS_CLUSTER
# https://github.com/aws/aws-cli/issues/6920
- name: Fix invalid apiVersion client.authentication.k8s.io/v1alpha1
uses: azure/setup-kubectl@v2.0
with:
version: "v1.23.6"

- name: Deploy to Self-hosted Graph Node Cluster
run: |
kubectl port-forward service/graph-node-cluster-index 8020:8020 &
npm run deploy-self-hosted:optimism
deploy-satsuma:
runs-on: ubuntu-latest
environment: optimism
Expand All @@ -88,7 +48,7 @@ jobs:
SATSUMA_DEPLOY_KEY: "${{ secrets.SATSUMA_DEPLOY_KEY }}"

notify:
needs: [deploy-the-graph, deploy-self-hosted, deploy-satsuma]
needs: [deploy-the-graph, deploy-satsuma]
runs-on: ubuntu-latest
steps:
- name: Send message to Discord
Expand Down
21 changes: 1 addition & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,6 @@
- WebSocket: `wss://api.thegraph.com/subgraphs/name/perpetual-protocol/perpetual-v2-optimism-goerli`
- Healthcheck: `https://api.thegraph.com/index-node/graphql`

### Self-hosted Graph Node

- Optimism
- Playground: https://thegraph-api.perp.fi/subgraphs/name/perpetual-protocol/perpetual-v2-optimism/graphql
- HTTP: `https://thegraph-api.perp.fi/subgraphs/name/perpetual-protocol/perpetual-v2-optimism`
- WebSocket: `wss://thegraph-ws.perp.fi/subgraphs/name/perpetual-protocol/perpetual-v2-optimism`
- Healthcheck: `https://thegraph-hc.perp.fi/graphql`
- Optimism Goerli
- Playground: https://subgraph-api.perp.fi/subgraphs/name/perpetual-protocol/perpetual-v2-optimism-goerli/graphql
- HTTP: `https://subgraph-api.perp.fi/subgraphs/name/perpetual-protocol/perpetual-v2-optimism-goerli`
- WebSocket: `wss://subgraph-ws.perp.fi/subgraphs/name/perpetual-protocol/perpetual-v2-optimism-goerli`
- Healthcheck: `https://subgraph-hc.perp.fi/graphql`

### Satsuma

- Optimism
Expand Down Expand Up @@ -66,20 +53,14 @@ npx graph auth --product hosted-service <THE_GRAPH_ACCESS_TOKEN>
# create a subgraph in the graph dashboard first (need GitHub admin permission)
npm run deploy-the-graph:optimism

# deploy to Self-hosted Graph Node
kubectl port-forward service/graph-node-cluster-index 8020:8020
npx graph create perpetual-protocol/perpetual-v2-optimism --node http://127.0.0.1:8020
npm run deploy-self-hosted:optimism

# deploy to Satsuma
npm run codegen-satsuma:optimism
npx graph deploy perpetual-v2-optimism --version-label $(git rev-parse --short HEAD) --node https://app.satsuma.xyz/api/subgraphs/deploy --ipfs https://api.thegraph.com/ipfs/ --deploy-key <SATSUMA_DEPLOY_KEY>
```

### Post Deploy

Wait until all three subgraphs are synced, then click "Promote to Live" button on the newly deployed version to
enable it on Satsuma dashboard. Otherwise, clients might get different results from Satsuma, The Graph, and self-hosted.
Wait until all three subgraphs are synced, then click "Promote to Live" button on the newly deployed version to enable it on Satsuma dashboard. Otherwise, clients might get different results from The Graph and Satsuma.

---

Expand Down
5 changes: 5 additions & 0 deletions configs/optimism.json
Original file line number Diff line number Diff line change
Expand Up @@ -520,5 +520,10 @@
},
"network": "optimism",
"version": "git+ssh://git@github.com:perpetual-protocol/perp-curie-periphery-contract.git#a8fb8b9d6ee5836b0e652e6789c3c2469155fb2f"
},
"graft": {
"base": "QmVyf7ovnBMjNJioxg2Z8h22JHSgrEZd58wCwqLhV9AdG8",
"baseForSatsuma": "QmVyf7ovnBMjNJioxg2Z8h22JHSgrEZd58wCwqLhV9AdG8",
"block": 113120599
}
}
Loading

0 comments on commit 93af41f

Please sign in to comment.