We advice you to use power of docker and peatio-workbench as local development environment
Follow this guide for container-based development environmetnt setup
- Install Ruby
- Install MySQL
- Install Redis
- Install RabbitMQ
- Install Bitcoind
- Install PhantomJS
- Install JavaScript Runtime
- Install ImageMagick
- Configure Peatio
Install the ruby build dependencies:
sudo apt-get install git curl zlib1g-dev build-essential \
libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 \
libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev
Install rvm:
gpg --keyserver hkp://keys.gnupg.net \
--recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 \
7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable --ruby=2.2.8 --gems=rails
If you want to skip fetching documentation when installing gems, do the following:
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
Be sure to install the latest stable Redis, as the package, the distro one can be outdated:
sudo apt-add-repository -y ppa:rwky/redis
sudo apt-get update
sudo apt-get install redis-server
Please follow instructions here:
# add rabbitmq debian repo
sudo apt-add-repository 'deb http://www.rabbitmq.com/debian/ testing main'
curl http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | sudo apt-key add -
# install rabbitmq
sudo apt-get update
sudo apt-get install rabbitmq-server
# start the rabbitmq serveer
sudo rabbitmq-plugins enable rabbitmq_management
sudo service rabbitmq-server restart
# download and install rabbitmqadmin
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
Prepare config files:
mkdir -p ~/.bitcoin
touch ~/.bitcoin/bitcoin.conf
vim ~/.bitcoin/bitcoin.conf
Insert the following lines into bitcoin.conf
,
and replce with 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"}'
Start bitcoin daemon:
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
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_8.x | sudo bash -
sudo apt-get install nodejs
sudo apt-get install imagemagick
Clone the project:
git clone git://github.com/peatio/peatio.git
cd peatio
bundle install
Prepare configuration files:
bin/init_config
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
Edit config/currencies.yml
.
Replace username:password
and port
.
username
and password
should only contain letters and numbers,
do not use email as username
.
bundle exec rake db:setup
Read how to deal with Peatio daemons at Peatio daemons.
To generate liability proof run:
bundle exec rake solvency:liability_proof
Otherwise you will get an exception at the "Solvency" page.
Start the server:
bundle exec rails server
Once server is up and running, visit http://localhost:3000
Sign in:
- user: [email protected]
- pass: Pass@word8