Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #23 from vulcanize/docker
Browse files Browse the repository at this point in the history
docker compose with ipld-eth-indexer, ipld-eth-server and dapptools
  • Loading branch information
ramilexe authored Sep 18, 2020
2 parents 240e257 + 0e7fb2c commit 2d8e987
Show file tree
Hide file tree
Showing 13 changed files with 196 additions and 177 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/eth-contract-watcher docker.pkg.github.com/vulcanize/eth-contract-watcher/eth-contract-watcher:${{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/eth-contract-watcher/eth-contract-watcher:${{steps.vars.outputs.sha}}

4 changes: 2 additions & 2 deletions .github/workflows/build.yml → .github/workflows/on-pr.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Docker Compose Build
name: Docker Build

on: [pull_request]

jobs:
build:
name: Run docker-compose build
name: Run docker build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
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/eth-contract-watcher/eth-contract-watcher:${{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/eth-contract-watcher/eth-contract-watcher:${{steps.vars.outputs.sha}} vulcanize/eth-contract-watcher:${{steps.vars.outputs.tag}}
- name: Docker Push to Docker Hub
run: docker push vulcanize/eth-contract-watcher:${{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
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ USER $USER

# chown first so dir is writable
COPY --chown=$USER:$USER --from=builder /go/src/github.com/vulcanize/eth-contract-watcher/$CONFIG_FILE config.toml
COPY --chown=$USER:$USER --from=builder /go/src/github.com/vulcanize/eth-contract-watcher/dockerfiles/startup_script.sh .
COPY --chown=$USER:$USER --from=builder /go/src/github.com/vulcanize/eth-contract-watcher/startup_script.sh .

# keep binaries immutable
COPY --from=builder /go/src/github.com/vulcanize/eth-contract-watcher/eth-contract-watcher eth-contract-watcher
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ migrate: $(GOOSE) checkdbvars
## Build docker image
.PHONY: docker-build
docker-build:
docker build -t vulcanize/eth-contract-watcher -f dockerfiles/Dockerfile .
docker build -t vulcanize/eth-contract-watcher -f Dockerfile .
124 changes: 124 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
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"

eth-indexer:
restart: unless-stopped
depends_on:
- indexer-db
- dapptools
image: vulcanize/ipld-eth-indexer:v0.3.0-alpha
environment:
DATABASE_NAME: vulcanize_public
DATABASE_HOSTNAME: indexer-db
DATABASE_PORT: 5432
DATABASE_USER: vdbm
DATABASE_PASSWORD: password
ETH_WS_PATH: "dapptools:8546"
ETH_HTTP_PATH: "dapptools:8545"
ETH_CHAIN_ID: 4
ETH_NETWORK_ID: 4
VDB_COMMAND: sync

eth-server:
depends_on:
- indexer-db
- eth-indexer
image: vulcanize/ipld-eth-server:v0.0.13
environment:
VDB_COMMAND: serve
DATABASE_NAME: vulcanize_public
DATABASE_HOSTNAME: indexer-db
DATABASE_PORT: 5432
DATABASE_USER: vdbm
DATABASE_PASSWORD: password
SERVER_WS_PATH: "0.0.0.0:8080"
SERVER_HTTP_PATH: "0.0.0.0:8081"
LOGRUS_LEVEL: debug
ports:
- "127.0.0.1:8080:8080"
- "127.0.0.1:8081:8081"

indexer-db:
restart: unless-stopped
image: postgres:10.12-alpine
environment:
- POSTGRES_USER=vdbm
- POSTGRES_DB=vulcanize_public
- POSTGRES_PASSWORD=password
volumes:
- indexer_db_data:/var/lib/postgresql/data
ports:
- "127.0.0.1:8069:5432"

contact-watcher-db:
restart: unless-stopped
image: postgres:10.12-alpine
environment:
- POSTGRES_USER=vdbm
- POSTGRES_DB=vulcanize_public
- POSTGRES_PASSWORD=password
volumes:
- contact_watcher_db_data:/var/lib/postgresql/data
ports:
- "127.0.0.1:8068:5432"

eth-header-sync:
restart: unless-stopped
depends_on:
- contact-watcher-db
image: vulcanize/eth-header-sync:v0.1.1
volumes:
- ./environments/header_sync.toml:/app/config.toml
environment:
- STARTING_BLOCK_NUMBER=1
- VDB_COMMAND=sync
- DATABASE_NAME=vulcanize_public
- DATABASE_HOSTNAME=contact-watcher-db
- DATABASE_PORT=5432
- DATABASE_USER=vdbm
- DATABASE_PASSWORD=password

eth-contract-watcher:
depends_on:
- contact-watcher-db
build:
context: ""
cache_from:
- alpine:latest
- golang:1.13
dockerfile: Dockerfile
volumes:
- ./environments/example.toml:/app/config.toml
environment:
- VDB_COMMAND=watch
- DATABASE_NAME=vulcanize_public
- DATABASE_HOSTNAME=contact-watcher-db
- DATABASE_PORT=5432
- DATABASE_USER=vdbm
- DATABASE_PASSWORD=password

contract-watcher-graphql:
restart: unless-stopped
depends_on:
- contact-watcher-db
image: vulcanize/postgraphile:v1.0.1
environment:
- PG_HOST=contact-watcher-db
- PG_PORT=5432
- PG_DATABASE=vulcanize_public
- PG_USER=vdbm
- PG_PASSWORD=password
- SCHEMA=public,header_0xd850942ef8811f2a866692a623011bde52a462c1
ports:
- "127.0.0.1:5000:5000"

volumes:
contact_watcher_db_data:
indexer_db_data:
86 changes: 0 additions & 86 deletions dockerfiles/docker-compose.yml

This file was deleted.

43 changes: 0 additions & 43 deletions dockerfiles/header_sync/Dockerfile

This file was deleted.

42 changes: 0 additions & 42 deletions dockerfiles/header_sync/startup_script.sh

This file was deleted.

Loading

0 comments on commit 2d8e987

Please sign in to comment.