흠 요즘은 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
우여곡절끝에 뜨긴 떴구만.
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
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로 가야할듯.
댓글
댓글 쓰기