From 135fd137d2e40a4a44c58a16f34a96584ca41f87 Mon Sep 17 00:00:00 2001 From: Ali Shanaakh Date: Thu, 27 Dec 2018 12:24:33 +0200 Subject: [PATCH 1/8] Remove trading-ui --- .gitmodules | 4 ---- Makefile | 5 ++--- app/trading-ui | 1 - compose/app.yaml | 15 --------------- config/trading-ui.env | 5 ----- 5 files changed, 2 insertions(+), 28 deletions(-) delete mode 160000 app/trading-ui delete mode 100644 config/trading-ui.env diff --git a/.gitmodules b/.gitmodules index c70b7876..32732f76 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,10 +6,6 @@ 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 diff --git a/Makefile b/Makefile index 2f8ddae0..1eac8f6f 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,6 @@ config: build: config pull $(COMPOSE) build peatio \ barong \ - trading_ui \ integration geth: @@ -65,7 +64,7 @@ setup-apps: build $(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) up --build -d peatio barong proxy test: @$(COMPOSE) run --rm integration @@ -74,7 +73,7 @@ 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 update: git submodule update --init --remote diff --git a/app/trading-ui b/app/trading-ui deleted file mode 160000 index b9908c73..00000000 --- a/app/trading-ui +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b9908c730922d30842c843516a264ed2c5ec326e diff --git a/compose/app.yaml b/compose/app.yaml index 89109309..3a5b72cc 100644 --- a/compose/app.yaml +++ b/compose/app.yaml @@ -47,18 +47,3 @@ services: 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 diff --git a/config/trading-ui.env b/config/trading-ui.env deleted file mode 100644 index 4ca4ddec..00000000 --- a/config/trading-ui.env +++ /dev/null @@ -1,5 +0,0 @@ -RAILS_ENV=development -PLATFORM_ROOT_URL=http://api.wb.local/ -FRONTEND_ROOT_URL=http://api.wb.local/ -TITLE=Workbench Peatio -PORT=8002 From 31f7f15dbb915bf4085faf988fd071ce68c8b382 Mon Sep 17 00:00:00 2001 From: Ali Shanaakh Date: Thu, 27 Dec 2018 12:27:05 +0200 Subject: [PATCH 2/8] Switch git submodules to master --- .gitmodules | 4 ++-- app/barong | 2 +- app/peatio | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index 32732f76..9d6910a4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,11 +1,11 @@ [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" + branch = "master" [submodule "integration"] path = test/integration url = https://github.com/rubykube/integration.git diff --git a/app/barong b/app/barong index 410ded9e..3d07b256 160000 --- a/app/barong +++ b/app/barong @@ -1 +1 @@ -Subproject commit 410ded9efebf6818baabc610229002c7f927d9f3 +Subproject commit 3d07b25684a464de894f7f388fb8d35de9364c0d diff --git a/app/peatio b/app/peatio index bc85f35d..07ff15de 160000 --- a/app/peatio +++ b/app/peatio @@ -1 +1 @@ -Subproject commit bc85f35dc9eb5538581a5f84b2e6b0fecad75bbb +Subproject commit 07ff15de0666f5614801f7d2cee06ba6490750a9 From 6bc7127fc87dbaf652dc030c72b77a6416d13917 Mon Sep 17 00:00:00 2001 From: Ali Shanaakh Date: Thu, 27 Dec 2018 17:00:58 +0200 Subject: [PATCH 3/8] Integrate api gateway --- .env | 2 +- .gitmodules | 4 + Makefile | 4 +- app/tower | 1 + compose/app.yaml | 9 +- compose/gateway.yaml | 14 +++ compose/proxy.yaml | 9 -- compose/ui.yaml | 21 ++++ config/barong.env.erb | 30 ++--- config/barong/seeds.yml | 183 ++++++++---------------------- config/gateway/ambassador.yaml | 4 + config/gateway/authorization.yaml | 7 ++ config/gateway/mapping.yaml | 46 ++++++++ config/peatio.env.erb | 10 +- 14 files changed, 161 insertions(+), 183 deletions(-) create mode 160000 app/tower create mode 100644 compose/gateway.yaml create mode 100644 compose/ui.yaml create mode 100644 config/gateway/ambassador.yaml create mode 100644 config/gateway/authorization.yaml create mode 100644 config/gateway/mapping.yaml diff --git a/.env b/.env index 9af4c1a6..adc96f26 100644 --- a/.env +++ b/.env @@ -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 diff --git a/.gitmodules b/.gitmodules index 9d6910a4..d8120309 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,6 +6,10 @@ path = app/barong url = https://github.com/rubykube/barong.git branch = "master" +[submodule "tower"] + path = app/tower + url = https://github.com/openware/tower.git + branch = "master" [submodule "integration"] path = test/integration url = https://github.com/rubykube/integration.git diff --git a/Makefile b/Makefile index 1eac8f6f..f96d412a 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ setup-apps: build $(COMPOSE) run --rm barong bash -c "./bin/link_config && ./bin/setup" run: prepare setup-apps - $(COMPOSE) up --build -d peatio barong proxy + $(COMPOSE) up --build -d peatio barong proxy mikroapp tower gateway test: @$(COMPOSE) run --rm integration @@ -73,7 +73,7 @@ stress: @bundle exec rake toolbox:run start: config prepare setup-apps - $(COMPOSE) up -d peatio barong proxy + $(COMPOSE) up -d peatio barong proxy mikroapp tower gateway update: git submodule update --init --remote diff --git a/app/tower b/app/tower new file mode 160000 index 00000000..933541ca --- /dev/null +++ b/app/tower @@ -0,0 +1 @@ +Subproject commit 933541ca3fa8ae737d4244a2871413b57de785b5 diff --git a/compose/app.yaml b/compose/app.yaml index 3a5b72cc..4b0aefec 100644 --- a/compose/app.yaml +++ b/compose/app.yaml @@ -23,10 +23,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: @@ -41,9 +37,6 @@ services: - ../config/barong.env volumes: - ../config/barong:/opt/barong/config:ro + - ../config/keys/barong.key:/secret/barong.key expose: - "8001" - labels: - traefik.enable: true - traefik.frontend.rule: 'Host: auth.wb.local' - traefik.port: 8001 diff --git a/compose/gateway.yaml b/compose/gateway.yaml new file mode 100644 index 00000000..6d53df06 --- /dev/null +++ b/compose/gateway.yaml @@ -0,0 +1,14 @@ +version: '3.6' + +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, peatio.wb.local; PathPrefix: /api/, /admin, /assets/" + traefik.port: 80 diff --git a/compose/proxy.yaml b/compose/proxy.yaml index 09112d45..735496de 100644 --- a/compose/proxy.yaml +++ b/compose/proxy.yaml @@ -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' diff --git a/compose/ui.yaml b/compose/ui.yaml new file mode 100644 index 00000000..091e13f4 --- /dev/null +++ b/compose/ui.yaml @@ -0,0 +1,21 @@ +version: '3.6' + +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 + diff --git a/config/barong.env.erb b/config/barong.env.erb index c231b035..e88236e9 100644 --- a/config/barong.env.erb +++ b/config/barong.env.erb @@ -1,29 +1,23 @@ PORT=8001 -API_CORS_ORIGINS=http://api.wb.local -API_CORS_ALLOW_CREDENTIALS=true - -ROOT_DOMAIN=wb.local - LOG_LEVEL=debug -RAILS_ENV=development +DISABLE_SPRING=true -SMTP_ADDRESS=mailcatcher -SMTP_PORT=1025 -SMTP_URL_ADDRESS=auth.wb.local +RAILS_ENV=development DATABASE_HOST=db DATABASE_USER=root -DATABASE_PASSWORD=changeme - -VAULT_TOKEN=changeme -VAULT_ADDR=http://vault:8200 +DATABASE_PASS=changeme -TWILIO_ACCOUNT_SID=changeme -TWILIO_AUTH_TOKEN=changeme -TWILIO_PHONE_NUMBER=changeme +JWT_PUBLIC_KEY=<%= @jwt_public_key %> +JWT_PRIVATE_KEY=/secrets/barong.key -SEEDS_FILE=/opt/barong/config/seeds.yml +VAULT_ADDRESS=http://vault:8200 -JWT_SHARED_SECRET_KEY=<%= @jwt_private_key %> +EVENT_API_JWT_PRIVATE_KEY=<%= @jwt_private_key %> +EVENT_API_JWT_ALGORITHM=RS256 +EVENT_API_RABBITMQ_HOST=rabbitmq +EVENT_API_RABBITMQ_PORT=5672 +EVENT_API_RABBITMQ_USERNAME=guest +EVENT_API_RABBITMQ_PASSWORD=guest \ No newline at end of file diff --git a/config/barong/seeds.yml b/config/barong/seeds.yml index 5a9318b6..7226dc73 100644 --- a/config/barong/seeds.yml +++ b/config/barong/seeds.yml @@ -5,143 +5,54 @@ # model properties are listed at the very bottom of this models files. # # Note: email is the only required field here. -accounts: - - account: - email: admin@barong.io - password: "Chah5YohWm" - role: admin - state: active - level: 3 - - account: - email: philliparuais@gmail.com - password: "aikohMai7oh" - role: admin - state: active - level: 3 - phone: - country: "FR" - number: "33755882002" - profile: - dob: "1982-12-22" - first_name: "Phillipa" - last_name: "Ruais" - address: "62 boulevard d'Alsace" - postcode: "78140" - city: "Velizy-Villacoublay" - country: "FR" - - account: - email: antoinepelletier@gmail.com - password: "dous8Roh8aang" - role: member - state: active - level: 0 - phone: - country: "FR" - number: "33755882189" - profile: - dob: "1961-11-14" - first_name: "Antoine" - last_name: "Pelletier" - address: "94 rue Charles Corbeau" - postcode: "76400" - city: "Fecamp" - country: "FR" - - account: - email: cecilevaillancourt@gmail.com - password: "mooC6yaebie" - role: member - state: active - level: 1 - phone: - country: "FR" - number: "40729371571" - profile: - dob: "1984-05-22" - first_name: "Cecile" - last_name: "Vaillancourt" - address: "45 rue Saint Germain" - postcode: "92230" - city: "Gennevilliers" - country: "FR" - - account: - email: charmaineouellet@gmail.com - password: "aeR2yahquei" - role: member - state: active - level: 2 - phone: - country: "FR" - number: "447383453439" - profile: - dob: "1988-05-25" - first_name: "Charmaine" - last_name: "Ouellet" - address: "22 rue du President Roosevelt" - postcode: "49400" - city: "Saumur" - country: "FR" - - account: - email: ramonlmccourt@gmail.com - password: "Ucie8chiepah" - role: member - state: active - level: 3 - phone: - country: "US" - number: "17542058966" - profile: - dob: "1964-08-14" - first_name: "Ramon" - last_name: "McCourt" - address: "224 Spirit Drive" - postcode: "32008" - city: "Branford" - country: "US" - - account: - email: amyjbriggs@gmail.com - password: "Ahniexa9" - role: member - state: active - level: 3 - phone: - country: "US" - number: "17722002528" - profile: - dob: "1968-12-22" - first_name: "Amy" - last_name: "Briggs" - address: "3848 Mount Tabor" - postcode: "10601" - city: "White Plains" - country: "US" - - account: - email: davidtmoore@gmail.com - password: "Ozeiphib5" - role: member - state: active - level: 3 - phone: - country: "US" - number: "19706823057" - profile: - dob: "1935-10-27" - first_name: "David" - last_name: "Moore" - address: "41 Aviation Way" - postcode: "90071" - city: "Los Angeles" - country: "US" +users: + - email: admin@barong.io + password: "Chah5YohWm" + role: admin + state: active + level: 3 -# List of applications that will use Barong OAuth. -# You can set any Doorkeeper::Application property here. -# -# Note: in production env, `redirect_uri` can only be a 'https' url. -applications: - - name: "Peatio" - redirect_uri: "http://api.wb.local/auth/barong/callback" - skipauth: true - uid: "a68be319fca51caca60eed5711226e568bd1c1d13ff452b945515f1a6ffbaca4" - secret: "ab80e2c843861c4d23e63f5472cd1c9ee6f55e388863e21f22b03a9093977f29" + - email: philliparuais@gmail.com + password: "aikohMai7oh" + role: admin + state: active + level: 3 + + - email: antoinepelletier@gmail.com + password: "dous8Roh8aang" + role: member + state: active + level: 0 + + - email: cecilevaillancourt@gmail.com + password: "mooC6yaebie" + role: member + state: active + level: 1 + + - email: charmaineouellet@gmail.com + password: "aeR2yahquei" + role: member + state: active + level: 2 + + - email: ramonlmccourt@gmail.com + password: "Ucie8chiepah" + role: member + state: active + level: 3 + + - email: amyjbriggs@gmail.com + password: "Ahniexa9" + role: member + state: active + level: 3 + + - email: davidtmoore@gmail.com + password: "Ozeiphib5" + role: member + state: active + level: 3 levels: - key: email diff --git a/config/gateway/ambassador.yaml b/config/gateway/ambassador.yaml new file mode 100644 index 00000000..718a51ee --- /dev/null +++ b/config/gateway/ambassador.yaml @@ -0,0 +1,4 @@ +apiVersion: ambassador/v0 +kind: Module +name: ambassador +config: {} diff --git a/config/gateway/authorization.yaml b/config/gateway/authorization.yaml new file mode 100644 index 00000000..f4b711cc --- /dev/null +++ b/config/gateway/authorization.yaml @@ -0,0 +1,7 @@ +apiVersion: ambassador/v0 +kind: AuthService +name: authorization +auth_service: barong:8001 +path_prefix: /api/v2/identity/sessions/authorize +allowed_headers: + - "Authorization" diff --git a/config/gateway/mapping.yaml b/config/gateway/mapping.yaml new file mode 100644 index 00000000..dc6d8164 --- /dev/null +++ b/config/gateway/mapping.yaml @@ -0,0 +1,46 @@ +apiVersion: ambassador/v0 +kind: Mapping +name: peatio_api_mapping +host: www.wb.local +prefix: /api/v2/peatio +rewrite: /api/v2/ +service: peatio:8000 +--- +apiVersion: ambassador/v0 +kind: Mapping +name: peatio_admin_mapping +host: www.wb.local +prefix: /admin +rewrite: "" +service: peatio:8000 +--- +apiVersion: ambassador/v0 +kind: Mapping +name: peatio_assets_mapping +host: www.wb.local +prefix: /assets +service: peatio:8000 +--- +apiVersion: ambassador/v0 +kind: Mapping +name: barong_api_mapping +host: www.wb.local +prefix: /api/v2/barong +rewrite: /api/v2/ +service: barong:8001 +--- +apiVersion: ambassador/v0 +kind: Mapping +name: peatio_app_mapping +host: peatio.wb.local +prefix: / +rewrite: / +service: peatio:8000 +--- +apiVersion: ambassador/v0 +kind: Mapping +name: barong_app_mapping +host: barong.wb.local +prefix: / +rewrite: / +service: barong:8001 diff --git a/config/peatio.env.erb b/config/peatio.env.erb index 24d0606f..7ce6fc55 100644 --- a/config/peatio.env.erb +++ b/config/peatio.env.erb @@ -2,7 +2,7 @@ RAILS_ENV=development RAILS_ROOT=/home/app PORT=8000 -URL_HOST=api.wb.local +URL_HOST=www.wb.local LOG_LEVEL=debug @@ -19,14 +19,6 @@ RABBITMQ_HOST=rabbitmq RANGER_HOST=ws.ranger.wb.local RANGER_PORT=80 -SMTP_PORT=25 -SMTP_DOMAIN=helioscloud.com -SMTP_ADDRESS=smtp_relay -SMTP_USE_SSL="false" -SMTP_USE_TLS="false" -SMTP_ENABLE_STARTTLS="false" -SMTP_ENABLE_STARTTLS_AUTO="false" - OAUTH2_SIGN_IN_PROVIDER=barong BARONG_DOMAIN=http://auth.wb.local BARONG_CLIENT_ID=a68be319fca51caca60eed5711226e568bd1c1d13ff452b945515f1a6ffbaca4 From 359e8907a685cbc49a651077c088b55f454e7d20 Mon Sep 17 00:00:00 2001 From: Ali Shanaakh Date: Thu, 27 Dec 2018 17:05:42 +0200 Subject: [PATCH 4/8] Remove integration tests --- Makefile | 3 -- compose/tests.yaml | 6 ---- config/integration/fixtures/barong.json | 3 -- config/integration/fixtures/currencies.json | 34 --------------------- config/integration/fixtures/peatio.json | 3 -- config/integration/fixtures/user.json | 4 --- test/integration | 1 - 7 files changed, 54 deletions(-) delete mode 100644 config/integration/fixtures/barong.json delete mode 100644 config/integration/fixtures/currencies.json delete mode 100644 config/integration/fixtures/peatio.json delete mode 100644 config/integration/fixtures/user.json delete mode 160000 test/integration diff --git a/Makefile b/Makefile index f96d412a..499c4375 100644 --- a/Makefile +++ b/Makefile @@ -66,9 +66,6 @@ setup-apps: build run: prepare setup-apps $(COMPOSE) up --build -d peatio barong proxy mikroapp tower gateway -test: - @$(COMPOSE) run --rm integration - stress: @bundle exec rake toolbox:run diff --git a/compose/tests.yaml b/compose/tests.yaml index c676dd17..58553682 100644 --- a/compose/tests.yaml +++ b/compose/tests.yaml @@ -1,12 +1,6 @@ version: '3.6' services: - integration: - build: - context: ../test/integration - volumes: - - ../config/integration/fixtures:/usr/src/app/src/fixtures/ - toolbox: build: context: ../test/toolbox diff --git a/config/integration/fixtures/barong.json b/config/integration/fixtures/barong.json deleted file mode 100644 index 2b6e0b6f..00000000 --- a/config/integration/fixtures/barong.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "host": "http://auth.wb.local/" -} diff --git a/config/integration/fixtures/currencies.json b/config/integration/fixtures/currencies.json deleted file mode 100644 index 33a2ddd3..00000000 --- a/config/integration/fixtures/currencies.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "Fiats": [ - "USD", - "EUR" - ], - "Ethereums": [ - "ETH", - "TRST" - ], - "ETH": { - "client": "ethereum", - "explorerAddress": "/address/#{address}", - "explorerTransaction": "/tx/#{txid}", - "baseFactor": "1000000000000000000", - "gateway": "geth", - "blockchainKeyPrefix": "eth" - }, - "TRST": { - "client": "", - "explorerAddress": "", - "explorerTransaction": "", - "baseFactor": "1000000", - "gateway": "geth", - "blockchainKeyPrefix": "eth" - }, - "FIAT": { - "client": "", - "explorerAddress": "", - "explorerTransaction": "", - "baseFactor": "1", - "server": "", - "gateway": "" - } -} diff --git a/config/integration/fixtures/peatio.json b/config/integration/fixtures/peatio.json deleted file mode 100644 index bad56d8b..00000000 --- a/config/integration/fixtures/peatio.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "host": "http://api.wb.local/" -} diff --git a/config/integration/fixtures/user.json b/config/integration/fixtures/user.json deleted file mode 100644 index 4193b2b9..00000000 --- a/config/integration/fixtures/user.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "login": "admin@barong.io", - "password": "Chah5YohWm" -} diff --git a/test/integration b/test/integration deleted file mode 160000 index a41a7d39..00000000 --- a/test/integration +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a41a7d39be5f0e760e8d813b1de52e79e34ed33b From c45f210ba3214ae9ba45b89c6b0629a46191fc15 Mon Sep 17 00:00:00 2001 From: Ali Shanaakh Date: Thu, 27 Dec 2018 17:08:17 +0200 Subject: [PATCH 5/8] Fix issues --- .circleci/config.yml | 8 +++----- README.md | 3 +-- compose/gateway.yaml | 2 +- config/barong.env.erb | 2 +- config/gateway/mapping.yaml | 16 ---------------- config/peatio.env.erb | 2 +- config/toolbox.yaml.erb | 2 +- 7 files changed, 8 insertions(+), 27 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9e198a69..75ca7b5e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 @@ -33,9 +34,6 @@ jobs: - run: name: Run workbench command: "make start" - - run: - name: Run integration tests - command: "make test" workflows: version: 2 diff --git a/README.md b/README.md index 8e04c8ec..1ae39dea 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,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 diff --git a/compose/gateway.yaml b/compose/gateway.yaml index 6d53df06..0f298eae 100644 --- a/compose/gateway.yaml +++ b/compose/gateway.yaml @@ -10,5 +10,5 @@ services: - '8877:8877' labels: traefik.enable: true - traefik.frontend.rule: "Host: www.wb.local, peatio.wb.local; PathPrefix: /api/, /admin, /assets/" + traefik.frontend.rule: "Host: www.wb.local; PathPrefix: /api/, /admin, /assets/" traefik.port: 80 diff --git a/config/barong.env.erb b/config/barong.env.erb index e88236e9..4c634eae 100644 --- a/config/barong.env.erb +++ b/config/barong.env.erb @@ -20,4 +20,4 @@ EVENT_API_JWT_ALGORITHM=RS256 EVENT_API_RABBITMQ_HOST=rabbitmq EVENT_API_RABBITMQ_PORT=5672 EVENT_API_RABBITMQ_USERNAME=guest -EVENT_API_RABBITMQ_PASSWORD=guest \ No newline at end of file +EVENT_API_RABBITMQ_PASSWORD=guest diff --git a/config/gateway/mapping.yaml b/config/gateway/mapping.yaml index dc6d8164..ccb8f215 100644 --- a/config/gateway/mapping.yaml +++ b/config/gateway/mapping.yaml @@ -28,19 +28,3 @@ host: www.wb.local prefix: /api/v2/barong rewrite: /api/v2/ service: barong:8001 ---- -apiVersion: ambassador/v0 -kind: Mapping -name: peatio_app_mapping -host: peatio.wb.local -prefix: / -rewrite: / -service: peatio:8000 ---- -apiVersion: ambassador/v0 -kind: Mapping -name: barong_app_mapping -host: barong.wb.local -prefix: / -rewrite: / -service: barong:8001 diff --git a/config/peatio.env.erb b/config/peatio.env.erb index 7ce6fc55..c82bddd5 100644 --- a/config/peatio.env.erb +++ b/config/peatio.env.erb @@ -20,7 +20,7 @@ RANGER_HOST=ws.ranger.wb.local RANGER_PORT=80 OAUTH2_SIGN_IN_PROVIDER=barong -BARONG_DOMAIN=http://auth.wb.local +BARONG_DOMAIN=http://www.wb.local BARONG_CLIENT_ID=a68be319fca51caca60eed5711226e568bd1c1d13ff452b945515f1a6ffbaca4 BARONG_CLIENT_SECRET=ab80e2c843861c4d23e63f5472cd1c9ee6f55e388863e21f22b03a9093977f29 diff --git a/config/toolbox.yaml.erb b/config/toolbox.yaml.erb index 4c7f1d80..b133f691 100644 --- a/config/toolbox.yaml.erb +++ b/config/toolbox.yaml.erb @@ -1,6 +1,6 @@ # For other configuration options, see https://github.com/rubykube/toolbox/blob/master/bin/stress_trading -root-url: http://api.wb.local +root-url: http://www.wb.local currencies: usd,eur markets: eurusd From 43a27813d51f89f2b4f41a7a08a3f68d7eed923c Mon Sep 17 00:00:00 2001 From: Ali Shanaakh Date: Thu, 27 Dec 2018 17:47:33 +0200 Subject: [PATCH 6/8] Fixes --- .gitmodules | 4 ---- Makefile | 3 +-- compose/app.yaml | 2 +- config/barong.env.erb | 2 +- config/gateway/mapping.yaml | 3 +-- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.gitmodules b/.gitmodules index d8120309..223fe02c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,10 +10,6 @@ path = app/tower url = https://github.com/openware/tower.git branch = "master" -[submodule "integration"] - path = test/integration - url = https://github.com/rubykube/integration.git - branch = "master" [submodule "toolbox"] path = test/toolbox url = https://github.com/rubykube/toolbox.git diff --git a/Makefile b/Makefile index 499c4375..a95fb6e7 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,7 @@ config: build: config pull $(COMPOSE) build peatio \ - barong \ - integration + barong geth: @$(COMPOSE) up -d geth diff --git a/compose/app.yaml b/compose/app.yaml index 4b0aefec..1ff0983d 100644 --- a/compose/app.yaml +++ b/compose/app.yaml @@ -37,6 +37,6 @@ services: - ../config/barong.env volumes: - ../config/barong:/opt/barong/config:ro - - ../config/keys/barong.key:/secret/barong.key + - ../config/keys/barong.key:/secrets/barong.key expose: - "8001" diff --git a/config/barong.env.erb b/config/barong.env.erb index 4c634eae..e88b8fd4 100644 --- a/config/barong.env.erb +++ b/config/barong.env.erb @@ -11,7 +11,7 @@ DATABASE_USER=root DATABASE_PASS=changeme JWT_PUBLIC_KEY=<%= @jwt_public_key %> -JWT_PRIVATE_KEY=/secrets/barong.key +JWT_PRIVATE_KEY_PATH=/secrets/barong.key VAULT_ADDRESS=http://vault:8200 diff --git a/config/gateway/mapping.yaml b/config/gateway/mapping.yaml index ccb8f215..112fb572 100644 --- a/config/gateway/mapping.yaml +++ b/config/gateway/mapping.yaml @@ -10,8 +10,7 @@ apiVersion: ambassador/v0 kind: Mapping name: peatio_admin_mapping host: www.wb.local -prefix: /admin -rewrite: "" +prefix: /admin/ service: peatio:8000 --- apiVersion: ambassador/v0 From acf5aa5bf7cc4045dbd913cf95ebe9af477f0515 Mon Sep 17 00:00:00 2001 From: Ali Shanaakh Date: Fri, 28 Dec 2018 13:34:46 +0200 Subject: [PATCH 7/8] Update docker-compose file version --- compose/app.yaml | 2 +- compose/backend.yaml | 2 +- compose/cryptonodes.yaml | 2 +- compose/daemons.yaml | 2 +- compose/gateway.yaml | 2 +- compose/proxy.yaml | 2 +- compose/tests.yaml | 2 +- compose/ui.yaml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compose/app.yaml b/compose/app.yaml index 1ff0983d..4afae813 100644 --- a/compose/app.yaml +++ b/compose/app.yaml @@ -1,4 +1,4 @@ -version: '3.6' +version: '3.7' services: peatio: diff --git a/compose/backend.yaml b/compose/backend.yaml index 6294190f..ac579897 100644 --- a/compose/backend.yaml +++ b/compose/backend.yaml @@ -1,4 +1,4 @@ -version: '3.6' +version: '3.7' services: db: diff --git a/compose/cryptonodes.yaml b/compose/cryptonodes.yaml index 88f21f4f..ec07c6e2 100644 --- a/compose/cryptonodes.yaml +++ b/compose/cryptonodes.yaml @@ -1,4 +1,4 @@ -version: '3.6' +version: '3.7' services: geth: diff --git a/compose/daemons.yaml b/compose/daemons.yaml index 70292ed7..bd7de2d5 100644 --- a/compose/daemons.yaml +++ b/compose/daemons.yaml @@ -1,4 +1,4 @@ -version: '3.6' +version: '3.7' x-daemon: &peatio-daemon build: diff --git a/compose/gateway.yaml b/compose/gateway.yaml index 0f298eae..d023b809 100644 --- a/compose/gateway.yaml +++ b/compose/gateway.yaml @@ -1,4 +1,4 @@ -version: '3.6' +version: '3.7' services: gateway: diff --git a/compose/proxy.yaml b/compose/proxy.yaml index 735496de..455d9c94 100644 --- a/compose/proxy.yaml +++ b/compose/proxy.yaml @@ -1,4 +1,4 @@ -version: '3.6' +version: '3.7' services: proxy: diff --git a/compose/tests.yaml b/compose/tests.yaml index 58553682..c2b224c5 100644 --- a/compose/tests.yaml +++ b/compose/tests.yaml @@ -1,4 +1,4 @@ -version: '3.6' +version: '3.7' services: toolbox: diff --git a/compose/ui.yaml b/compose/ui.yaml index 091e13f4..f1597715 100644 --- a/compose/ui.yaml +++ b/compose/ui.yaml @@ -1,4 +1,4 @@ -version: '3.6' +version: '3.7' services: mikroapp: From 0e2448aefd9f89c4280dddb19b39f1d43b0808e2 Mon Sep 17 00:00:00 2001 From: Ali Shanaakh Date: Fri, 28 Dec 2018 13:42:55 +0200 Subject: [PATCH 8/8] Clean up unused containers --- Makefile | 41 ++++++++++++++----------------- README.md | 6 ++++- app/tower | 2 +- compose/app.yaml | 1 - compose/backend.yaml | 23 +++-------------- compose/cryptonodes.yaml | 2 +- compose/daemons.yaml | 1 - config/mysql/my.cnf | 53 ---------------------------------------- test/toolbox | 2 +- 9 files changed, 30 insertions(+), 101 deletions(-) delete mode 100644 config/mysql/my.cnf diff --git a/Makefile b/Makefile index a95fb6e7..7299710f 100644 --- a/Makefile +++ b/Makefile @@ -3,38 +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 + @$(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 \ @@ -50,29 +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" + @$(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 proxy mikroapp tower gateway +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 proxy mikroapp tower gateway + @$(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 diff --git a/README.md b/README.md index 1ae39dea..c6dbe2cf 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/app/tower b/app/tower index 933541ca..3003dcd5 160000 --- a/app/tower +++ b/app/tower @@ -1 +1 @@ -Subproject commit 933541ca3fa8ae737d4244a2871413b57de785b5 +Subproject commit 3003dcd54f2998cbd97a7b7dab858956705325ab diff --git a/compose/app.yaml b/compose/app.yaml index 4afae813..c7413d71 100644 --- a/compose/app.yaml +++ b/compose/app.yaml @@ -11,7 +11,6 @@ services: - rabbitmq - barong - ranger - - geth - coinhub env_file: - ../config/peatio.env diff --git a/compose/backend.yaml b/compose/backend.yaml index ac579897..0575dafd 100644 --- a/compose/backend.yaml +++ b/compose/backend.yaml @@ -4,7 +4,6 @@ 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 @@ -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 @@ -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 diff --git a/compose/cryptonodes.yaml b/compose/cryptonodes.yaml index ec07c6e2..e536197d 100644 --- a/compose/cryptonodes.yaml +++ b/compose/cryptonodes.yaml @@ -2,7 +2,7 @@ version: '3.7' services: geth: - image: ethereum/client-go:stable + image: ethereum/client-go:alpine restart: always command: | --syncmode=full diff --git a/compose/daemons.yaml b/compose/daemons.yaml index bd7de2d5..49d1d3e6 100644 --- a/compose/daemons.yaml +++ b/compose/daemons.yaml @@ -9,7 +9,6 @@ x-daemon: &peatio-daemon - db - redis - rabbitmq - - geth - barong - ranger - coinhub diff --git a/config/mysql/my.cnf b/config/mysql/my.cnf deleted file mode 100644 index aeed0dcd..00000000 --- a/config/mysql/my.cnf +++ /dev/null @@ -1,53 +0,0 @@ -# https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html -# https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html - -[mysql] -port = 3306 -socket = /var/lib/mysql/mysql.sock -default-character-set = utf8 - -[mysqld] -user = mysql -character-set-server = utf8mb4 -default-storage-engine = InnoDB -socket = /var/lib/mysql/mysql.sock -pid-file = /var/run/mysqld/mysqld.pid -#require_secure_transport = ON -bind-address = 0.0.0.0 -disabled-storage-engines = BLACKHOLE,FEDERATED,ARCHIVE -key-buffer-size = 64M -max-allowed-packet = 8M -max-connect-errors = 1000000 -skip-name-resolve -skip-log-bin -sync-binlog = 0 -sql-mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY -sysdate-is-now = 1 -innodb = FORCE -datadir = /var/lib/mysql/ -tmp-table-size = 256M -max-heap-table-size = 256M -query-cache-type = 0 -query-cache-size = 0 -max-connections = 1000 -thread-cache-size = 32 -open-files-limit = 65535 -table-definition-cache = 1024 -table-open-cache = 16384 -innodb-flush-method = O_DIRECT -innodb-log-file-size = 512M -innodb-buffer-pool-size = 4096MB -innodb-read-io-threads = 32 -innodb-write-io-threads = 32 -sort-buffer-size = 256K -read-rnd-buffer-size = 256K -read-buffer-size = 160K -join-buffer-size = 384K -innodb-buffer-pool-instances = 4 -innodb-io-capacity = 15000 -innodb-io-capacity-max = 30000 -innodb-buffer-pool-load-at-startup = 0 -innodb-buffer-pool-dump-at-shutdown = 0 -table-open-cache-instances = 16 -log-queries-not-using-indexes = 1 -symbolic-links = 1 diff --git a/test/toolbox b/test/toolbox index 60f13666..df7b2314 160000 --- a/test/toolbox +++ b/test/toolbox @@ -1 +1 @@ -Subproject commit 60f136660ff7b8ee1df02fb8e3ec1a5eb0d0ac59 +Subproject commit df7b231430c00aeffa102b7c36a76e86e502b75f