Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #37 from vulcanize/dapptools2
Browse files Browse the repository at this point in the history
Dapptools v2
  • Loading branch information
ramilexe authored Sep 4, 2020
2 parents 1a3e9c4 + 5b5c330 commit fd4d5a4
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 11 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/on-master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Docker Compose Build

on:
push:
branches:
- master

jobs:
build:
name: Run docker build
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-indexer docker.pkg.github.com/vulcanize/ipld-eth-indexer/ipld-eth-indexer:${{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-indexer/ipld-eth-indexer:${{steps.vars.outputs.sha}}

12 changes: 12 additions & 0 deletions .github/workflows/on-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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
25 changes: 25 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish Docker image
on:
release:
types: [published]
jobs:
push_to_registries:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
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-indexer/ipld-eth-indexer:${{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-indexer/ipld-eth-indexer:${{steps.vars.outputs.sha}} vulcanize/ipld-eth-indexer:${{steps.vars.outputs.tag}}
- name: Docker Push to Docker Hub
run: docker push vulcanize/ipld-eth-indexer:${{steps.vars.outputs.tag}}

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.vscode
test_data_dir/
contracts/*
environments/*.toml
#environments/*.toml
Vagrantfile
vagrant*.sh
.vagrant
Expand Down
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ WORKDIR /go/src/github.com/vulcanize/ipld-eth-indexer
# app container
FROM alpine

ARG USER
ARG CONFIG_FILE
ARG EXPOSE_PORT_1
ARG EXPOSE_PORT_2
ARG USER="vdm"
ARG CONFIG_FILE="./environments/example.toml"

RUN adduser -Du 5000 $USER
WORKDIR /app
Expand All @@ -41,7 +39,7 @@ COPY --from=builder /go/src/github.com/pressly/goose/cmd/goose/goose goose
COPY --from=builder /go/src/github.com/vulcanize/ipld-eth-indexer/db/migrations migrations/vulcanizedb
COPY --from=builder /go/src/github.com/vulcanize/ipld-eth-indexer/environments environments

EXPOSE $EXPOSE_PORT_1
EXPOSE $EXPOSE_PORT_2
EXPOSE 8080

This comment has been minimized.

Copy link
@AFDudley

AFDudley Sep 5, 2020

Contributor

@i-norden @ramilexe if someone can't explain to me why we are exposing these ports, we should remove them. Please discuss in the slack channel.

EXPOSE 8081

ENTRYPOINT ["/app/startup_script.sh"]
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ build:
go fmt ./...
GO111MODULE=on go build

## Build docker image
.PHONY: docker-build
docker-build:
docker build -t vulcanize/ipld-eth-indexer -f Dockerfile .

# Parameter checks
## Check that DB variables are provided
.PHONY: checkdbvars
Expand Down
12 changes: 8 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
version: '3.2'

services:
dapptools:
restart: unless-stopped
image: vulcanize/dapptools:v0.29.0-statediff-0.0.2
ports:
- "127.0.0.1:8545:8545"
- "127.0.0.1:8546:8546"

db:
restart: always
image: postgres:10.12-alpine
Expand All @@ -18,15 +25,12 @@ services:
eth:
depends_on:
- db
build:x
build:
context: ./
cache_from:
- alpine:latest
- golang:1.12.4
dockerfile: ./Dockerfile
args:
USER: "vdbm"
CONFIG_FILE: ./environments/example.toml
environment:
VDB_COMMAND: "sync"
DATABASE_NAME: "vulcanize_public"
Expand Down
15 changes: 15 additions & 0 deletions environments/dapptools.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[database]
name = "vulcanize_public"
hostname = "db"
port = 5432
user = "vdbm"
password = "password"

[client]
ipcPath = "http://dapptools:8545"

[ethereum]
wsPath = "dapptools:8546" # $ETH_WS_PATH
httpPath = "dapptools:8545" # $ETH_HTTP_PATH
networkID = "4"
chainID = "4" # $ETH_CHAIN_ID

0 comments on commit fd4d5a4

Please sign in to comment.