Dockerized dev environment, geth rinkeby

This commit is contained in:
Maxim Krasilnikov 2018-06-21 19:10:56 +03:00
parent b2cf8d55d8
commit 70f7c63aa8
4 changed files with 87 additions and 0 deletions

View File

@ -82,3 +82,24 @@ migrate: $(MIGRATE) checkdbvars
import:
test -n "$(NAME)" # $$NAME
psql $(NAME) < db/schema.sql
#Dev environment
DEV_COMPOSE_FILE=dockerfiles/dev/docker-compose.yml
.PHONY: dev_env_up
dev_env_up:
docker-compose -f $(DEV_COMPOSE_FILE) up -d geth
docker-compose -f $(DEV_COMPOSE_FILE) up --build migrations
docker-compose -f $(DEV_COMPOSE_FILE) up -d --build vulcanizedb
.PHONY: dev_env_deploy
dev_env_deploy:
docker-compose -f $(DEV_COMPOSE_FILE) up -d --build vulcanizedb
.PHONY: dev_env_migrate
dev_env_migrate:
docker-compose -f $(DEV_COMPOSE_FILE) up --build migrations
.PHONY: dev_env_down
dev_env_down:
docker-compose -f $(DEV_COMPOSE_FILE) down

View File

@ -0,0 +1,9 @@
FROM golang:1.10.3-alpine3.7
RUN apk add --no-cache make gcc musl-dev
ADD . /go/src/github.com/vulcanize/vulcanizedb
WORKDIR /go/src/github.com/vulcanize/vulcanizedb
RUN go build -o /app main.go
ENTRYPOINT ["/app"]

View File

@ -0,0 +1,9 @@
[database]
name = "vulcanizedb"
hostname = "postgres"
port = 5432
user = "postgres"
password = "postgres"
[client]
ipcPath = "/geth/geth.ipc"

View File

@ -0,0 +1,48 @@
version: '2.2'
services:
vulcanizedb:
build:
context: ./../../
dockerfile: dockerfiles/dev/Dockerfile
container_name: dev_vulcanizedb
command: "sync --starting-block-number 0 --config /config.toml"
volumes:
- "./config.toml:/config.toml"
- "vulcanizedb_geth_data:/geth"
migrations:
image: migrate/migrate:v3.3.0
container_name: dev_vulcanizedb_migrations
depends_on:
postgres:
condition: service_healthy
command: -database postgresql://postgres:postgres@postgres:5432/vulcanizedb?sslmode=disable -path /migrations up
volumes:
- ./../../db/migrations:/migrations
postgres:
image: postgres:9.6.5-alpine
container_name: dev_vulcanizedb_postgres
environment:
POSTGRES_USER: postgres
POSTGRES_DB: vulcanizedb
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD", "pg_isready"]
interval: 5s
timeout: 5s
retries: 30
geth:
image: ethereum/client-go:v1.8.11
container_name: dev_vulcanizedb_geth
cpus: 0.3
hostname: eth
command: '--rinkeby --rpc --rpcaddr="0.0.0.0" --rpcvhosts="geth"'
volumes:
- "vulcanizedb_geth_data:/root/.ethereum/rinkeby"
volumes:
vulcanizedb_geth_data: