Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

Santander AML Example (Web Client part) #180

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
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
52 changes: 52 additions & 0 deletions docker-compose-aml-web-client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2019 Banco Santander S.A.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

version: '3.5'

services:
tcf:
container_name: tcf
image: tcf-dev
build:
context: .
dockerfile: ./docker/Dockerfile.tcf-dev
args:
- http_proxy
- https_proxy
- no_proxy
- MAKECLEAN=${MAKECLEAN:-1}
- TCF_DEBUG_BUILD=${TCF_DEBUG_BUILD:-}
- DISPLAY=${DISPLAY:-}
- XAUTHORITY=~/.Xauthority
ports:
- "1947:1947"
volumes:
# Below volume mappings are required for DISPLAY settings by heart disease GUI client
- /tmp/.X11-unix:/tmp/.X11-unix
- ~/.Xauthority:/root/.Xauthority
working_dir: "/project/TrustedComputeFramework"
entrypoint: "bash -c \"\
source scripts/tcs_startup.sh -y \
&& tail -f /dev/null \""
stop_signal: SIGKILL
networks:
- sgx-network

networks:
sgx-network:
name: sgx-network
driver: bridge
ipam:
config:
- subnet: 172.16.239.0/24
1 change: 1 addition & 0 deletions examples/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SET(GENERIC_PRIVATE_INCLUDE_DIRS "." "${TCF_TOP_DIR}/tc/sgx/common"
################################################################################
ADD_SUBDIRECTORY(echo/workload)
ADD_SUBDIRECTORY(heart_disease_eval/workload)
ADD_SUBDIRECTORY(aml/workload)
ADD_SUBDIRECTORY(inside_out_demo/workload)

# To add a new workload, uncomment the following line and change
Expand Down
5 changes: 5 additions & 0 deletions examples/apps/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<!--
Licensed under Creative Commons Attribution 4.0 International License
https://creativecommons.org/licenses/by/4.0/
-->

# Avalon Example Applications

The following Avalon example applications are available.
Expand Down
19 changes: 19 additions & 0 deletions examples/apps/aml/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
Licensed under Creative Commons Attribution 4.0 International License
https://creativecommons.org/licenses/by/4.0/
-->

The aml example is composed by 3 different parts.
1. standalone-cipher: This is an example of a standalone cipher that is proposed as a possible solution. This tool has several functionalities.
- It allows you to create a well formatted JSONs that you can send to the platform just by inputing the CSVs with the information about both the users and the transactions.
- It also allows you to encrypt the JSONs in a manner totally independent from the platform just by feeding the workerInfo of the worker that you are targeting to process your work orders.

2. web-client: This is a example of a proposed view for the aml application with the following functionalities:
- retrieve the list of available workers and display their information.
- download the workerInfo of a concrete worker.
- send already encrypted JSONs to be processed by the server side.
- retrieve the result of a work order and update the state of the algorithm.

[Web Client README](web-client/README.md)

3. workload: Contains the logic used for this aml use case. The algorithm consist on a simplified version of Anti Money Laundering, it searches for money going round in circles and outputs the list of people suspicious of doing so.
22 changes: 22 additions & 0 deletions examples/apps/aml/web-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.DS_Store
node_modules
/dist
/deployment/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
51 changes: 51 additions & 0 deletions examples/apps/aml/web-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!--
Licensed under Creative Commons Attribution 4.0 International License
https://creativecommons.org/licenses/by/4.0/
-->

# Santander AML DEMO SGX WEB CLIENT

## Compiles and hot-reloads for development
```
npm install
npm run serve
```

## Deployment in production


1. Go to **Project Root Folder**

2. Build Trusted Compute Framework using "docker-compose-aml-web-client.yaml"

```
docker-compose -f docker-compose-aml-web-client.yaml up
```

3. Go back to this folder (web-client)

4. Change variable "SERVER_URL" in file "src/config.js"

5. Change variable "server_name" in file "deployment/nginx.conf. It must be the same url than the specified in "config.js" file

6. Install dependencies executing in this folder

```
npm install
```

7. Compile for production executing in this folder

```
npm run build
```

8. Go to "deployment" folder.

9. Execute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can npm build/run be moved to docker? Need to build outside and then deploy for any new changes.


```
docker-compose up
```

10. Open a browser and check if everything is deployed correctly. There must be some workers in "Available Workers" slot.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of steps to guide through the UI would be much appreciated. And a sample request attached along.

5 changes: 5 additions & 0 deletions examples/apps/aml/web-client/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app'
]
}
1 change: 1 addition & 0 deletions examples/apps/aml/web-client/deployment/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
30 changes: 30 additions & 0 deletions examples/apps/aml/web-client/deployment/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2019 Banco Santander S.A.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM nginx:1.9.15

LABEL maintainer="Santander Blockchain Team"

#Install Curl
RUN apt-get update
RUN apt-get install curl -y

#nginx configuration disable defaults
RUN mv /etc/nginx/conf.d/default.conf default.conf.disabled

#Copy the custom configuration
COPY nginx.conf /etc/nginx/nginx.conf

#Copy the application distribution
COPY dist /usr/share/nginx/html
30 changes: 30 additions & 0 deletions examples/apps/aml/web-client/deployment/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2019 Banco Santander S.A.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

version: '3.5'

services:

sgx-web-client:
build: ./
image: sgx-web-client
container_name: sgx-web-client
networks:
- sgx-network
ports:
- "0.0.0.0:80:80"

networks:
sgx-network:
external: true
64 changes: 64 additions & 0 deletions examples/apps/aml/web-client/deployment/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright 2019 Banco Santander S.A.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

user nginx;
worker_processes 5; ## Default: 1
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_rlimit_nofile 8192;

events {
worker_connections 4096; ## Default: 1024
}

http {
include /etc/nginx/mime.types;
index index.html index.htm index.php;

default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;

sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts

upstream myserverbackend {

server tcf:1947;
}

server { # simple reverse-proxy
listen 80;
server_name {YOUR DOMAIN}.com www.{YOUR DOMAIN}.com;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
expires 1M;
}


# pass requests for dynamic content to rails/turbogears/zope, et al
location /rpc/ {
proxy_pass http://myserverbackend/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
Loading