Skip to content

Commit

Permalink
Feature: Switch from geth to Parity (#25)
Browse files Browse the repository at this point in the history
* Use Parity instead of Geth

* Fix gpg keyserver URL

* Fix Parity config
  • Loading branch information
dpatsora authored and vshatravenko committed Sep 26, 2019
1 parent 09f45ca commit c200bc1
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ vendor/
.terraform/
*.tfvars
terraform.tfstate*
!data/geth/.gitkeep
!data/parity/.gitkeep
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Docker compose follow steps: [docker compose](https://docs.docker.com/compose/in

#### Install ruby in user app

##### Change user using
##### Change user using
```bash
su - app
```
Expand Down Expand Up @@ -133,7 +133,7 @@ The components included in the stack are:

- `proxy` - [Traefik](https://traefik.io/), a robust cloud native edge router/reverse proxy written in Go
- `backend` - [Vault](https://www.vaultproject.io), [MySQL](https://www.mysql.com), [Redis](https://redis.io) and [RabbitMQ](https://www.rabbitmq.com) grouped together
- `cryptonodes` - cryptocurrency nodes such as [Geth](https://github.com/ethereum/go-ethereum) **[Optional]**
- `cryptonodes` - cryptocurrency nodes such as [parity](https://github.com/paritytech/parity-ethereum) **[Optional]**
- `daemons` - Peatio daemons and Ranger **[Optional]**
- `setup` - setup hooks for Peatio and Barong to run before the application starts(DB migration etc.)
- `app` - [Peatio](https://github.com/rubykube/peatio), [Barong](https://github.com/rubykube/barong) and the [Ambassador](https://www.getambassador.io) API gateway
Expand Down Expand Up @@ -176,7 +176,7 @@ And run `rake service:component[start]`

## How to update component config?

Modify `config/*component*/*config*` and run `rake service:component[start]`,
Modify `config/*component*/*config*` and run `rake service:component[start]`,
if you want the changes to be persistent, you also need to update `templates/config/*components*/*config*`

#### Render compose file
Expand Down
2 changes: 1 addition & 1 deletion bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ EOS

install_ruby() {
sudo -u app bash <<EOS
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
EOS

Expand Down
2 changes: 1 addition & 1 deletion bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ install_opendax() {
bundle install
rake render:config
rake geth:import && \
rake service:cryptonodes && \
until rake wallet:create['deposit','http://0.0.0.0:8545','changeme']; do sleep 15; done && \
rake wallet:create['hot','http://0.0.0.0:8545','changeme'] && \
rake wallet:create['warm','http://0.0.0.0:8545','changeme'] && \
Expand Down
4 changes: 2 additions & 2 deletions data/mysql/peatio_production.sql
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ CREATE TABLE `blockchains` (

LOCK TABLES `blockchains` WRITE;
/*!40000 ALTER TABLE `blockchains` DISABLE KEYS */;
INSERT INTO `blockchains` VALUES (1,'eth-rinkeby','Ethereum Rinkeby','ethereum','http://geth:8545',3741720,'https://rinkeby.etherscan.io/address/#{address}','https://rinkeby.etherscan.io/tx/#{txid}',6,'active','2019-01-22 15:18:02','2019-01-23 14:47:31'),(2,'eth-mainet','Ethereum Mainet','ethereum','http://geth:8545',5000000,'https://etherscan.io/address/#{address}','https://etherscan.io/tx/#{txid}',6,'disabled','2019-01-22 15:18:02','2019-01-22 15:18:02');
INSERT INTO `blockchains` VALUES (1,'eth-rinkeby','Ethereum Rinkeby','ethereum','http://parity:8545',3741720,'https://rinkeby.etherscan.io/address/#{address}','https://rinkeby.etherscan.io/tx/#{txid}',6,'active','2019-01-22 15:18:02','2019-01-23 14:47:31'),(2,'eth-mainet','Ethereum Mainet','ethereum','http://parity:8545',5000000,'https://etherscan.io/address/#{address}','https://etherscan.io/tx/#{txid}',6,'disabled','2019-01-22 15:18:02','2019-01-22 15:18:02');
/*!40000 ALTER TABLE `blockchains` ENABLE KEYS */;
UNLOCK TABLES;

Expand Down Expand Up @@ -614,7 +614,7 @@ CREATE TABLE `wallets` (

LOCK TABLES `wallets` WRITE;
/*!40000 ALTER TABLE `wallets` DISABLE KEYS */;
INSERT INTO `wallets` VALUES (1,'eth-rinkeby','eth','Ethereum Deposit Wallet','0x2b9fBC10EbAeEc28a8Fc10069C0BC29E45eBEB9C',100,1,'geth','{\"uri\":\"http://geth:8545\",\"secret\":\"changeme\"}',0.0000000000000000,NULL,'active','2019-01-22 15:18:04','2019-01-22 15:18:04'),(2,'eth-rinkeby','eth','Ethereum Hot Wallet','0x5929589a8a566dab8734e83d6c846ab7b7fb5acd',310,1,'geth','{\"uri\":\"http://geth:8545\",\"secret\":\"test\"}',100.0000000000000000,NULL,'active','2019-01-22 15:18:04','2019-01-22 21:40:02'),(3,'eth-rinkeby','eth','Ethereum Warm Wallet','0x2b9fBC10EbAeEc28a8Fc10069C0BC29E45eBEB9C',320,1,'geth','{\"uri\":\"http://geth:8545\",\"secret\":\"test\"}',1000.0000000000000000,NULL,'active','2019-01-22 15:18:04','2019-01-22 15:18:04'),(4,'eth-rinkeby','kyn','Kayen Deposit Wallet','0xd5b4babbaced6ada70bc5251331f7494ad8f97f5',100,1,'geth','{\"uri\":\"http://geth:8545\",\"secret\":\"changeme\"}',0.0000000000000000,NULL,'active','2019-01-22 18:07:52','2019-01-22 19:26:18'),(5,'eth-rinkeby','trst','TRST Deposit Wallet','0x4f77b1b2b6ce79216fc9cc967a9ed016960acd60',100,1,'geth','{\"uri\":\"http://geth:8545\",\"secret\":\"changeme\"}',0.0000000000000000,NULL,'active','2019-01-22 18:08:08','2019-01-22 19:26:25'),(6,'eth-rinkeby','eth','Ethereum Fee Wallet','0x5929589a8a566dab8734e83d6c846ab7b7fb5acd',200,1,'geth','{\"uri\":\"http://geth:8545\",\"secret\":\"test\"}',0.0000000000000000,NULL,'active','2019-01-22 21:16:15','2019-01-22 21:40:16'),(7,'eth-rinkeby','kyn','KYN Hot Wallet','0x5929589a8a566dab8734e83d6c846ab7b7fb5acd',310,1,'geth','{\"uri\":\"http://geth:8545\",\"secret\":\"test\"}',0.0000000000000000,NULL,'active','2019-01-22 21:53:46','2019-01-22 21:53:46');
INSERT INTO `wallets` VALUES (1,'eth-rinkeby','eth','Ethereum Deposit Wallet','0x2b9fBC10EbAeEc28a8Fc10069C0BC29E45eBEB9C',100,1,'parity','{\"uri\":\"http://parity:8545\",\"secret\":\"changeme\"}',0.0000000000000000,NULL,'active','2019-01-22 15:18:04','2019-01-22 15:18:04'),(2,'eth-rinkeby','eth','Ethereum Hot Wallet','0x5929589a8a566dab8734e83d6c846ab7b7fb5acd',310,1,'parity','{\"uri\":\"http://parity:8545\",\"secret\":\"test\"}',100.0000000000000000,NULL,'active','2019-01-22 15:18:04','2019-01-22 21:40:02'),(3,'eth-rinkeby','eth','Ethereum Warm Wallet','0x2b9fBC10EbAeEc28a8Fc10069C0BC29E45eBEB9C',320,1,'parity','{\"uri\":\"http://parity:8545\",\"secret\":\"test\"}',1000.0000000000000000,NULL,'active','2019-01-22 15:18:04','2019-01-22 15:18:04'),(4,'eth-rinkeby','kyn','Kayen Deposit Wallet','0xd5b4babbaced6ada70bc5251331f7494ad8f97f5',100,1,'parity','{\"uri\":\"http://parity:8545\",\"secret\":\"changeme\"}',0.0000000000000000,NULL,'active','2019-01-22 18:07:52','2019-01-22 19:26:18'),(5,'eth-rinkeby','trst','TRST Deposit Wallet','0x4f77b1b2b6ce79216fc9cc967a9ed016960acd60',100,1,'parity','{\"uri\":\"http://parity:8545\",\"secret\":\"changeme\"}',0.0000000000000000,NULL,'active','2019-01-22 18:08:08','2019-01-22 19:26:25'),(6,'eth-rinkeby','eth','Ethereum Fee Wallet','0x5929589a8a566dab8734e83d6c846ab7b7fb5acd',200,1,'parity','{\"uri\":\"http://parity:8545\",\"secret\":\"test\"}',0.0000000000000000,NULL,'active','2019-01-22 21:16:15','2019-01-22 21:40:16'),(7,'eth-rinkeby','kyn','KYN Hot Wallet','0x5929589a8a566dab8734e83d6c846ab7b7fb5acd',310,1,'parity','{\"uri\":\"http://parity:8545\",\"secret\":\"test\"}',0.0000000000000000,NULL,'active','2019-01-22 21:53:46','2019-01-22 21:53:46');
/*!40000 ALTER TABLE `wallets` ENABLE KEYS */;
UNLOCK TABLES;

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/aws-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ When the configuration is ready, run
```bash
bundle install
rake render:config
rake geth:import && \
rake parity:import && \
until rake wallet:create['deposit','http://0.0.0.0:8545','changeme']; do sleep 15; done && \
rake wallet:create['hot','http://0.0.0.0:8545','changeme'] && \
rake wallet:create['warm','http://0.0.0.0:8545','changeme'] && \
Expand Down
21 changes: 0 additions & 21 deletions lib/tasks/geth.rake

This file was deleted.

4 changes: 2 additions & 2 deletions lib/tasks/service.rake
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ namespace :service do

def start
puts '----- Starting cryptonodes -----'
sh 'docker-compose up -d geth'
sh 'docker-compose up -d parity'
end

def stop
puts '----- Stopping cryptonodes -----'
sh 'docker-compose rm -fs geth'
sh 'docker-compose rm -fs parity'
end

@switch.call(args, method(:start), method(:stop))
Expand Down
30 changes: 15 additions & 15 deletions templates/compose/cryptonodes.yaml.erb
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
version: '3.6'

services:
geth:
image: ethereum/client-go:stable
parity:
image: parity/parity:v2.5.8-stable
restart: always
command: |
--syncmode=full
--rinkeby
--rpc
--rpcaddr=0.0.0.0
--rpcport=8545
--port=30303
--rpcapi="db,personal,eth,net,web3"
--rpccorsdomain="*"
--rpcvhosts="*"
--chain=kovan
--mode=active
--interface=all
--warp=true
--snapshot-peers=10
--min-peers=5
--max-peers=10
--jsonrpc-interface=0.0.0.0
--jsonrpc-cors=all
--jsonrpc-hosts=all
--jsonrpc-apis=all
--db-compaction=ssd
volumes:
- ../data/geth:/root/.ethereum/
expose:
- "8545"
- "30303"
- ../data/parity:/home/parity/.local/share/io.parity.ethereum
ports:
- "8545:8545"
labels:
Expand Down
8 changes: 4 additions & 4 deletions templates/config/peatio/seed/blockchains.yml.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- key: eth-rinkeby
name: Ethereum Rinkeby
client: geth # API client name.
server: http://geth:8545 # Public Ethereum node endpoint. IMPORTANT: full syncmode.
client: parity # API client name.
server: http://parity:8545 # Public Ethereum node endpoint. IMPORTANT: full syncmode.
height: 4000000 # Initial block number from which sync will be started.
min_confirmations: 6 # Minimal confirmations needed for withdraw and deposit confirmation.
explorer:
Expand All @@ -11,8 +11,8 @@

- key: eth-mainet
name: Ethereum Mainet
client: geth # API client name.
server: http://geth:8545 # Public Ethereum node endpoint. IMPORTANT: full syncmode.
client: parity # API client name.
server: http://parity:8545 # Public Ethereum node endpoint. IMPORTANT: full syncmode.
height: 7500000 # Initial block number from which sync will be started.
min_confirmations: 6 # Minimal confirmations needed for withdraw and deposit confirmation.
explorer:
Expand Down
4 changes: 2 additions & 2 deletions templates/config/peatio/seed/wallets.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
kind: <%= wallet['kind'] %>
max_balance: <%= wallet['max_balance'] %>
status: active
gateway: geth
gateway: parity
settings:
uri: http://geth:8545
uri: http://parity:8545
secret: '<%= wallet['secret'] %>'
<% end %>

0 comments on commit c200bc1

Please sign in to comment.