-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
449 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: "Docker build setup" | ||
description: | | ||
Runs an opinionated and unified docker build setup action. It does the following: | ||
* Logs in to docker image registries GCP GAR | ||
inputs: | ||
# GCP auth | ||
GCP_WORKLOAD_IDENTITY_PROVIDER: | ||
required: true | ||
description: "GCP Workload Identity provider" | ||
GCP_SERVICE_ACCOUNT_EMAIL: | ||
required: true | ||
description: "GCP service account email" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- id: auth | ||
name: "Authenticate to Google Cloud" | ||
uses: "google-github-actions/auth@dac4e13deb3640f22e3ffe758fd3f95e6e89f712" # pin@v0 | ||
with: | ||
create_credentials_file: false | ||
token_format: "access_token" | ||
access_token_lifetime: 5400 # setting this to 1.5h since sometimes docker builds (special performance builds etc.) take that long. Default is 1h. | ||
workload_identity_provider: ${{ inputs.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
service_account: ${{ inputs.GCP_SERVICE_ACCOUNT_EMAIL }} | ||
|
||
- name: Login to US multi-region Google Artifact Registry | ||
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # pin@v2 | ||
with: | ||
registry: us-docker.pkg.dev | ||
username: oauth2accesstoken | ||
password: ${{ steps.auth.outputs.access_token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: "Build Docker Images" | ||
on: | ||
# Allow us to run this specific workflow without a PR | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
# cancel redundant builds | ||
concurrency: | ||
# for push and workflow_dispatch events we use `github.sha` in the concurrency group and don't really cancel each other out/limit concurrency | ||
# for pull_request events newer jobs cancel earlier jobs to save on CI etc. | ||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.sha || github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
GIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | ||
|
||
permissions: | ||
contents: read | ||
id-token: write #required for GCP Workload Identity federation which we use to login into Google Artifact Registry | ||
|
||
jobs: | ||
Build: | ||
strategy: | ||
matrix: | ||
example: [python] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/docker-setup | ||
with: | ||
GCP_SERVICE_ACCOUNT_EMAIL: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }} | ||
GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
- run: ./scripts/build-and-push-images.sh ${{ matrix.example }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"folders": [ | ||
{ | ||
"name": "ROOT", | ||
"path": "../" | ||
}, | ||
{ | ||
"name": "typescript", | ||
"path": "../typescript" | ||
}, | ||
{ | ||
"name": "python", | ||
"path": "../python" | ||
} | ||
], | ||
"settings": { | ||
"python.formatting.provider": "black", | ||
"typescript.preferences.importModuleSpecifierEnding": "js", | ||
"[typescript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} | ||
}, | ||
"extensions": { | ||
"recommendations": ["ms-python.python", "esbenp.prettier-vscode"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
chain-id: 1 | ||
indexer-endpoint: "34.30.218.153:50051" | ||
x-aptos-data-authorization: "YOUR_TOKEN" | ||
starting-version: 10000 | ||
tablename: "YOUR_TABLENAME" | ||
cursor-filename: "cursor.txt" | ||
chain_id: 1 | ||
indexer_endpoint: "34.30.218.153:50051" | ||
indexer_api_key: "<INDEXER_API_KEY>" | ||
starting_version: 10000 | ||
db_connection_uri: "postgresql://<your_connection_uri_to_postgres>" | ||
cursor_filename: "cursor.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import yaml | ||
from pydantic import BaseSettings | ||
from pydantic.env_settings import SettingsSourceCallable | ||
|
||
|
||
class Config(BaseSettings): | ||
chain_id: int | ||
indexer_endpoint: str | ||
indexer_api_key: str | ||
starting_version: int | ||
db_connection_uri: str | ||
cursor_filename: str | ||
|
||
class Config: | ||
# change order of priority of settings sources such that environment variables take precedence over config file settings | ||
# inspired by https://docs.pydantic.dev/usage/settings/#changing-priority | ||
@classmethod | ||
def customise_sources( | ||
cls, | ||
init_settings: SettingsSourceCallable, | ||
env_settings: SettingsSourceCallable, | ||
file_secret_settings: SettingsSourceCallable, | ||
) -> tuple[SettingsSourceCallable, ...]: | ||
return env_settings, init_settings, file_secret_settings | ||
|
||
@classmethod | ||
def from_yaml_file(cls, path: str): | ||
with open(path, "r") as file: | ||
config = yaml.safe_load(file) | ||
return cls(**config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: '3' | ||
services: | ||
index-processor: | ||
build: . | ||
environment: | ||
DB_CONNECTION_URI: postgresql://postgres:postgres@db:5432/postgres | ||
depends_on: | ||
- db | ||
volumes: | ||
- ../config.yaml:/app/config/config.yaml | ||
db: | ||
image: postgres:15.2 | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
volumes: | ||
- db-data:/var/lib/postgresql/data | ||
volumes: | ||
db-data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.