Skip to content

Latest commit

 

History

History
214 lines (145 loc) · 4.08 KB

osx.md

File metadata and controls

214 lines (145 loc) · 4.08 KB

Setup local development environment on OS X

Overview

  1. Install Homebrew
  2. Install Ruby
  3. Install MySQL
  4. Install Redis
  5. Install RabbitMQ
  6. Install Bitcoind
  7. Install PhantomJS
  8. Install ImageMagick
  9. Configure Peatio

1. Install Homebrew

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

2. Install Ruby

Install rbenv:

brew install rbenv ruby-build

Add rbenv to bash so that it loads every time you open a terminal:

echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile

Install Ruby and set it as the default version:

rbenv install 2.2.8
rbenv global 2.2.8

ruby -v

Install bundler:

echo "gem: --no-ri --no-rdoc" > ~/.gemrc
gem install bundler
rbenv rehash

3. Install MySQL

Install mysql brew package:

brew install mysql

Start the mysql server:

mysql.server start

4. Install Redis

Install redis brew package:

brew install redis

Start the redis server:

redis-server /usr/local/etc/redis.conf

5. Install RabbitMQ

Install rabbitmq brew package:

brew install rabbitmq

Start the rabbitmq server:

rabbitmq-server

6. Install Bitcoind

Download and Install Bitcoin Core. Prepare config files:

mkdir -p ~/Library/Application\ Support/Bitcoin
touch ~/Library/Application\ Support/Bitcoin/bitcoin.conf
vim ~/Library/Application\ Support/Bitcoin/bitcoin.conf

Insert the following lines into bitcoin.conf. Don't forget to replace your username and password.

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 <port> (default: 8332 or testnet: 18332)
rpcuser=USERNAME
rpcpassword=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 the bitcoin app:

open /Applications/Bitcoin-Qt.app

7. Install PhantomJS

Peatio uses Capybara with PhantomJS to do the feature tests, so if you want to run the tests. Install the PhantomJS is neccessary.

brew install phantomjs

8. Install ImageMagick

brew install imagemagick

9. Configure Peatio

Clone the project:

git clone [email protected]/rubykube/peatio.git
cd peatio
bundle install

Prepare configure files:

bin/init_config

Setup Pusher

Peatio depends on pusher. A development key/secret pair for development/test is provided in config/application.yml. PLEASE USE IT IN DEVELOPMENT/TEST ENVIRONMENT ONLY!

Set (or simply uncomment) pusher-related settings in config/application.yml.

You can always find more details about pusher configuration at pusher website

Setup bitcoind rpc endpoint

Edit config/currencies.yml.

Replace username:password and port. username and password should only contain letters and numbers, do not use email as username.

Setup database:

bundle exec rake db:setup

Run daemons

Read how to deal with Peatio daemons at Peatio daemons.

Genetare liability proof

To generate liability proof run:

bundle exec rake solvency:liability_proof

Otherwise you will get an exception at the "Solvency" page.

Run Peatio

Start the server:

bundle exec rails server

Once server is up and running, visit http://localhost:3000

Sign in: