Skip to content

Latest commit

 

History

History
168 lines (101 loc) · 3.97 KB

File metadata and controls

168 lines (101 loc) · 3.97 KB

Development [Mac and Linux]

1. Requirements

  • Linux / Mac OSX
  • Ruby 2.1.2, using RVM or rbenv
  • MySQL
  • RabbitMQ
  • Redis
  • PhatomJS
  • Pusher

** More details are in the requirements doc

reCAPTCHA

Peatio use reCAPTCHA to make sure certain operations is not done by bots. A development key/secrect pair is provided in config/application.yml (uncomment to use). PLEASE USE IT IN DEVELOPMENT/TEST ENVIRONMENT ONLY!

Pusher

Peatio depends on Pusher. A development key/secret pair for development/test is provided in config/application.yml (uncomment to use). PLEASE USE IT IN DEVELOPMENT/TEST ENVIRONMENT ONLY!

More details to visit pusher official website

Install PhatomJS

For Mac

brew install phantomjs

For Ubuntu

sudo apt-get install -y libfontconfig libfontconfig-dev libfreetype6-dev
  • Download the 32 bit or 64 bit binary.
  • Extract the tarball and copy bin/phantomjs into your PATH

** More details are in the poltergeist doc.

Install RabbitMQ

For Mac

brew install rabbitmq

For Ubuntu

Please follow instructions here: https://www.rabbitmq.com/install-debian.html

# config rabbitmq
sudo rabbitmq-plugins enable rabbitmq_management
sudo service rabbitmq-server restart
wget http://localhost:15672/cli/rabbitmqadmin
chmod +x rabbitmqadmin
sudo mv rabbitmqadmin /usr/local/sbin

2. Bitcoind

Install bitcoind

For Mac

Download and Install Bitcoin Core

For Ubuntu

sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install -y bitcoind

Configure bitcoind

Insert the following lines into your bitcoin.conf, and replce with your username and password.

server=1
daemon=1
rpcuser=INVENT_A_UNIQUE_USERNAME
rpcpassword=INVENT_A_UNIQUE_PASSWORD

# If run on the test network instead of the real bitcoin network
testnet=1
# Notify when receiving coins
walletnotify=/usr/local/sbin/rabbitmqadmin publish routing_key=peatio.deposit.coin payload='{"txid":"%s", "channel_key":"satoshi"}'

For Mac

~/Library/Application\ Support/Bitcoin/bitcoin.conf

For Linux

~/.bitcoin/bitcoin.conf

Start Bitcoind

For Mac

open /Applications/Bitcoin-Qt.app

For Linux

bitcoind

3. Peatio

Clone the project
git clone git@github.com:peatio/peatio.git
cd peatio
bundle install
Prepare configure files:
bin/init_config
Setup reCAPTCHA/Pusher:
# uncomment reCAPTCHA and Pusher related settings
vim config/application.yml
Setup bitcoind rpc endpoint
# replace username:password and port with the one you set in
# username and password should only contain letters and numbers, do not use email as username
# bitcoin.conf in previous step
vim config/currencies.yml
Config database settings:
vim config/database.yml

# Initialize the database and load the seed data
bundle exec rake db:setup
Run Daemons
# start all daemons
rake daemons:start

# or start daemon one by one
rake daemon:matching:start
...

# Daemon trade_executor can be run concurrently, e.g. below
# line will start four trade executors, each with its own logfile.
# Default to 1.
TRADE_EXECUTOR=4 rake daemon:trade_executor:start

# You can do the same when you start all daemons:
TRADE_EXECUTOR=4 rake daemon:start
Run Peatio
# start server
rails server
user: admin@peatio.dev
pass: Pass@word8