설치
- ubuntu 16.04 기준으로 설명 (맥이나 윈도우에서는 손쉽게 docker를 설치 하신 후 이후 과정부터 따라하면 됩니다.)
잡설 : 소스 다운 받아서 빌드 하지말고 그냥 docker로 설치하는 것이 정신건강에 이롭네요 ...
docker 설치
참조링크 : https://docs.docker.com/install/linux/docker-ce/ubuntu/#uninstall-docker-ce
# 이전 버전 삭제
`$ sudo apt-get remove docker docker-engine docker.io`
# 목록 갱신
`$ sudo apt-get update`
# 관련 패키지 추가
`$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common`
# GPG키 추가
`$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -`
# 저장소 추가
`$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"`
# 목록 갱신
`$ sudo apt-get update`
# CE(community edition) 버전 설치
`$ sudo apt-get install docker-ce`
docker-compose 다운로드
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
github 소스 다운받기
$ git clone https://github.com/steemit/hivemind.git
docker build
$ cd hivemind
$ docker-compose up
중간점검
여기까지 하면 .... steemit/hive, postgres 2개의 docker 이미지가 생성된다.
- steemit/hive : WEBSERVER
- postgres : DB
다 된줄 알고 rpc 샘플을 전송해 보지만... db table 이 존재하지 않는다고 하면서 오류가 난다 ㅜㅜ
hive sync 작업
자 그럼 어떻게 해야 되나 ... 터미널로 연결해서 sync 작업을 수행해야 된다.
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6e1d9655295f steemit/hive "/bin/sh -c /usr/loc…" About an hour ago Up About an hour 0.0.0.0:8080->8080/tcp hivemind_hive_1
4e365a483023 postgres "docker-entrypoint.s…" About an hour ago Up About an hour 0.0.0.0:3306->3306/tcp, 5432/tcp hivemind_db_1
$ sudo docker exec -i -t 6e1d9655295f /bin/bash
6e1d9655295f 값은 CONTAINER_ID 값을 넣어주면 된다.(steemit/hive)
$ hive sync
위와 같이 명령어를 입력하면 이제 api.steemit.com 으로 접속하여 블록정보 동기화를 수행한다.
동기화 예상 완료 시간 14시간이 넘게 남았다...
rpc2.0 테스트
[ 그림 : 실패로그 - docker compose 이후 rpc 통신한 결과 , 아직 테이블이 생성되지 않아 오류가 발생함 ]
[ 그림 : 성공로그 - hive sync 를 해야지만 테이블이 생성됨 ]
[curl 요청 샘플]
[request]
curl --data '{"jsonrpc":"2.0","id":0,"method":"condenser_api.get_content", "params":{"author":"test-safari","permlink":"34gfex-december-spam"}}' http://localhost:8080
[response]
{"id": 0, "result": {"id": 0, "permlink": "", "author": ""}, "jsonrpc": "2.0"}
전에는 오류가 났었는데 이젠 오류가 나지 않는다 !! 야호 ... 이제 동기화만 기다려보자 10시간 남았다 -_-;
잡설
일단은 설치까지는 완료 했고 rpc20 통신이 정상적으로 되는 것까지 확인했다. 언제가 될지는 모르겠지만 (일단 동기화는 끝나야 됨 ㅜㅜ) 다음 시간에는 hivemind를 좀더 자세하게 살펴 보려 합니다.
설치하는 것 방법만 알면 쉬운데 모르고 삽질하니 시간이 많이 걸리긴 하네요... 그래서 그냥 기록용으로 남겨 봅니다.
추가내용 : 동기화 1일 후
- 단순하게 블록 정보만 가져오는 줄 알았는데 ...그게 아니네요
- 동기화 잔여 시간이 기존 10시간에서 -> 1일 정도로 늘어남 ㅋㅋㅋ
추가내용 : 동기화 43시간 후
- 아직도 동기화 중 ...
- hive sync 완료 하려면 1주일 걸리려나 -_-;
- 디스크 용량 모자를까 걱정됨 ...
- 250G SSD, 4TB HDD 있는데 ... 느려도 HDD로 이미지 경로를 바꿔야 되나 고민중...
- 일단 동기화가 되야 될듯 싶음
- docker 이미지 경로 바꾸기 : 심볼릭링크를 걸던 설정값을 바꾸던 둘중 하나를 나중에 해야 될듯 싶음