-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yaml
37 lines (35 loc) · 1.82 KB
/
buildspec.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
version: 0.2
env:
variables:
TAG: 1f9423a
REGION: eu-central-1
NODE_OPTIONS: --max-old-space-size=8192
parameter-store:
POSTGRES_URL: /marinade/solana-snapshot-manager/db/prod
RPC_URL: /marinade/rpc/triton/mainnet-beta
phases:
install:
runtime-versions:
nodejs: latest
commands:
- apt update -y && apt upgrade -y
- apt install curl sqlite3 zstd -y
- wget -qO- https://get.pnpm.io/install.sh | PNPM_VERSION=7.33.2 ENV="$HOME/.bashrc" SHELL="$(which bash)" bash - && export PATH="/root/.local/share/pnpm:$PATH"
pre_build:
on-failure: ABORT
commands:
- PNPM_HOME="${WORKDIR}/pnpm"
- mkdir /data
- ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text)
- aws ecr get-login-password --region "$REGION" | docker login --username AWS --password-stdin "$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com"
- docker pull "$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/marinade.finance/snapshot-etl:$TAG"
build:
commands:
- wget --retry-connrefused --waitretry=1 --tries=10 --timeout=30 -q -P /data http://api.mainnet-beta.solana.com/snapshot.tar.bz2
- "SLOT=$(tar -tf /data/snapshot.tar.bz2 | head -n 5 | grep ^snapshots/.*/ | cut -d/ -f2 | uniq | head -n1)"
- pnpm install --frozen-lockfile
- pnpm run cli -- filters --json-output filters.json
- docker run --rm --volume "/data:/data" --volume "$(realpath ./filters.json):/filters.json:ro" "$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/marinade.finance/snapshot-etl:$TAG" /usr/local/bin/solana-snapshot-etl /data/snapshot.tar.bz2 --sqlite-out /data/snapshot.db --sqlite-tx-bulk 2000
- ./index-db.bash /data/snapshot.db
- pnpm run cli -- parse --sqlite /data/snapshot.db --csv-output /data/snapshot.csv --slot "$SLOT --psql-output"
- pnpm run cli -- record-msol-votes