Peatio Development on Ubuntu 14.04 - aanwhs/aanwhs.github.io GitHub Wiki
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git-core curl zlib1g-dev build-essential
sudo apt-get install libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3
sudo apt-get install libxml2-dev libxslt1-dev libcurl4-openssl-dev
sudo apt-get install python-software-properties libffi-dev
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
cd
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
rbenv install --verbose 2.2.2
rbenv global 2.2.2
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
gem install bundler
rbenv rehash
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
sudo apt-get install -y redis-server
echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install rabbitmq-server
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
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install bitcoind
mkdir -p ~/.bitcoin
touch ~/.bitcoin/bitcoin.conf
vim ~/.bitcoin/bitcoin.conf
rpcuser=rpcuserforbitcoin rpcpassword=rpcpasswordforbitcoin server=1 daemon=1 rpcport=8332
Notify when receiving coins walletnotify=/usr/local/sbin/rabbitmqadmin publish routing_key=peatio.deposit.coin payload='{"txid":"%s", "channel_key":"satoshi"}'
bitcoind
Peatio uses Capybara with PhantomJS to do the feature tests, so if you want to run the tests. Install the PhantomJS is neccessary.
sudo apt-get update
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
cd /usr/local/share
PHANTOMJS_VERISON=1.9.8
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOMJS_VERISON-linux-x86_64.tar.bz2
sudo tar xjf phantomjs-$PHANTOMJS_VERISON-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-$PHANTOMJS_VERISON-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs-$PHANTOMJS_VERISON-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -s /usr/local/share/phantomjs-$PHANTOMJS_VERISON-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update
sudo apt-get install -y nginx-extras passenger
sudo rm /etc/nginx/passenger.conf
touch /etc/nginx/passenger.conf
cat < /etc/nginx/passenger.conf
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/deploy/.rbenv/shims/ruby;
EOF
sudo sed -i 's+# include /etc/nginx/passenger.conf;+include /etc/nginx/passenger.conf;+g' /etc/nginx/nginx.conf
A JavaScript Runtime is needed for Asset Pipeline to work. Any runtime will do but Node.js is recommended.
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install nodejs
sudo apt-get install imagemagick
git clone https://github.com/aanwhs/peatio
cd peatio
bundle install
bin/init_config
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!
uncomment Pusher related settings
vim config/application.yml
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
vim config/database.yml
Initialize the database and load the seed data
bundle exec rake db:setup
start all daemons
bundle exec rake daemons:start
or start daemon one by one
bundle exec 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
When daemons don't work, check log/#{daemon name}.rb.output or log/peatio:amqp:#{daemon name}.output for more information (suffix is '.output', not '.log').
rake solvency:liability_proof
start server
bundle exec rails server
Visit http://localhost:3000
user: [email protected] pass: Pass@word8