From 0595f3dc15474c1ceacc21ef33eeaaf18a7936cc Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Mon, 13 Mar 2023 21:35:58 +0800 Subject: [PATCH 1/6] Renames and clean up (#129) * Cerc refactor contd. * consistent local docker tag --- .github/workflows/publish.yaml | 4 +++- Makefile | 2 +- docker-compose.test.yml | 6 +++--- docker-compose.yml | 6 +++--- scripts/test_migration.sh | 4 ++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 904f573..bad2a7b 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -14,7 +14,9 @@ jobs: - 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}} + run: docker tag cerc/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.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin - name: Docker Push diff --git a/Makefile b/Makefile index 9b3367e..788b070 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,7 @@ docker-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 . +# docker build -t cerc/concise-migration-build -f ./db/Dockerfile . .PHONY: test-migrations test-migrations: $(GOOSE) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 7669176..1f4edc8 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -5,12 +5,12 @@ services: restart: on-failure depends_on: - ipld-eth-db - image: vulcanize/ipld-eth-db + image: cerc/ipld-eth-db # Build image using local context build: . environment: DATABASE_USER: "vdbm" - DATABASE_NAME: "vulcanize_testing" + DATABASE_NAME: "cerc_testing" DATABASE_PASSWORD: "password" DATABASE_HOSTNAME: "ipld-eth-db" DATABASE_PORT: 5432 @@ -21,7 +21,7 @@ services: command: ["postgres", "-c", "log_statement=all"] environment: POSTGRES_USER: "vdbm" - POSTGRES_DB: "vulcanize_testing" + POSTGRES_DB: "cerc_testing" POSTGRES_PASSWORD: "password" ports: - "127.0.0.1:8077:5432" diff --git a/docker-compose.yml b/docker-compose.yml index 6e517c7..3018478 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,10 +6,10 @@ services: depends_on: - ipld-eth-db # Use an existing image - image: vulcanize/ipld-eth-db:v4.2.1-alpha + image: cerc/ipld-eth-db:v4.2.2-alpha environment: DATABASE_USER: "vdbm" - DATABASE_NAME: "vulcanize_testing" + DATABASE_NAME: "cerc_testing" DATABASE_PASSWORD: "password" DATABASE_HOSTNAME: "ipld-eth-db" DATABASE_PORT: 5432 @@ -20,7 +20,7 @@ services: command: ["postgres", "-c", "log_statement=all"] environment: POSTGRES_USER: "vdbm" - POSTGRES_DB: "vulcanize_testing" + POSTGRES_DB: "cerc_testing" POSTGRES_PASSWORD: "password" ports: - "127.0.0.1:8077:5432" diff --git a/scripts/test_migration.sh b/scripts/test_migration.sh index fe60b33..9fb8e9b 100755 --- a/scripts/test_migration.sh +++ b/scripts/test_migration.sh @@ -10,7 +10,7 @@ sleep 5s export HOST_NAME=localhost export PORT=8066 export USER=vdbm -export TEST_DB=vulcanize_testing +export TEST_DB=cerc_testing export TEST_CONNECT_STRING=postgresql://$USER@$HOST_NAME:$PORT/$TEST_DB?sslmode=disable export PGPASSWORD=password @@ -54,4 +54,4 @@ do then exit 0 fi -done \ No newline at end of file +done From a91f44773cc2e8ca53e93186ff15e7593d6e1008 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Mon, 13 Mar 2023 21:38:00 +0800 Subject: [PATCH 2/6] Clean up Dockerfile (#130) --- Dockerfile | 17 +++++++---------- scripts/startup_script.sh | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index bf65fe3..b0a015d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,12 @@ FROM golang:1.18-alpine as builder -RUN apk --update --no-cache add make git g++ linux-headers +ADD . /go/src/github.com/cerc-io/ipld-eth-db -ADD . /go/src/github.com/vulcanize/ipld-eth-db - -# Build migration tool -WORKDIR /go/src/github.com/pressly +# Get migration tool +WORKDIR / 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 . +ADD https://github.com/pressly/goose/releases/download/${GOOSE_VER}/goose_linux_x86_64 ./goose +RUN chmod +x ./goose # app container FROM alpine @@ -18,7 +15,7 @@ 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 +COPY --from=builder /goose goose +COPY --from=builder /go/src/github.com/cerc-io/ipld-eth-db/db/migrations migrations ENTRYPOINT ["/app/startup_script.sh"] diff --git a/scripts/startup_script.sh b/scripts/startup_script.sh index 404f6e3..0535f5e 100755 --- a/scripts/startup_script.sh +++ b/scripts/startup_script.sh @@ -8,7 +8,7 @@ VDB_PG_CONNECT=postgresql://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOSTNAME # Run the DB migrations echo "Connecting with: $VDB_PG_CONNECT" echo "Running database migrations" -./goose -dir migrations/vulcanizedb postgres "$VDB_PG_CONNECT" up +./goose -dir migrations postgres "$VDB_PG_CONNECT" up # If the db migrations ran without err if [[ $? -eq 0 ]]; then From 527ff11328dde28c14ddda30497dfc7200c1181d Mon Sep 17 00:00:00 2001 From: i-norden Date: Tue, 21 Mar 2023 12:42:14 -0500 Subject: [PATCH 3/6] use v5.0.0-alpha --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3018478..daa053b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: depends_on: - ipld-eth-db # Use an existing image - image: cerc/ipld-eth-db:v4.2.2-alpha + image: cerc/ipld-eth-db:v5.0.0-alpha environment: DATABASE_USER: "vdbm" DATABASE_NAME: "cerc_testing" From 10c84b589f2d9f1f3f11e5ea9f8a72f10b9e363f Mon Sep 17 00:00:00 2001 From: i-norden Date: Tue, 21 Mar 2023 12:43:29 -0500 Subject: [PATCH 4/6] comments for using local build --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index daa053b..7206cc8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,10 @@ services: restart: on-failure depends_on: - ipld-eth-db + # Use local build + #build: + #context: . + #dockerfile: Dockerfile # Use an existing image image: cerc/ipld-eth-db:v5.0.0-alpha environment: From 1bb4fe04f0e30e2123dbd51a2d3eefdbe44f7047 Mon Sep 17 00:00:00 2001 From: i-norden Date: Tue, 21 Mar 2023 12:49:12 -0500 Subject: [PATCH 5/6] fix after cherry-pick --- .github/workflows/issues-notion-sync.yml | 29 -------------- .github/workflows/publish.yaml | 50 +++++++++++++----------- Dockerfile | 2 +- 3 files changed, 28 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/issues-notion-sync.yml diff --git a/.github/workflows/issues-notion-sync.yml b/.github/workflows/issues-notion-sync.yml deleted file mode 100644 index 551362b..0000000 --- a/.github/workflows/issues-notion-sync.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Notion Sync - -on: - workflow_dispatch: - issues: - types: - [ - opened, - edited, - labeled, - unlabeled, - assigned, - unassigned, - milestoned, - demilestoned, - reopened, - closed, - ] - -jobs: - notion_job: - runs-on: ubuntu-latest - name: Add GitHub Issues to Notion - steps: - - name: Add GitHub Issues to Notion - uses: vulcanize/notion-github-action@v1.2.4-issueid - with: - notion-token: ${{ secrets.NOTION_TOKEN }} - notion-db: ${{ secrets.NOTION_DATABASE }} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index bad2a7b..94ac141 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,7 +10,9 @@ jobs: - uses: actions/checkout@v2 - name: Get the version id: vars - run: echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7}) + run: | + echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7}) + echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/}) - name: Run docker build run: make docker-build - name: Tag docker image @@ -18,26 +20,28 @@ jobs: - 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.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin + run: echo ${{ secrets.GITEA_TOKEN }} | docker login https://git.vdb.to -u cerccicd --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: 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 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.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: 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}} diff --git a/Dockerfile b/Dockerfile index b0a015d..d5e0c25 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ 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 /goose goose COPY --from=builder /go/src/github.com/cerc-io/ipld-eth-db/db/migrations migrations From fcb93d17ed534f99fd84453bc71514aea16eea80 Mon Sep 17 00:00:00 2001 From: i-norden Date: Tue, 21 Mar 2023 15:08:04 -0500 Subject: [PATCH 6/6] remove vestigal action --- .github/workflows/publish.yaml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 94ac141..55a5693 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -25,23 +25,3 @@ jobs: 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.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: 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}}