Compare commits

...
Author SHA1 Message Date
Michael Shaw 4f2925f426 incomplete tag 2022-09-19 14:33:36 -04:00
Michael Shaw d4de80ecda incomplete tag 2022-09-19 14:28:03 -04:00
Michael Shaw 0c80bd65e4 need to tag image before push 2022-09-19 14:14:10 -04:00
Michael Shaw 884dc19b5b fat fingered copy paste 2022-09-19 13:59:37 -04:00
Michael Shaw 50de2af907 need to publish to git.vdb.to by tag 2022-09-19 13:51:11 -04:00
Michael Shaw 3053bbff7d build was still tagging as vulcanize 2022-09-19 12:25:19 -04:00
Michael Shaw 8834335a2a publish to git.vdb.to 2022-09-19 10:56:45 -04:00
Michael Shaw 8d72232a37 cerc github refactor 2022-09-14 01:04:54 -04:00
prathamesh0 be345e0733 Use a specific tag while building migration tool (#101) 2022-07-22 11:44:07 +05:30
prathamesh0 b59505eab2 Add block hash to primary keys in transactions, receipts and logs tables (#100)
* Add block hash to primary keys in transactions, receipts and logs tables

* Add block hash in postgraphile triggers for transactions, receipts and logs tables

* Make indexes on transaction cid and mh_key non-unique
2022-07-07 16:21:06 +05:30
Abdul Rabbani 4e948c58ce Merge pull request #93 from vulcanize/feature/update-go
Update the go-version in build container
2022-06-20 09:28:10 -04:00
Abdul Rabbani 65b7bee7a6 Update the go-version in build container 2022-06-20 09:23:39 -04:00
nabarun 48eb594ea9 Fix docker-compose for publishing image (#91)
* Fix docker-compose for publishing image

* Add docker build in pr workflow
2022-06-14 13:03:22 +05:30
14 changed files with 71 additions and 69 deletions
+7
View File
@@ -3,6 +3,13 @@ name: Docker Build
on: [pull_request]
jobs:
build:
name: Run docker build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run docker build
run: make docker-build
test:
# Add a dummy job to avoid failing GitHub CI checks.
# Other checks to be added later.
+33 -25
View File
@@ -8,34 +8,42 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get the version
id: vars
run: echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7})
- name: Run docker build
run: make docker-build
- name: Tag docker image
run: docker tag vulcanize/ipld-eth-db docker.pkg.github.com/vulcanize/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.sha}}
- name: Docker Login
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin
- name: Docker Push
run: docker push docker.pkg.github.com/vulcanize/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.sha}}
push_to_registries:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
needs: build
steps:
- name: Get the version
id: vars
run: |
echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7})
echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/})
- name: Docker Login to Github Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin
- name: Docker Pull
run: docker pull docker.pkg.github.com/vulcanize/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.sha}}
- name: Docker Login to Docker Registry
run: echo ${{ secrets.VULCANIZEJENKINS_PAT }} | docker login -u vulcanizejenkins --password-stdin
- name: Run docker build
run: make docker-build
- name: Tag docker image
run: docker tag docker.pkg.github.com/vulcanize/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.sha}} vulcanize/ipld-eth-db:${{steps.vars.outputs.tag}}
- name: Docker Push to Docker Hub
run: docker push vulcanize/ipld-eth-db:${{steps.vars.outputs.tag}}
run: docker tag cerc-io/ipld-eth-db git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.sha}}
- name: Tag docker image
run: docker tag git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.sha}} git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.tag}}
- name: Docker Login
run: echo ${{ secrets.GITEA_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin
- name: Docker Push
run: docker push git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.sha}}
- name: Docker Push with TAG to git.vdb.to
run: docker push git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.tag}}
#push_to_registries:
# name: Push Docker image to Docker Hub
# runs-on: ubuntu-latest
# needs: build
# steps:
# - name: Get the version
# id: vars
# run: |
# echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7})
# echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/})
# - name: Docker Login to Github Registry
# run: echo ${{ secrets.GITEA_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin
# - name: Docker Pull
# run: docker pull git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.sha}}
# - name: Docker Push to Docker Hub
# run: docker push cerc-io/ipld-eth-db:${{steps.vars.outputs.tag}}
# - name: Docker Login to Docker Registry
# run: echo ${{ secrets.VULCANIZEJENKINS_PAT }} | docker login -u cerccicd --password-stdin
# - name: Tag docker image
# run: docker tag git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:${{steps.vars.outputs.sha}} cerc-io/ipld-eth-db:${{steps.vars.outputs.tag}}
# - name: Docker Push to Docker Hub
# run: docker push cerc-io/ipld-eth-db:${{steps.vars.outputs.tag}}
+2 -1
View File
@@ -1 +1,2 @@
.idea/
.idea/
.vscode
+6 -5
View File
@@ -1,12 +1,13 @@
FROM golang:1.16-alpine as builder
FROM golang:1.18-alpine as builder
RUN apk --update --no-cache add make git g++ linux-headers
ADD . /go/src/github.com/vulcanize/ipld-eth-db
ADD . /go/src/github.com/cerc-io/ipld-eth-db
# Build migration tool
WORKDIR /go/src/github.com/pressly
RUN git clone https://github.com/pressly/goose.git
ARG GOOSE_VER="v3.6.1"
RUN git clone --depth 1 --branch ${GOOSE_VER} https://github.com/pressly/goose.git
WORKDIR /go/src/github.com/pressly/goose/cmd/goose
RUN GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -tags='no_sqlite3' -o goose .
@@ -15,9 +16,9 @@ FROM alpine
WORKDIR /app
COPY --from=builder /go/src/github.com/vulcanize/ipld-eth-db/scripts/startup_script.sh .
COPY --from=builder /go/src/github.com/cerc-io/ipld-eth-db/scripts/startup_script.sh .
COPY --from=builder /go/src/github.com/pressly/goose/cmd/goose/goose goose
COPY --from=builder /go/src/github.com/vulcanize/ipld-eth-db/db/migrations migrations/vulcanizedb
COPY --from=builder /go/src/github.com/cerc-io/ipld-eth-db/db/migrations migrations/vulcanizedb
ENTRYPOINT ["/app/startup_script.sh"]
+5 -5
View File
@@ -115,12 +115,12 @@ import:
## Build docker image with schema
.PHONY: docker-build
docker-build:
docker-compose build
docker-compose -f docker-compose.test.yml build
## Build docker image for migration
.PHONY: docker-concise-migration-build
docker-concise-migration-build:
docker build -t vulcanize/concise-migration-build -f ./db/Dockerfile .
# ## Build docker image for migration
# .PHONY: docker-concise-migration-build
# docker-concise-migration-build:
# docker build -t vulcanize/concise-migration-build -f ./db/Dockerfile .
.PHONY: test-migrations
test-migrations: $(GOOSE)
+1 -1
View File
@@ -31,5 +31,5 @@ Schemas and utils for IPLD ETH Postgres database
* Run:
```
docker-compose -f docker-compose.test.yml up
docker-compose -f docker-compose.test.yml up --build
```
-23
View File
@@ -1,23 +0,0 @@
FROM golang:1.16-alpine as builder
RUN apk --update --no-cache add make git g++ linux-headers
ADD . /go/src/github.com/vulcanize/ipld-eth-db
# Build migration tool
WORKDIR /go/src/github.com/pressly
RUN git clone https://github.com/pressly/goose.git
WORKDIR /go/src/github.com/pressly/goose/cmd/goose
RUN GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -tags='no_sqlite3' -o goose .
# app container
FROM alpine
WORKDIR /app
COPY --from=builder /go/src/github.com/vulcanize/ipld-eth-db/scripts/startup_script.sh .
COPY --from=builder /go/src/github.com/pressly/goose/cmd/goose/goose goose
COPY --from=builder /go/src/github.com/vulcanize/ipld-eth-db/db/migrations migrations/vulcanizedb
ENTRYPOINT ["/app/startup_script.sh"]
@@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS eth.transaction_cids (
tx_data BYTEA,
tx_type INTEGER,
value NUMERIC,
PRIMARY KEY (tx_hash, block_number)
PRIMARY KEY (tx_hash, header_id, block_number)
);
-- +goose Down
@@ -1,6 +1,7 @@
-- +goose Up
CREATE TABLE IF NOT EXISTS eth.receipt_cids (
block_number BIGINT NOT NULL,
header_id VARCHAR(66) NOT NULL,
tx_id VARCHAR(66) NOT NULL,
leaf_cid TEXT NOT NULL,
contract VARCHAR(66),
@@ -9,7 +10,7 @@ CREATE TABLE IF NOT EXISTS eth.receipt_cids (
post_state VARCHAR(66),
post_status INTEGER,
log_root VARCHAR(66),
PRIMARY KEY (tx_id, block_number)
PRIMARY KEY (tx_id, header_id, block_number)
);
-- +goose Down
@@ -1,6 +1,7 @@
-- +goose Up
CREATE TABLE IF NOT EXISTS eth.log_cids (
block_number BIGINT NOT NULL,
header_id VARCHAR(66) NOT NULL,
leaf_cid TEXT NOT NULL,
leaf_mh_key TEXT NOT NULL,
rct_id VARCHAR(66) NOT NULL,
@@ -11,7 +12,7 @@ CREATE TABLE IF NOT EXISTS eth.log_cids (
topic2 VARCHAR(66),
topic3 VARCHAR(66),
log_data BYTEA,
PRIMARY KEY (rct_id, index, block_number)
PRIMARY KEY (rct_id, index, header_id, block_number)
);
-- +goose Down
+6 -2
View File
@@ -14,13 +14,14 @@ CREATE INDEX uncle_header_id_index ON eth.uncle_cids USING btree (header_id);
-- transaction indexes
CREATE INDEX tx_block_number_index ON eth.transaction_cids USING brin (block_number);
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
CREATE UNIQUE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid, block_number);
CREATE UNIQUE INDEX tx_mh_block_number_index ON eth.transaction_cids USING btree (mh_key, block_number);
CREATE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid, block_number);
CREATE INDEX tx_mh_block_number_index ON eth.transaction_cids USING btree (mh_key, block_number);
CREATE INDEX tx_dst_index ON eth.transaction_cids USING btree (dst);
CREATE INDEX tx_src_index ON eth.transaction_cids USING btree (src);
-- receipt indexes
CREATE INDEX rct_block_number_index ON eth.receipt_cids USING brin (block_number);
CREATE INDEX rct_header_id_index ON eth.receipt_cids USING btree (header_id);
CREATE INDEX rct_leaf_cid_index ON eth.receipt_cids USING btree (leaf_cid);
CREATE INDEX rct_leaf_mh_block_number_index ON eth.receipt_cids USING btree (leaf_mh_key, block_number);
CREATE INDEX rct_contract_index ON eth.receipt_cids USING btree (contract);
@@ -55,6 +56,7 @@ CREATE INDEX access_list_storage_keys_index ON eth.access_list_elements USING gi
-- log indexes
CREATE INDEX log_block_number_index ON eth.log_cids USING brin (block_number);
CREATE INDEX log_header_id_index ON eth.log_cids USING btree (header_id);
CREATE INDEX log_leaf_mh_block_number_index ON eth.log_cids USING btree (leaf_mh_key, block_number);
CREATE INDEX log_cid_index ON eth.log_cids USING btree (leaf_cid);
CREATE INDEX log_address_index ON eth.log_cids USING btree (address);
@@ -72,6 +74,7 @@ DROP INDEX eth.log_topic0_index;
DROP INDEX eth.log_address_index;
DROP INDEX eth.log_cid_index;
DROP INDEX eth.log_leaf_mh_block_number_index;
DROP INDEX eth.log_header_id_index;
DROP INDEX eth.log_block_number_index;
-- access list indexes
@@ -106,6 +109,7 @@ DROP INDEX eth.rct_contract_hash_index;
DROP INDEX eth.rct_contract_index;
DROP INDEX eth.rct_leaf_mh_block_number_index;
DROP INDEX eth.rct_leaf_cid_index;
DROP INDEX eth.rct_header_id_index;
DROP INDEX eth.rct_block_number_index;
-- transaction indexes
@@ -22,17 +22,20 @@ BEGIN
ELSIF (TG_TABLE_NAME = 'log_cids') THEN
obj := json_build_array(
TG_TABLE_NAME,
NEW.header_id,
NEW.rct_id,
NEW.index
);
ELSIF (TG_TABLE_NAME = 'receipt_cids') THEN
obj := json_build_array(
TG_TABLE_NAME,
NEW.header_id,
NEW.tx_id
);
ELSIF (TG_TABLE_NAME = 'transaction_cids') THEN
obj := json_build_array(
TG_TABLE_NAME,
NEW.header_id,
NEW.tx_hash
);
ELSIF (TG_TABLE_NAME = 'access_list_elements') THEN
+2 -3
View File
@@ -5,10 +5,9 @@ services:
restart: on-failure
depends_on:
- ipld-eth-db
image: cerc-io/ipld-eth-db
# Build image using local context
build:
context: .
dockerfile: Dockerfile
build: .
environment:
DATABASE_USER: "vdbm"
DATABASE_NAME: "vulcanize_testing"
+1 -1
View File
@@ -6,7 +6,7 @@ services:
depends_on:
- ipld-eth-db
# Use an existing image
image: vulcanize/ipld-eth-db:v4.1.1-alpha
image: cerc-io/ipld-eth-db:v4.2.1-alpha-unstable
environment:
DATABASE_USER: "vdbm"
DATABASE_NAME: "vulcanize_testing"