기본 콘텐츠로 건너뛰기

Peatio 분투기

흠 요즘은 ruby 할때 puma(https://github.com/puma/puma)를? 패신저는 안쓰남.
https://github.com/peatio/peatio/blob/master/doc/setup-local-osx.md
로컬 환경 먼저 잡자.
brew, rbenv 설치하고 ruby를 2.2.1로 설정하자.
gem install bundler을 설치
Fetching: bundler-1.15.4.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

sudo chown -R $USER /Library/Ruby/Gems/ 하고 나면
gem install bundler
Fetching: bundler-1.15.4.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.

또 오류. 에잇 귀찮아 sudo install bundler 해버림.

mysql 설치
brew install mysql 설치하고
mysql.server start 기동.

redis 설치
brew install redis
redis-server /usr/local/etc/redis.conf

rabbitMQ 설치 얘는 /usr/local/sbin 여기에 설치되니
brew install rabbitmq
rabbitmq-server


bitcore 도 다운 받고 https://bitcoin.org/en/download

mkdir -p ~/Library/Application\ Support/Bitcoin
touch ~/Library/Application\ Support/Bitcoin/bitcoin.conf
vim ~/Library/Application\ Support/Bitcoin/bitcoin.conf
다행히도 testnet 은 153GB씩 안하는 듯.
server=1
daemon=1

# If run on the test network instead of the real bitcoin network
testnet=1

# You must set rpcuser and rpcpassword to secure the JSON-RPC api
# Please make rpcpassword to something secure, `5gKAgrJv8CQr2CGUhjVbBFLSj29HnE6YGXvfykHJzS3k` for example.
# Listen for JSON-RPC connections on (default: 8332 or testnet: 18332)
rpcuser=INVENT_A_UNIQUE_USERNAME
rpcpassword=INVENT_A_UNIQUE_PASSWORD
rpcport=18332

# Notify when receiving coins
walletnotify=/usr/local/sbin/rabbitmqadmin publish routing_key=peatio.deposit.coin payload='{"txid":"%s", "channel_key":"satoshi"}'

하고나서 데몬 띄우고 open /Applications/Bitcoin-Qt.app

테스트넷이라 방심했더니 disk full.
일단 내려놓고 용량 확보 후
brew install phantomjs
brew install imagemagick

하면서 Peatio clone 함
git clone git://github.com/peatio/peatio.git
cd peatio
bundle install
bundle install 이 진짜 오래걸림.
그리고 root 암호도 종종 물어봄. 싹 귀찮네.
자다깨다를 반복.
Fetching ffi 1.9.3......... 오래걸린다...

그러다가 갑자기.
Retrying download gem from https://rubygems.org/ due to error (2/4): Gem::RemoteFetcher::FetchError too many connection resets (https://rubygems.org/gems/ffi-1.9.3.gem)
엥 뭐지?
아몰랑 첨부터 다시 하니

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/eventmachine-1.0.4/mkmf.log

current directory:
/private/var/folders/9_/4p3ry0ks44g0jn2zl25cr8bw0000gn/T/bundler20171009-5586-48ljfbeventmachine-1.0.4/gems/eventmachine-1.0.4/ext
make "DESTDIR=" clean

current directory:
/private/var/folders/9_/4p3ry0ks44g0jn2zl25cr8bw0000gn/T/bundler20171009-5586-48ljfbeventmachine-1.0.4/gems/eventmachine-1.0.4/ext
make "DESTDIR="
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:112:10: fatal error: 'openssl/ssl.h' file not found
#include
^~~~~~~~~~~~~~~
1 error generated.
make: *** [binder.o] Error 1

make failed, exit code 2

Gem files will remain installed in
/var/folders/9_/4p3ry0ks44g0jn2zl25cr8bw0000gn/T/bundler20171009-5586-48ljfbeventmachine-1.0.4/gems/eventmachine-1.0.4
for inspection.
Results logged to
/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/eventmachine-1.0.4/gem_make.out

An error occurred while installing eventmachine (1.0.4), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.0.4'` succeeds before bundling.

In Gemfile:
amqp was resolved to 1.3.0, which depends on
eventmachine

아으 eventmachine이 오류. openssl 설치했던 것 같은데 아닌가?
export LD_LIBRARY_PATH=$(brew --prefix openssl)/lib
export CPATH=$(brew --prefix openssl)/include
export PKG_CONFIG_PATH=$(brew --prefix openssl)/lib/pkgconfig
하고 다시 하니 잘된다. (https://github.com/libimobiledevice/libimobiledevice/issues/389#issuecomment-289284190) 참조함.

Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported = 1.8.7 : gem install rdoc-data; rdoc-data --install = 1.9.1 : gem install rdoc-data; rdoc-data --install >= 1.9.2 : nothing to do! Yay!

다 되었다. 진짜 오래 걸렸네.
그럼 db setup을 해볼까
$ bundle exec rake db:setup
Could not find aasm-3.4.0 in any of the sources
Run `bundle install` to install missing gems.

bundle version 탓인가
$ gem install bundler --pre
ERROR: While executing gem ... (Gem::FilePermissionError)
권한에서부터 뭔가 문제 있는거 아닌가.

$ sudo gem install bundler --pre
Password:
Successfully installed bundler-1.16.0.pre.3
되긴 되었다.

bundle exec rake db:setup 하니
$ bundle exec rake db:setup
rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'mysql2'.
Gem Load Error is: uninitialized constant Mysql2::Client::SECURE_CONNECTION
Backtrace for gem load error is:

음. 또 버전 문제인가.
https://github.com/brianmario/mysql2/issues/754#issuecomment-291564933
이거 보고 재시도. DB 버전을 바꿨다.

rake aborted!
ActiveRecord::StatementInvalid: Mysql2::Error: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead: CREATE TABLE `account_versions` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `member_id` int(11), `account_id` int(11), `reason` int(11), `balance` decimal(32,16), `locked` decimal(32,16), `fee` decimal(32,16), `amount` decimal(32,16), `modifiable_id` int(11), `modifiable_type` varchar(255), `created_at` datetime, `updated_at` datetime, `currency` int(11), `fun` int(11)) ENGINE=InnoDB

뭐냐 왜 Primary key가 null이라고;
https://github.com/peatio/peatio/issues/590
이 문제로구만.
https://stackoverflow.com/a/40758542 이걸보고
config/initializers/abstract_mysql2_adapter.rb 에 아래를 추가함.

require 'active_record/connection_adapters/mysql2_adapter'

class ActiveRecord::ConnectionAdapters::Mysql2Adapter
NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
end

우여곡절끝에 뜨긴 떴구만.

눈물의 화면

개발환경은 이정도인데 OS X에서 하는 거 고통스럽다.
그냥 바로 linux로 가야할듯.

댓글

이 블로그의 인기 게시물

세상 간단한 https(+secured websocket): Caddy

nginx, apache2 같은 걸로 매번 certbot 연동을 통해 https 하는게 지겨워서 알아보니 Caddy라는게 있더라. 설치법은 강하게 크기 위해 알아서 해본다. # cat /etc/caddy/Caddyfile your.shitty.site:8123 {   proxy / localhost:9123 {     websocket     transparent   } } 이건 외부에서 8123으로 들어오는 걸 내부적으로 9123로 맞춰서 https 맞춰주는 reverse proxy. 만일 port를 생략하면 # cat /etc/caddy/Caddyfile your.shitty.site {   proxy / localhost:9123 {     websocket     transparent   } } 기본포트인 443으로 되어 https://your.shitty.site 로 접속이 된다. 요새 말썽이던 cloudflare 버리고 netlify domain이랑 caddy를 쓰니까 앓던 이가 빠진 느낌. 이 조합은 당분간 계속 써야겠다 싶다.

LG G Pro 2 Custom Rom +Rooting 기록

선 루팅 https://forum.xda-developers.com/lg-g3/general/guide-root-lg-firmwares-kitkat-lollipop-t3056951 1.2버전 스크립트 모드로. echo Looking for LG serial port.. echo. adb.exe wait-for-device 여기에서 정체 상태여서 강제로 adb kill-server 했더니 알아서 재부팅하심. 폰에선 "펌웨어 업데이트"화면이 나오고 Phone found at COM5! Rooting phone.. If you don't see the SuperSu installer script runs within about a minute, then the root failed. Author : blog.lvu.kr SPECIAL COMMAND : ENTER, LEAVE ## 이런 상황이 됨. #이 느린 속도로 하나씩 증가하고 있음. 한 시간 기다려도 성과없음. 뭐 몇번해봐도 안되고 결국 불안하긴 하지만 kingroot.net  로 설치 롤리팝이니까  https://drive.google.com/file/d/0B4kfGU1z_PClQ3AyM2lKOGR1S3M/view  이걸 받아서 압축 풀기. d838recovery.bat 만 있어서 당황스럽긴한데 실행하고 1번 하니까 리커버리 모드 진입까진 잘 되는 듯. adb sideload 라는게 있어서 해봄. Advance에서 adb sideload 선택하고 USB연결한 PC에서 adb sideload RR-N-v5.8.5-20171010-d838-Final.zip 하니까 착착 잘 진행됨. 이제 흉측한 U+LTE 가 없어짐. ㅇㅋ 군더더기 없고 깔끔한데 남은 건 gapps 를 설치해야함. http://opengapps.org/  를 권해줘서 갔는데 지옥 느림. ARM + 7.1 + stock 이 기본이...