Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ jobs:
- run:
name: Add hosts
command: |
echo 0.0.0.0 api.wb.local | sudo tee -a /etc/hosts && \
echo 0.0.0.0 auth.wb.local | sudo tee -a /etc/hosts && \
echo 0.0.0.0 www.wb.local | sudo tee -a /etc/hosts && \
echo 0.0.0.0 peatio.wb.local | sudo tee -a /etc/hosts && \
echo 0.0.0.0 barong.wb.local | sudo tee -a /etc/hosts && \
echo 0.0.0.0 ws.ranger.wb.local | sudo tee -a /etc/hosts
- run:
name: Download apps
Expand All @@ -33,9 +34,6 @@ jobs:
- run:
name: Run workbench
command: "make start"
- run:
name: Run integration tests
command: "make test"

workflows:
version: 2
Expand Down
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
COMPOSE_PROJECT_NAME=workbench
COMPOSE_FILE=compose/app.yaml:compose/backend.yaml:compose/cryptonodes.yaml:compose/daemons.yaml:compose/proxy.yaml:compose/tests.yaml
COMPOSE_FILE=compose/app.yaml:compose/backend.yaml:compose/cryptonodes.yaml:compose/daemons.yaml:compose/proxy.yaml:compose/tests.yaml:compose/ui.yaml:compose/gateway.yaml
14 changes: 5 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
[submodule "peatio"]
path = app/peatio
url = https://github.com/rubykube/peatio.git
branch = "1-9-stable"
branch = "master"
[submodule "barong"]
path = app/barong
url = https://github.com/rubykube/barong.git
branch = "1-9-stable"
[submodule "trading-ui"]
path = app/trading-ui
url = https://github.com/rubykube/peatio-trading-ui.git
branch = "1-9-stable"
[submodule "integration"]
path = test/integration
url = https://github.com/rubykube/integration.git
branch = "master"
[submodule "tower"]
path = app/tower
url = https://github.com/openware/tower.git
branch = "master"
[submodule "toolbox"]
path = test/toolbox
Expand Down
46 changes: 19 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,34 @@
COMPOSE = docker-compose

default: run

pull:
$(COMPOSE) pull vault \
@$(COMPOSE) pull vault \
db \
phpmyadmin \
redis \
rabbitmq \
mailcatcher \
ranger \
coinhub \
geth
coinhub

config:
@echo "Rendering configuration..."
@echo -e "\e[34mRendering configuration...\e[0m"
@bundle exec rake config:render

build: config pull
$(COMPOSE) build peatio \
barong \
trading_ui \
integration
@$(COMPOSE) build peatio barong

geth:
@$(COMPOSE) up -d geth

bitcoin:
@echo "Updating peatio configuration..."
@echo -e "\e[34mUpdating peatio configuration...\e[0m"
@cp config/peatio-seed-btc/*.yml config/peatio/seed/
@echo "Starting bitcoind container..."
@echo -e "\e[34mStarting bitcoind container...\e[0m"
@$(COMPOSE) up -d bitcoind

cryptonodes: geth

daemons:
$(COMPOSE) up --build -d withdraw_audit \
@$(COMPOSE) up --build -d withdraw_audit \
blockchain \
global_state \
deposit_collection \
Expand All @@ -52,32 +46,30 @@ daemons:
k

dependencies:
$(COMPOSE) up -d vault db phpmyadmin redis rabbitmq mailcatcher ranger coinhub
$(COMPOSE) run --rm vault secrets enable totp || true
@$(COMPOSE) up -d vault db redis rabbitmq mailcatcher ranger coinhub
@$(COMPOSE) run --rm vault secrets enable totp || true

proxy:
@touch config/acme.json && chmod 0600 config/acme.json

prepare: proxy dependencies daemons cryptonodes
prepare: proxy dependencies daemons

setup-apps: build
$(COMPOSE) run --rm peatio bash -c "./bin/link_config && bundle exec rake db:create db:migrate db:seed"
$(COMPOSE) run --rm barong bash -c "./bin/link_config && ./bin/setup"

run: prepare setup-apps
$(COMPOSE) up --build -d peatio barong trading_ui proxy
@$(COMPOSE) run --rm peatio bash -c "./bin/link_config && bundle exec rake db:create db:migrate db:seed"
@$(COMPOSE) run --rm barong bash -c "./bin/link_config && ./bin/setup"

test:
@$(COMPOSE) run --rm integration
run: config prepare setup-apps
@$(COMPOSE) up --build -d peatio barong proxy mikroapp tower gateway

stress:
@bundle exec rake toolbox:run

start: config prepare setup-apps
$(COMPOSE) up -d peatio barong trading_ui proxy
@$(COMPOSE) up -d peatio barong proxy mikroapp tower gateway

update:
git submodule update --init --remote
@git submodule update --init --remote

down:
@$(COMPOSE) down
@echo -e "\e[1;31mRemoving docker containers...\e[0m"
@$(COMPOSE) rm -fsv
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ make build
make bitcoin
```

This will create new seeds and start `bitcoind` docker container.
6. **Optional:** Start ethereum blockchain node

```sh
make geth
```

6. Run the application

Expand All @@ -56,8 +60,7 @@ make run
You should add those hosts to your `/etc/hosts` file:

```
0.0.0.0 api.wb.local
0.0.0.0 auth.wb.local
0.0.0.0 www.wb.local

0.0.0.0 ws.ranger.wb.local

Expand Down
2 changes: 1 addition & 1 deletion app/barong
Submodule barong updated 432 files
2 changes: 1 addition & 1 deletion app/peatio
Submodule peatio updated 298 files
1 change: 1 addition & 0 deletions app/tower
Submodule tower added at 3003dc
1 change: 0 additions & 1 deletion app/trading-ui
Submodule trading-ui deleted from b9908c
27 changes: 2 additions & 25 deletions compose/app.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.6'
version: '3.7'

services:
peatio:
Expand All @@ -11,7 +11,6 @@ services:
- rabbitmq
- barong
- ranger
- geth
- coinhub
env_file:
- ../config/peatio.env
Expand All @@ -23,10 +22,6 @@ services:
- ../config/peatio/plugins.yml:/opt/peatio/config/plugins.yml
- ../app/peatio/app:/home/app/app
- ../app/peatio/lib:/home/app/lib
labels:
traefik.enable: true
traefik.frontend.rule: 'Host: api.wb.local'
traefik.port: 8000
command: bash -c "bin/link_config && bundle exec puma --config config/puma.rb"

barong:
Expand All @@ -41,24 +36,6 @@ services:
- ../config/barong.env
volumes:
- ../config/barong:/opt/barong/config:ro
- ../config/keys/barong.key:/secrets/barong.key
expose:
- "8001"
labels:
traefik.enable: true
traefik.frontend.rule: 'Host: auth.wb.local'
traefik.port: 8001

trading_ui:
build:
context: ../app/trading-ui
depends_on:
- proxy
- peatio
env_file:
- ../config/trading-ui.env
expose:
- "8002"
labels:
traefik.enable: true
traefik.frontend.rule: 'Host: api.wb.local; PathPrefix:/trading, /trading-ui-assets'
traefik.port: 8002
25 changes: 4 additions & 21 deletions compose/backend.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
version: '3.6'
version: '3.7'

services:
db:
image: mysql:5.7
volumes:
- ../config/mysql/my.cnf:/etc/mysql/my.cnf
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: changeme
Expand All @@ -13,29 +12,13 @@ services:
image: rubykube/coinhub

redis:
image: redis:4.0.10
image: redis:4-alpine
restart: always
volumes:
- redis_data:/data

phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: always
depends_on:
- db
environment:
PMA_HOST: db
PMA_USER: root
PMA_PASSWORD: changeme
PHP_UPLOAD_MAX_FILESIZE: 1G
PHP_MAX_INPUT_VARS: 1G
labels:
traefik.enable: true
traefik.frontend.rule: 'Host: pma.wb.local'
traefik.port: 80

rabbitmq:
image: rabbitmq:3.7.6-management
image: rabbitmq:3.7-alpine
restart: always
volumes:
- rabbitmq_data:/var/lib/rabbitmq
Expand All @@ -45,7 +28,7 @@ services:
traefik.port: 15672

vault:
image: vault:0.10.2
image: vault:1.0.1
restart: always
environment:
SKIP_SETCAP: 1
Expand Down
4 changes: 2 additions & 2 deletions compose/cryptonodes.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: '3.6'
version: '3.7'

services:
geth:
image: ethereum/client-go:stable
image: ethereum/client-go:alpine
restart: always
command: |
--syncmode=full
Expand Down
3 changes: 1 addition & 2 deletions compose/daemons.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.6'
version: '3.7'

x-daemon: &peatio-daemon
build:
Expand All @@ -9,7 +9,6 @@ x-daemon: &peatio-daemon
- db
- redis
- rabbitmq
- geth
- barong
- ranger
- coinhub
Expand Down
14 changes: 14 additions & 0 deletions compose/gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.7'

services:
gateway:
image: quay.io/datawire/ambassador:0.40.2
volumes:
- ../config/gateway:/ambassador/ambassador-config
ports:
- '8081:80'
- '8877:8877'
labels:
traefik.enable: true
traefik.frontend.rule: "Host: www.wb.local; PathPrefix: /api/, /admin, /assets/"
traefik.port: 80
11 changes: 1 addition & 10 deletions compose/proxy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.6'
version: '3.7'

services:
proxy:
Expand All @@ -10,15 +10,6 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
- ../config/traefik.toml:/etc/traefik/traefik.toml:ro
- ../config/acme.json:/acme.json
networks:
default:
aliases:
- api.wb.local
- auth.wb.local
- ws.ranger.wb.local
- pma.wb.local
- eth.wb.local
- monitor.wb.local
labels:
traefik.enable: true
traefik.frontend.rule: 'Host: monitor.wb.local'
Expand Down
8 changes: 1 addition & 7 deletions compose/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
version: '3.6'
version: '3.7'

services:
integration:
build:
context: ../test/integration
volumes:
- ../config/integration/fixtures:/usr/src/app/src/fixtures/

toolbox:
build:
context: ../test/toolbox
Expand Down
21 changes: 21 additions & 0 deletions compose/ui.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3.7'

services:
mikroapp:
image: rubykube/mikroapp
labels:
traefik.enable: true
traefik.frontend.rule: "Host:www.wb.local; PathPrefix: /"
traefik.port: 3000

tower:
build:
context: ../app/tower
dockerfile: Dockerfile.dev
volumes:
- ../app/tower:/home/node
labels:
traefik.enable: true
traefik.frontend.rule: "Host:www.wb.local; PathPrefix: /tower"
traefik.port: 3000

Loading