From 724f2c68482cc10b248277e957afaf1410ee1b98 Mon Sep 17 00:00:00 2001 From: furion <_@furion.me> Date: Fri, 21 Apr 2017 19:36:31 +0200 Subject: [PATCH] dockerize dev environment --- Makefile | 14 ++++++++++---- README.md | 15 +++++++++++++++ scripts/docker-compose.yml => docker-compose.yml | 11 ++++++++++- scripts/schema.py | 2 +- 4 files changed, 36 insertions(+), 6 deletions(-) rename scripts/docker-compose.yml => docker-compose.yml (75%) diff --git a/Makefile b/Makefile index 0cdb44e7e..a22583e76 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ ROOT_DIR := $(shell pwd) PROJECT_NAME := hive PROJECT_DOCKER_TAG := steemit/$(PROJECT_NAME) -PROJECT_DOCKER_RUN_ARGS := -p8080:8080 +PROJECT_DOCKER_RUN_ARGS := --link steemit_mysql:db default: build @@ -13,10 +13,16 @@ build: docker build -t $(PROJECT_DOCKER_TAG) . run: - docker run $(PROJECT_DOCKER_RUN_ARGS) $(PROJECT_DOCKER_TAG) + docker run -it $(PROJECT_DOCKER_RUN_ARGS) $(PROJECT_DOCKER_TAG) /bin/bash + +compose: + docker-compose up -d + +mysql: + docker run -d --name steemit_mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root_password -e MYSQL_DATABASE=testdb mysql ipython: - docker run -it $(PROJECT_DOCKER_TAG) ipython + docker run -it $(PROJECT_DOCKER_RUN_ARGS) $(PROJECT_DOCKER_TAG) ipython test: test-without-build build @@ -47,4 +53,4 @@ clean-pyc: find . -name '*~' -exec rm -f {} + install: clean - pip install -e . \ No newline at end of file + pip install -e . diff --git a/README.md b/README.md index 448745cb2..e9d5a88f2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,18 @@ +## Dev Environment + +Prepare MySQL Database (once): +``` +make mysql +``` + +Prepare and load REPL (on change): +``` +make build +make iypthon +``` + + +## Hivemind `hivemind` is an off-chain consensus layer for Steem communities and API server for social features like feeds and follows. It is primarily concerned with indexing specific `custom_json` namespaces but also watches for posts, votes, and account creations. diff --git a/scripts/docker-compose.yml b/docker-compose.yml similarity index 75% rename from scripts/docker-compose.yml rename to docker-compose.yml index 588a09b85..23787981b 100644 --- a/scripts/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '2' +version: '3' services: mysql: image: mysql @@ -26,3 +26,12 @@ services: - 8080:80 volumes: - /sessions +# hive: +# build: +# context: . +# dockerfile: Dockerfile +# command: python run.py +# container_name: hive-python +# links: +# - mysql:db +# restart: always diff --git a/scripts/schema.py b/scripts/schema.py index e7865e37c..33434fb50 100644 --- a/scripts/schema.py +++ b/scripts/schema.py @@ -6,7 +6,7 @@ from sqlalchemy.dialects.mysql import ( TINYTEXT, DOUBLE, ) -connection_url = 'mysql://root:root_password@localhost:3306/testdb' +connection_url = 'mysql://root:root_password@db:3306/testdb' logging.basicConfig() logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) -- GitLab