From 2201efc347e324cfb40d5422cf45f0655912e565 Mon Sep 17 00:00:00 2001 From: Maxim Krasilnikov Date: Thu, 21 Jun 2018 22:21:34 +0300 Subject: [PATCH] Rename dev_env to rinkeby_env, added make commands description to readme --- Makefile | 30 +++++++++---------- README.md | 23 ++++++++++++++ dockerfiles/{dev => rinkeby}/Dockerfile | 0 dockerfiles/{dev => rinkeby}/config.toml | 0 .../{dev => rinkeby}/docker-compose.yml | 22 ++++++++++---- 5 files changed, 55 insertions(+), 20 deletions(-) rename dockerfiles/{dev => rinkeby}/Dockerfile (100%) rename dockerfiles/{dev => rinkeby}/config.toml (100%) rename dockerfiles/{dev => rinkeby}/docker-compose.yml (70%) diff --git a/Makefile b/Makefile index bdc93dfc..30ddcc29 100644 --- a/Makefile +++ b/Makefile @@ -83,23 +83,23 @@ import: test -n "$(NAME)" # $$NAME psql $(NAME) < db/schema.sql -#Dev environment -DEV_COMPOSE_FILE=dockerfiles/dev/docker-compose.yml +#Rinkeby docker environment +RINKEBY_COMPOSE_FILE=dockerfiles/rinkeby/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: rinkeby_env_up +rinkeby_env_up: + docker-compose -f $(RINKEBY_COMPOSE_FILE) up -d geth + docker-compose -f $(RINKEBY_COMPOSE_FILE) up --build migrations + docker-compose -f $(RINKEBY_COMPOSE_FILE) up -d --build vulcanizedb -.PHONY: dev_env_deploy -dev_env_deploy: - docker-compose -f $(DEV_COMPOSE_FILE) up -d --build vulcanizedb +.PHONY: rinkeby_env_deploy +rinkeby_env_deploy: + docker-compose -f $(RINKEBY_COMPOSE_FILE) up -d --build vulcanizedb .PHONY: dev_env_migrate -dev_env_migrate: - docker-compose -f $(DEV_COMPOSE_FILE) up --build migrations +rinkeby_env_migrate: + docker-compose -f $(RINKEBY_COMPOSE_FILE) up --build migrations -.PHONY: dev_env_down -dev_env_down: - docker-compose -f $(DEV_COMPOSE_FILE) down +.PHONY: rinkeby_env_down +rinkeby_env_down: + docker-compose -f $(RINKEBY_COMPOSE_FILE) down diff --git a/README.md b/README.md index fe2d69bf..65b41dd3 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,29 @@ Sync VulcanizeDB from the LevelDB underlying a Geth node. - `--ending-block-number`/`-e`: block number to sync to - `--all`/`-a`: sync all missing blocks +## Start full environment in docker by single command + +### Geth Rinkeby + +make command | description +------------------- | ---------------- +rinkeby_env_up | start geth, postgres and rolling migrations, after migrations done starting vulcanizedb container +rinkeby_env_deploy | build and run vulcanizedb container in rinkeby environment +rinkeby_env_migrate | build and run rinkeby env migrations +rinkeby_env_down | stop and remove all rinkeby env containers + +Success run of the VulcanizeDB container require full geth state sync, +attach to geth console and check sync state: + +```bash +$ docker exec -it rinkeby_vulcanizedb_geth geth --rinkeby attach +... +> eth.syncing +false +``` + +If you have full rinkeby chaindata you can move it to `rinkeby_vulcanizedb_geth_data` docker volume to skip long wait of sync. + ## Running the Tests ### Unit Tests diff --git a/dockerfiles/dev/Dockerfile b/dockerfiles/rinkeby/Dockerfile similarity index 100% rename from dockerfiles/dev/Dockerfile rename to dockerfiles/rinkeby/Dockerfile diff --git a/dockerfiles/dev/config.toml b/dockerfiles/rinkeby/config.toml similarity index 100% rename from dockerfiles/dev/config.toml rename to dockerfiles/rinkeby/config.toml diff --git a/dockerfiles/dev/docker-compose.yml b/dockerfiles/rinkeby/docker-compose.yml similarity index 70% rename from dockerfiles/dev/docker-compose.yml rename to dockerfiles/rinkeby/docker-compose.yml index 99ceb1c1..49950dff 100644 --- a/dockerfiles/dev/docker-compose.yml +++ b/dockerfiles/rinkeby/docker-compose.yml @@ -5,30 +5,36 @@ services: vulcanizedb: build: context: ./../../ - dockerfile: dockerfiles/dev/Dockerfile - container_name: dev_vulcanizedb + dockerfile: dockerfiles/rinkeby/Dockerfile + container_name: rinkeby_vulcanizedb command: "sync --starting-block-number 0 --config /config.toml" volumes: - "./config.toml:/config.toml" - "vulcanizedb_geth_data:/geth" + networks: + vulcanizedb_net: migrations: image: migrate/migrate:v3.3.0 - container_name: dev_vulcanizedb_migrations + container_name: rinkeby_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 + networks: + vulcanizedb_net: postgres: image: postgres:9.6.5-alpine - container_name: dev_vulcanizedb_postgres + container_name: rinkeby_vulcanizedb_postgres environment: POSTGRES_USER: postgres POSTGRES_DB: vulcanizedb POSTGRES_PASSWORD: postgres + networks: + vulcanizedb_net: healthcheck: test: ["CMD", "pg_isready"] interval: 5s @@ -37,12 +43,18 @@ services: geth: image: ethereum/client-go:v1.8.11 - container_name: dev_vulcanizedb_geth + container_name: rinkeby_vulcanizedb_geth cpus: 0.3 hostname: eth command: '--rinkeby --rpc --rpcaddr="0.0.0.0" --rpcvhosts="geth"' volumes: - "vulcanizedb_geth_data:/root/.ethereum/rinkeby" + networks: + vulcanizedb_net: volumes: vulcanizedb_geth_data: + +networks: + vulcanizedb_net: + driver: bridge