Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish images from main branch #3

Merged
merged 27 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 25 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
name: Build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'master'
- '**'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'master'
- '*.*.*'

jobs:
build:
name: Build
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
DOCKER_REGISTRY: ghcr.io
DOCKER_IMAGE_NAME: ${{ github.repository }}

steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
with:
install: true

- name: Log in to the registry
uses: docker/login-action@v1
Expand All @@ -31,19 +36,25 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Indexer image tags & labels
- name: Set up metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=ref,event=branch
type=ref,event=tag

- name: Indexer image build & push
uses: docker/build-push-action@v2
- name: Publish nightly image
uses: docker/build-push-action@v3
with:
context: tezos_domains
file: tezos_domains/deploy/Dockerfile
context: api/tzprofiles
file: api/tzprofiles/deploy/Dockerfile
platforms: linux/amd64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
For convenience the retrieval function of the SDK is exposed as an API
([service/](service)).

And for performances, an indexer ([tzprofiles_indexer/](indexer)) stores the retrieved
And for performances, an indexer ([tzprofiles/](indexer)) stores the retrieved
claims for every profile deployed.

You can deploy both using the [docker-compose file](docker-compose.yml).
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*

# Add metadata and build files
!tzprofiles_indexer
!tzprofiles
!pyproject.toml
!pdm.lock
!README.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!*/

# Add metadata and build files
!tzprofiles_indexer
!tzprofiles
!.gitignore
!.dockerignore
!py.typed
Expand Down
4 changes: 2 additions & 2 deletions api/tzprofiles_indexer/README.md → api/tzprofiles/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tzprofiles_indexer
# tzprofiles

Tezos Profiles (TZP) is a web application that helps users regain control
DipDup indexer for Tezos Profiles

## Installation

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ hasura:

sentry:
dsn: ${SENTRY_DSN:-""}
environment: ${SENTRY_ENVIRONMENT:-compose}
environment: ${SENTRY_ENVIRONMENT:-""}

prometheus:
host: 0.0.0.0

logging: ${LOGLEVEL:-INFO}
5 changes: 5 additions & 0 deletions api/tzprofiles/configs/dipdup.sqlite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
database:
kind: sqlite
path: ${SQLITE_PATH:-/tmp/tzprofiles.sqlite}

logging: ${LOGLEVEL:-INFO}
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
database:
kind: postgres
host: tzprofiles_indexer_db
host: ${POSTGRES_HOST:-tzprofiles_db}
port: 5432
user: ${POSTGRES_USER:-dipdup}
password: ${POSTGRES_PASSWORD}
database: ${POSTGRES_DB:-dipdup}

hasura:
url: http://tzprofiles_indexer_hasura:8080
url: http://${HASURA_HOST:-tzprofiles_hasura}:8080
admin_secret: ${HASURA_SECRET}
allow_aggregations: false
camel_case: true

sentry:
dsn: ${SENTRY_DSN:-""}
environment: ${SENTRY_ENVIRONMENT:-swarm}
environment: ${SENTRY_ENVIRONMENT:-""}

prometheus:
host: 0.0.0.0
host: 0.0.0.0

logging: ${LOGLEVEL:-INFO}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ spec_version: 2.0
replay:
dipdup_version: 7
template: demo_blank
package: tzprofiles_indexer
package: tzprofiles
version: 0.0.1
description: Tezos Profiles (TZP) is a web application that helps users regain control
description: DipDup indexer for Tezos Profiles
license: Apache 2.0
name:
name: Spruce Systems, Inc.
email:
postgresql_image: postgres:15
hasura_image: hasura/graphql-engine:v2.30.0
postgres_image: postgres:15
postgres_data_path: /var/lib/postgresql/data
hasura_image: hasura/graphql-engine:latest
line_length: 120
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
#
HASURA_HOST=hasura
HASURA_SECRET=
LOGLEVEL=INFO
POSTGRES_DB=dipdup
POSTGRES_HOST=db
POSTGRES_PASSWORD=
POSTGRES_USER=dipdup
SENTRY_DSN=""
SENTRY_ENVIRONMENT=compose
SENTRY_ENVIRONMENT=""
File renamed without changes.
9 changes: 9 additions & 0 deletions api/tzprofiles/deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM dipdup/dipdup:7
# FROM ghcr.io/dipdup-io/dipdup:7
# FROM ghcr.io/dipdup-io/dipdup:next

COPY --chown=dipdup pyproject.toml README.md .
RUN pip install .

COPY --chown=dipdup . tzprofiles
WORKDIR tzprofiles
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: tzprofiles_indexer
version: "3.8"
name: tzprofiles

services:
dipdup:
Expand All @@ -12,7 +13,7 @@ services:
- 46339
- 9000
volumes:
- sqlite:${SQLITE_PATH:-/tmp/tzprofiles_indexer.sqlite}
- sqlite:${SQLITE_PATH:-/tmp/tzprofiles.sqlite}

volumes:
sqlite:
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: tzprofiles_indexer
version: "3.8"
name: tzprofiles

services:
dipdup:
Expand All @@ -9,7 +10,7 @@ services:
command: ["-c", "dipdup.yaml", "-c", "configs/dipdup.swarm.yaml", "run"]
env_file: .env
networks:
- dipdup-private
- internal
- prometheus-private
deploy:
mode: replicated
Expand All @@ -32,7 +33,7 @@ services:
volumes:
- db:/var/lib/postgresql/data
env_file: .env
environment:
environment:
- POSTGRES_USER=dipdup
- POSTGRES_DB=dipdup
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
Expand All @@ -42,19 +43,19 @@ services:
timeout: 5s
retries: 5
networks:
- dipdup-private
- internal
deploy:
mode: replicated
replicas: 1
placement: *placement
logging: *logging

hasura:
image: hasura/graphql-engine:v2.30.0
image: hasura/graphql-engine:latest
depends_on:
- db
environment:
- HASURA_GRAPHQL_DATABASE_URL=postgres://dipdup:${POSTGRES_PASSWORD}@tzprofiles_indexer_db:5432/dipdup
- HASURA_GRAPHQL_DATABASE_URL=postgres://dipdup:${POSTGRES_PASSWORD}@tzprofiles_db:5432/dipdup
- HASURA_GRAPHQL_ADMIN_SECRET=${HASURA_SECRET}
- HASURA_GRAPHQL_ENABLE_CONSOLE=true
- HASURA_GRAPHQL_DEV_MODE=false
Expand All @@ -63,7 +64,7 @@ services:
- HASURA_GRAPHQL_UNAUTHORIZED_ROLE=user
- HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES=true
networks:
- dipdup-private
- internal
- traefik-public
deploy:
mode: replicated
Expand All @@ -84,7 +85,7 @@ volumes:
db:

networks:
dipdup-private:
internal:
traefik-public:
external: true
prometheus-private:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: tzprofiles_indexer
version: "3.8"
name: tzprofiles

services:
dipdup:
Expand Down Expand Up @@ -34,7 +35,7 @@ services:
retries: 5

hasura:
image: hasura/graphql-engine:v2.30.0
image: hasura/graphql-engine:latest
ports:
- 8080
depends_on:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# This env file was generated automatically by DipDup. Do not edit it!
# Create a copy with .env extension, fill it with your values and run DipDup with `--env-file` option.
#
SENTRY_DSN=""
SENTRY_ENVIRONMENT=dev
SQLITE_PATH=/tmp/tzprofiles_indexer.sqlite
LOGLEVEL=INFO
SQLITE_PATH=/tmp/tzprofiles.sqlite
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# This env file was generated automatically by DipDup. Do not edit it!
# Create a copy with .env extension, fill it with your values and run DipDup with `--env-file` option.
#
HASURA_HOST=tzprofiles_hasura
HASURA_SECRET=
LOGLEVEL=INFO
POSTGRES_DB=dipdup
POSTGRES_HOST=tzprofiles_db
POSTGRES_PASSWORD=
POSTGRES_USER=dipdup
SENTRY_DSN=""
SENTRY_ENVIRONMENT=swarm
SENTRY_ENVIRONMENT=""
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
spec_version: 2.0
package: tzprofiles_indexer
package: tzprofiles

contracts:
tzprofile:
Expand Down Expand Up @@ -57,5 +57,5 @@ jobs:

advanced:
early_realtime: False
postpone_jobs: False
postpone_jobs: True
merge_subscriptions: True
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
from tenacity import stop_after_attempt
from tenacity import wait_exponential

from tzprofiles_indexer.models import TZProfile
from tzprofiles_indexer.types.tzprofile import tezos_storage as storage
from tzprofiles_indexer.types.tzprofile_old import tezos_storage as old_storage
from tzprofiles.models import TZProfile
from tzprofiles.types.tzprofile import tezos_storage as storage
from tzprofiles.types.tzprofile_old import tezos_storage as old_storage

Claim = storage.Claim | old_storage.Claim
ClaimList = list[storage.Claim] | list[old_storage.Claim]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from dipdup.context import HandlerContext
from dipdup.models.tezos_tzkt import TzktOrigination

from tzprofiles_indexer import models
from tzprofiles_indexer.handlers import save_claims
from tzprofiles_indexer.types.tzprofile.tezos_storage import TzprofileStorage
from tzprofiles_indexer.types.tzprofile_old.tezos_storage import TzprofileOldStorage
from tzprofiles import models
from tzprofiles.handlers import save_claims
from tzprofiles.types.tzprofile.tezos_storage import TzprofileStorage
from tzprofiles.types.tzprofile_old.tezos_storage import TzprofileOldStorage


async def on_origination(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from dipdup.context import HandlerContext
from dipdup.models.tezos_tzkt import TzktTransaction

import tzprofiles_indexer.models as models
from tzprofiles_indexer.handlers import save_claims
from tzprofiles_indexer.types.tzprofile.tezos_parameters.default import DefaultParameter
from tzprofiles_indexer.types.tzprofile.tezos_storage import TzprofileStorage
import tzprofiles.models as models
from tzprofiles.handlers import save_claims
from tzprofiles.types.tzprofile.tezos_parameters.default import DefaultParameter
from tzprofiles.types.tzprofile.tezos_storage import TzprofileStorage


async def on_update(
Expand Down
File renamed without changes.
File renamed without changes.
Loading