From 31f8ee0a7c000a1ef6217c07f5c53dd8ba4c4b73 Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Fri, 28 Jan 2022 12:07:19 +0300 Subject: [PATCH 01/22] Add KYC --- .envrc | 2 ++ docker-compose.yml | 2 +- templates/default.conf.template | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.envrc b/.envrc index e7733e4..9e7a151 100644 --- a/.envrc +++ b/.envrc @@ -62,4 +62,6 @@ export STATS_EXCLUDE_MEMBER_UIDS= export COOKIE_DOMAIN=localhost export USE_PRIVATE_KEY=true +export KYC_PORT=3008 + source_env_if_exists .envrc.local diff --git a/docker-compose.yml b/docker-compose.yml index 10ecb1d..42d03fb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -77,7 +77,7 @@ services: environment: SKIP_SETCAP: 1 VAULT_TOKEN: ${VAULT_TOKEN} - VAULT_DEV_ROOT_TOKEN_ID: changeme + VAULT_DEV_ROOT_TOKEN_ID: ${VAULT_TOKEN} VAULT_ADDR: http://vault:8200 tower: diff --git a/templates/default.conf.template b/templates/default.conf.template index dbefe2f..fc54fc4 100644 --- a/templates/default.conf.template +++ b/templates/default.conf.template @@ -35,6 +35,21 @@ server { proxy_pass http://${DOCKER_HOST_IP}:8091; } + location /kyc { + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + auth_request /api/v2/auth/; + proxy_http_version 1.1; + auth_request_set $auth_header $upstream_http_authorization; + proxy_set_header Authorization $auth_header; + error_page 401 =401 /error/401; + proxy_set_header X-Original-URI $request_uri; + proxy_pass http://${DOCKER_HOST_IP}:${KYC_PORT}/; + proxy_cookie_path / "/; Secure"; + } + location /api/v2/barong { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; From c390bb17ecd882e67595d6aa290e4a879a98c739 Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Fri, 28 Jan 2022 15:04:49 +0300 Subject: [PATCH 02/22] add sumsub env --- .envrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.envrc b/.envrc index 9e7a151..31d99a2 100644 --- a/.envrc +++ b/.envrc @@ -64,4 +64,9 @@ export USE_PRIVATE_KEY=true export KYC_PORT=3008 +export SUMSUB_TOKEN=changeme +export SUMSUB_SECRET=changeme +export SUMSUB_WEBHOOK_SECRET_KEY=changeme +export SUMSUB_PRODUCTION=false + source_env_if_exists .envrc.local From 3ac208929f5735682b78b55d36ee2a8694b4ff5e Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Fri, 28 Jan 2022 15:53:45 +0300 Subject: [PATCH 03/22] add summodule kyc servyce --- .gitmodules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitmodules b/.gitmodules index 739b1af..fb487fe 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "liza"] path = liza url = git@github.com:bitzlato/liza.git +[submodule "kyc-service"] + path = kyc-service + url = git@github.com:bitzlato/kyc-service From cb55a17f905c120ef49af650bad3bb446d303fc4 Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Fri, 28 Jan 2022 15:56:19 +0300 Subject: [PATCH 04/22] add summodule kyc servyce --- kyc-service | 1 + 1 file changed, 1 insertion(+) create mode 160000 kyc-service diff --git a/kyc-service b/kyc-service new file mode 160000 index 0000000..ecf7fb1 --- /dev/null +++ b/kyc-service @@ -0,0 +1 @@ +Subproject commit ecf7fb1c3d1c9f5329e03b3bdf56fbfcf4f7e547 From a84441c3257e00df3cd2c1b0a0e04ea9213524d2 Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Fri, 28 Jan 2022 16:34:06 +0300 Subject: [PATCH 05/22] add kyc makefile --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f43c7ac..91b4018 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ nvm: .envrc: direnv allow -configure_apps: app_baseapp app_barong app_peatio app_liza +configure_apps: app_baseapp app_barong app_peatio app_liza app_kyc_service GeoLite2-Country.mmdb: ifeq ($(UNAME), Darwin) @@ -94,6 +94,9 @@ start_rango: start_liza: cd liza; bundle exec foreman start +start_kyc_service: + cd kyc-service; bundle exec foreman start + app_baseapp: cd baseapp/web; yarn install rm -f baseapp/web/public/config/env.js; ln -s env.localdev.js baseapp/web/public/config/env.js @@ -111,6 +114,10 @@ app_peatio: bin/rake tmp:clear tmp:create; \ bin/rake db:reset +app_kyc_service: + cd kyc-service; rbenv install -s; bundle; \ + bundle exec rails db:setup; \ + app_liza: cd liza; git submodule init; git submodule update; \ rbenv install -s; bundle; \ From d4cfb300d7962c8c37277dbaa1f11f3499581b8c Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Fri, 28 Jan 2022 17:19:52 +0300 Subject: [PATCH 06/22] fix --- .envrc | 1 - 1 file changed, 1 deletion(-) diff --git a/.envrc b/.envrc index 31d99a2..bb6a6da 100644 --- a/.envrc +++ b/.envrc @@ -63,7 +63,6 @@ export COOKIE_DOMAIN=localhost export USE_PRIVATE_KEY=true export KYC_PORT=3008 - export SUMSUB_TOKEN=changeme export SUMSUB_SECRET=changeme export SUMSUB_WEBHOOK_SECRET_KEY=changeme From 0d544da828779df7e66da619f2243f966a4d1e7d Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Fri, 28 Jan 2022 17:20:04 +0300 Subject: [PATCH 07/22] fix --- kyc-service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kyc-service b/kyc-service index ecf7fb1..49377d2 160000 --- a/kyc-service +++ b/kyc-service @@ -1 +1 @@ -Subproject commit ecf7fb1c3d1c9f5329e03b3bdf56fbfcf4f7e547 +Subproject commit 49377d2ce754e5742754a7d42e2a5140e3497c30 From 8277301caf2e56c2a3aab0855348411db5b98b7a Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Fri, 28 Jan 2022 17:24:19 +0300 Subject: [PATCH 08/22] upd readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 5ea1cd8..7a8ad9c 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,13 @@ make start_rango make start_liza ``` +**6th terminal session (kys-service)** + +```bash +make start_kyc_service +``` + + Open page http://localhost:8080/ in browser. ## Run main apps in light mode (only web, no daemons) From c8733ef718b72953835dc7ad54a5f8df89282460 Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Fri, 28 Jan 2022 17:24:43 +0300 Subject: [PATCH 09/22] upd readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a8ad9c..71ba63b 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ make start_rango make start_liza ``` -**6th terminal session (kys-service)** +**6th terminal session (kyc-service)** ```bash make start_kyc_service From 57cc5cee99546d5628aa643b996232283f02847d Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Fri, 28 Jan 2022 17:26:45 +0300 Subject: [PATCH 10/22] upd env --- .envrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.envrc b/.envrc index bb6a6da..be7e7a6 100644 --- a/.envrc +++ b/.envrc @@ -62,10 +62,12 @@ export STATS_EXCLUDE_MEMBER_UIDS= export COOKIE_DOMAIN=localhost export USE_PRIVATE_KEY=true +### KYC-SERVICE export KYC_PORT=3008 export SUMSUB_TOKEN=changeme export SUMSUB_SECRET=changeme export SUMSUB_WEBHOOK_SECRET_KEY=changeme export SUMSUB_PRODUCTION=false +### END KYC-SERVICE source_env_if_exists .envrc.local From 2eb364f5ca8400d996e1a9879ba4d0c1fc20fcda Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Fri, 28 Jan 2022 18:56:56 +0300 Subject: [PATCH 11/22] add port --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 42d03fb..9ab1df9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -51,6 +51,7 @@ services: BASEAPP_PORT: 3002 RANGO_PORT: 8090 LIZA_PORT: 3003 + KYC_PORT: 3008 # Good idea. But it does not work on macos because of https://docs.docker.com/docker-for-mac/networking/#there-is-no-docker0-bridge-on-macos # The better way it to set peatio.local and ws.local in /etc/hosts manualy From 9a039e69d2a71a644b355c29a5cd92e9299074f5 Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Fri, 28 Jan 2022 18:57:23 +0300 Subject: [PATCH 12/22] webhook nginx --- templates/default.conf.template | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/templates/default.conf.template b/templates/default.conf.template index fc54fc4..e470254 100644 --- a/templates/default.conf.template +++ b/templates/default.conf.template @@ -35,7 +35,16 @@ server { proxy_pass http://${DOCKER_HOST_IP}:8091; } - location /kyc { + location /webhook/sumsub { + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + error_page 401 =401 /error/401; + proxy_pass http://${DOCKER_HOST_IP}:${KYC_PORT}/api/webhook/sumsub; + } + + location /api/v1/kyc { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -46,7 +55,7 @@ server { proxy_set_header Authorization $auth_header; error_page 401 =401 /error/401; proxy_set_header X-Original-URI $request_uri; - proxy_pass http://${DOCKER_HOST_IP}:${KYC_PORT}/; + proxy_pass http://${DOCKER_HOST_IP}:${KYC_PORT}/api/kyc; proxy_cookie_path / "/; Secure"; } From 3ee330e53d966f2eab31610063004b9d1655407d Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Tue, 1 Feb 2022 10:43:43 +0300 Subject: [PATCH 13/22] fix location --- templates/default.conf.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default.conf.template b/templates/default.conf.template index e470254..5b62fdd 100644 --- a/templates/default.conf.template +++ b/templates/default.conf.template @@ -35,7 +35,7 @@ server { proxy_pass http://${DOCKER_HOST_IP}:8091; } - location /webhook/sumsub { + location /api/webhook/sumsub { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; From 18c5ac531da95b0231d4cf3d4364a59e2c64b7a3 Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Wed, 2 Feb 2022 10:35:35 +0300 Subject: [PATCH 14/22] upd envrc --- .envrc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.envrc b/.envrc index be7e7a6..3e52939 100644 --- a/.envrc +++ b/.envrc @@ -62,12 +62,5 @@ export STATS_EXCLUDE_MEMBER_UIDS= export COOKIE_DOMAIN=localhost export USE_PRIVATE_KEY=true -### KYC-SERVICE -export KYC_PORT=3008 -export SUMSUB_TOKEN=changeme -export SUMSUB_SECRET=changeme -export SUMSUB_WEBHOOK_SECRET_KEY=changeme -export SUMSUB_PRODUCTION=false -### END KYC-SERVICE source_env_if_exists .envrc.local From 611828b8a38e78f6edec21d82d4c3924080d26ae Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Wed, 2 Feb 2022 13:31:45 +0300 Subject: [PATCH 15/22] fix locations --- templates/default.conf.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default.conf.template b/templates/default.conf.template index 5b62fdd..d4d3edb 100644 --- a/templates/default.conf.template +++ b/templates/default.conf.template @@ -35,7 +35,7 @@ server { proxy_pass http://${DOCKER_HOST_IP}:8091; } - location /api/webhook/sumsub { + location /api/v1/kyc/webhook/sumsub { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; From 6a43c7b12d5d58e7655c312ff1a60037ae7892ca Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Wed, 2 Feb 2022 15:09:04 +0300 Subject: [PATCH 16/22] add makefile function to refresh all reps --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 91b4018..ddc6820 100644 --- a/Makefile +++ b/Makefile @@ -126,3 +126,11 @@ app_liza: secrets: bundle exec peatio security keygen --path=secrets + +checkout_all_master: + cd kyc-service; git checkout main; git pull; cd ..; \ + cd barong; git checkout master; git pull; cd ..; \ + cd liza; git checkout master; git pull; cd ..; \ + cd peatio; git checkout master; git pull; cd ..; \ + cd rango; git checkout master; git pull; cd ..; \ + cd baseapp; git checkout master; git pull; cd ..; From 0e359b45dfa7660489aebcc315bd4aa21204534d Mon Sep 17 00:00:00 2001 From: "elnikov.s" Date: Wed, 2 Feb 2022 16:26:12 +0300 Subject: [PATCH 17/22] upd --- barong | 2 +- baseapp | 2 +- kyc-service | 2 +- liza | 2 +- peatio | 2 +- rango | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/barong b/barong index 30ff69f..e571212 160000 --- a/barong +++ b/barong @@ -1 +1 @@ -Subproject commit 30ff69f36ff56c845848d80746c00f9854cf50c0 +Subproject commit e5712129cf0e27782427138c841e7b8ab3f5964a diff --git a/baseapp b/baseapp index 7dbe02d..6fddb4d 160000 --- a/baseapp +++ b/baseapp @@ -1 +1 @@ -Subproject commit 7dbe02d6cfbe5ee8897cd02ecd79a42f48a361e4 +Subproject commit 6fddb4d54065eb7bafa0c936c47ffe4f9f380b3e diff --git a/kyc-service b/kyc-service index 49377d2..e93bfbe 160000 --- a/kyc-service +++ b/kyc-service @@ -1 +1 @@ -Subproject commit 49377d2ce754e5742754a7d42e2a5140e3497c30 +Subproject commit e93bfbe647522ea1d8723be6ff95696343922dee diff --git a/liza b/liza index dba6e13..7b56494 160000 --- a/liza +++ b/liza @@ -1 +1 @@ -Subproject commit dba6e1347aefc16230b5a213445ace99d4b64cb3 +Subproject commit 7b56494b35ede45565e92145f9b7e5109c3f23e8 diff --git a/peatio b/peatio index b946ca6..c4a8ac0 160000 --- a/peatio +++ b/peatio @@ -1 +1 @@ -Subproject commit b946ca6d539673fa7faecf24116555d61612f603 +Subproject commit c4a8ac0e696970366f3462d5de4f28ee8cd2041b diff --git a/rango b/rango index 1fde354..43c1855 160000 --- a/rango +++ b/rango @@ -1 +1 @@ -Subproject commit 1fde3543564fc3a42325de6c787ca8cb0bbdd1a4 +Subproject commit 43c1855293954e5bac8f122ec072fbef9d0f7876 From cd130244ab42888df9985fa513549e7539cdfba8 Mon Sep 17 00:00:00 2001 From: elnikov Date: Thu, 3 Feb 2022 10:53:49 +0300 Subject: [PATCH 18/22] improve checout all master --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ddc6820..67ab81b 100644 --- a/Makefile +++ b/Makefile @@ -128,9 +128,9 @@ secrets: bundle exec peatio security keygen --path=secrets checkout_all_master: - cd kyc-service; git checkout main; git pull; cd ..; \ - cd barong; git checkout master; git pull; cd ..; \ - cd liza; git checkout master; git pull; cd ..; \ - cd peatio; git checkout master; git pull; cd ..; \ + cd kyc-service; git checkout main; git pull; bundle install; bundle exec rake db:setup; cd ..; \ + cd barong; git checkout master; git pull; bundle install; bundle exec rake db:setup; cd ..; \ + cd liza; git checkout master; git pull; bundle install; bundle exec rake db:setup; cd ..; \ + cd peatio; git checkout master; git pull; bundle install; bundle exec rake db:setup; cd ..; \ cd rango; git checkout master; git pull; cd ..; \ - cd baseapp; git checkout master; git pull; cd ..; + cd baseapp; git checkout master; git pull; yarn install; cd ..; From 4d130f685d671afe5166db382d459c29c01cf3c8 Mon Sep 17 00:00:00 2001 From: elnikov Date: Thu, 3 Feb 2022 12:18:44 +0300 Subject: [PATCH 19/22] fix Makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 67ab81b..037ce11 100644 --- a/Makefile +++ b/Makefile @@ -131,6 +131,6 @@ checkout_all_master: cd kyc-service; git checkout main; git pull; bundle install; bundle exec rake db:setup; cd ..; \ cd barong; git checkout master; git pull; bundle install; bundle exec rake db:setup; cd ..; \ cd liza; git checkout master; git pull; bundle install; bundle exec rake db:setup; cd ..; \ - cd peatio; git checkout master; git pull; bundle install; bundle exec rake db:setup; cd ..; \ + cd peatio; git checkout master; git pull; bundle install; bundle exec rake db:migrate; cd ..; \ cd rango; git checkout master; git pull; cd ..; \ - cd baseapp; git checkout master; git pull; yarn install; cd ..; + cd baseapp; git checkout master; git pull; yarn install; cd web; yarn install; cd ..\..; From bd497adfca0e0818af3922539bc48cc6ca49e112 Mon Sep 17 00:00:00 2001 From: elnikov Date: Mon, 14 Feb 2022 09:34:43 +0300 Subject: [PATCH 20/22] [#181171559] remove show --- barong | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barong b/barong index e571212..bf96841 160000 --- a/barong +++ b/barong @@ -1 +1 @@ -Subproject commit e5712129cf0e27782427138c841e7b8ab3f5964a +Subproject commit bf968417a2813d693f0dd8fdb1634541f89ba68b From 626ff9df9ddf875e39317eb79da5690e4a0ef40f Mon Sep 17 00:00:00 2001 From: elnikov Date: Mon, 14 Feb 2022 13:20:18 +0300 Subject: [PATCH 21/22] bitzlato refactor --- liza | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liza b/liza index 7b56494..6a307ce 160000 --- a/liza +++ b/liza @@ -1 +1 @@ -Subproject commit 7b56494b35ede45565e92145f9b7e5109c3f23e8 +Subproject commit 6a307ce2bcecefcc2434791dff977760e3ecb94f From e65801bc5f5d1be3242596980d17e5b2ba242a72 Mon Sep 17 00:00:00 2001 From: elnikov Date: Mon, 21 Feb 2022 11:58:27 +0300 Subject: [PATCH 22/22] fix permisssions --- kyc-service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kyc-service b/kyc-service index e93bfbe..6e3f429 160000 --- a/kyc-service +++ b/kyc-service @@ -1 +1 @@ -Subproject commit e93bfbe647522ea1d8723be6ff95696343922dee +Subproject commit 6e3f429b69f67c6a885b76d5534e742b8265f8f4