Skip to content

Commit 586eba0

Browse files
authored
Abehjati/release-price-service (#251)
* npm audit fix * Update package name * Remove guardian image and use official ones * Update README * Fix config file name * Use aws public repo
1 parent 130c052 commit 586eba0

File tree

11 files changed

+111
-107
lines changed

11 files changed

+111
-107
lines changed
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build and Push Images
2+
on:
3+
push:
4+
tags:
5+
- pyth-attester-v*
6+
workflow_dispatch:
7+
inputs:
8+
dispatch_description:
9+
description: "Dispatch description"
10+
required: true
11+
type: string
12+
permissions:
13+
contents: read
14+
id-token: write
15+
jobs:
16+
p2w-attest-image:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set image tag to version of the git tag
21+
if: ${{ startsWith(github.ref, 'refs/tags/pyth-attester-v') }}
22+
run: |
23+
PREFIX="refs/tags/pyth-attester-"
24+
VERSION="${GITHUB_REF:${#PREFIX}}"
25+
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
26+
- name: Set image tag to the git commit hash
27+
if: ${{ !startsWith(github.ref, 'refs/tags/pyth-attester-v') }}
28+
run: |
29+
echo "IMAGE_TAG=${{ github.sha }}" >> "${GITHUB_ENV}"
30+
- uses: aws-actions/configure-aws-credentials@8a84b07f2009032ade05a88a28750d733cc30db1
31+
with:
32+
role-to-assume: arn:aws:iam::192824654885:role/github-actions-ecr
33+
aws-region: eu-west-2
34+
- uses: docker/login-action@v2
35+
with:
36+
registry: public.ecr.aws
37+
env:
38+
AWS_REGION: us-east-1
39+
- run: |
40+
DOCKER_BUILDKIT=1 docker build -f Dockerfile.client -t bridge-client .
41+
DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f third_party/pyth/Dockerfile.p2w-attest .
42+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
43+
env:
44+
ECR_REGISTRY: public.ecr.aws
45+
ECR_REPOSITORY: pyth-network/xc-attest

.github/workflows/image-push.yml

-47
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build and Push Images
2+
on:
3+
push:
4+
tags:
5+
- pyth-price-service-v*
6+
workflow_dispatch:
7+
inputs:
8+
dispatch_description:
9+
description: "Dispatch description"
10+
required: true
11+
type: string
12+
permissions:
13+
contents: read
14+
id-token: write
15+
jobs:
16+
price-service-image:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set image tag to version of the git tag
21+
if: ${{ startsWith(github.ref, 'refs/tags/pyth-price-service-v') }}
22+
run: |
23+
PREFIX="refs/tags/pyth-price-service-"
24+
VERSION="${GITHUB_REF:${#PREFIX}}"
25+
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
26+
- name: Set image tag to the git commit hash
27+
if: ${{ !startsWith(github.ref, 'refs/tags/pyth-price-service-v') }}
28+
run: |
29+
echo "IMAGE_TAG=${{ github.sha }}" >> "${GITHUB_ENV}"
30+
- uses: aws-actions/configure-aws-credentials@8a84b07f2009032ade05a88a28750d733cc30db1
31+
with:
32+
role-to-assume: arn:aws:iam::192824654885:role/github-actions-ecr
33+
aws-region: eu-west-2
34+
- uses: docker/login-action@v2
35+
with:
36+
registry: public.ecr.aws
37+
env:
38+
AWS_REGION: us-east-1
39+
- run: |
40+
DOCKER_BUILDKIT=1 docker build -f Dockerfile.wasm -o type=local,dest=. .
41+
DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f third_party/pyth/price-service/Dockerfile.price_service .
42+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
43+
env:
44+
ECR_REGISTRY: public.ecr.aws
45+
ECR_REPOSITORY: pyth-network/xc-server

Dockerfile.guardian

-26
This file was deleted.

Tiltfile

-6
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ local_resource(
7575
)
7676

7777

78-
docker_build(
79-
ref = "guardiand-image",
80-
context = ".",
81-
dockerfile = "Dockerfile.guardian",
82-
)
83-
8478
def build_node_yaml():
8579
node_yaml = read_yaml_stream("devnet/node.yaml")
8680

devnet/node.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ spec:
5353
path: bigtable-key.json
5454
containers:
5555
- name: guardiand
56-
image: guardiand-image
56+
image: ghcr.io/certusone/guardiand:v2.8.8.1
5757
volumeMounts:
5858
- mountPath: /run/node
5959
name: node-rundir

devnet/spy.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ spec:
3535
terminationGracePeriodSeconds: 0
3636
containers:
3737
- name: spy
38-
image: guardiand-image
38+
image: ghcr.io/certusone/guardiand:v2.8.8.1
3939
command:
4040
- /guardiand
4141
- spy
4242
- --nodeKey
43-
- /tmp/node.key
43+
- /node.key
4444
- --spyRPC
4545
- "[::]:7072"
4646
# Hardcoded devnet bootstrap (generated from deterministic key in guardiand)

third_party/pyth/price-service/README.md

+9-16
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,32 @@
11
# Pyth Price Service
22

3-
This service exposes a REST api to provide latest attestation message for a price feed id.
3+
This service exposes a REST and WS api to provide latest attestation message for a price feed id.
44

55
## Build
66

7-
To build the spy_guardian docker container:
7+
To build the pyth_price_service docker container from the repo root:
88

99
```
10-
$ docker build -f Dockerfile.spy_guardian -t spy_guardian .
11-
```
12-
13-
To build the pyth_price_service docker container:
14-
15-
```
16-
$ docker build -f Dockerfile.pyth_price_service -t pyth_price_service .
10+
$ docker build -f third_party/pyth/price-service/Dockerfile.pyth_price_service -t pyth_price_service .
1711
```
1812

1913
Run the spy_guardian docker container in TestNet:
2014

2115
```
22-
$ docker run --platform linux/amd64 -d --network=host spy_guardian \
16+
$ docker run --platform linux/amd64 -d --network=host ghcr.io/certusone/guardiand:v2.8.8.1 spy \
17+
--nodeKey /node.key --spyRPC "[::]:7073" \
2318
--bootstrap /dns4/wormhole-testnet-v2-bootstrap.certus.one/udp/8999/quic/p2p/12D3KooWBY9ty9CXLBXGQzMuqkziLntsVcyz4pk1zWaJRvJn6Mmt \
24-
--network /wormhole/testnet/2/1 \
25-
--spyRPC "[::]:7073"
19+
--network /wormhole/testnet/2/1
2620
```
2721

2822
Or run the spy_guardian docker container in MainNet:
2923
For the MainNet gossip network parameters, see https://github.com/certusone/wormhole-networks/blob/master/mainnetv2/info.md
3024

3125
```
32-
$ docker run --platform linux/amd64 -d --network=host spy_guardian \
26+
$ docker run --platform linux/amd64 -d --network=host ghcr.io/certusone/guardiand:v2.8.8.1 spy \
27+
--nodeKey /node.key --spyRPC "[::]:7073" \
3328
--bootstrap <guardianNetworkBootstrapParameterForMainNet> \
3429
--network <guardianNetworkPathForMainNet> \
35-
--spyRPC "[::]:7073"
36-
3730
```
3831

3932
Then to run the pyth_price_service docker container using a config file called
@@ -43,7 +36,7 @@ following:
4336
```
4437
$ docker run \
4538
--volume=${HOME}/pyth_price_service:/var/pyth_price_service \
46-
-e pyth_price_service_CONFIG=/var/pyth_price_service/env \
39+
-e PYTH_PRICE_SERVICE_CONFIG=/var/pyth_price_service/env \
4740
--network=host \
4841
-d \
4942
pyth_price_service

third_party/pyth/price-service/package-lock.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

third_party/pyth/price-service/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@pythnetwork/price-service",
2+
"name": "@pythnetwork/pyth-price-service",
33
"version": "1.0.0",
44
"description": "Pyth Price Service",
55
"main": "index.js",

third_party/pyth/price-service/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { RestAPI } from "./rest";
88
import { WebSocketAPI } from "./ws";
99

1010
let configFile: string = ".env";
11-
if (process.env.PYTH_RELAY_CONFIG) {
12-
configFile = process.env.PYTH_RELAY_CONFIG;
11+
if (process.env.PYTH_PRICE_SERVICE_CONFIG) {
12+
configFile = process.env.PYTH_PRICE_SERVICE_CONFIG;
1313
}
1414

1515
console.log("Loading config file [%s]", configFile);

0 commit comments

Comments
 (0)