From b30a96b4d6704d1423ce3302315dfd7b87c3f687 Mon Sep 17 00:00:00 2001 From: Vitor Nazario Coelho Date: Tue, 9 Jan 2024 11:43:28 -0300 Subject: [PATCH] Adding rest server --- .../Neo.CLI/configs/plugins/restServer.json | 28 +++++++++++++++++++ docker-compose-eco-network/docker-compose.yml | 15 +++++++--- docker-neo-csharp-node/docker_build.sh | 2 +- docker-neo-csharp-node/scripts/run.sh | 20 +++++++++---- 4 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 docker-compose-eco-network/Neo.CLI/configs/plugins/restServer.json diff --git a/docker-compose-eco-network/Neo.CLI/configs/plugins/restServer.json b/docker-compose-eco-network/Neo.CLI/configs/plugins/restServer.json new file mode 100644 index 00000000..e9ae697e --- /dev/null +++ b/docker-compose-eco-network/Neo.CLI/configs/plugins/restServer.json @@ -0,0 +1,28 @@ +{ + "PluginConfiguration": { + "Network": 56753, + "BindAddress": "0.0.0.0", + "Port": 40337, + "KeepAliveTimeout": 120, + "SslCertFile": "", + "SslCertPassword": "", + "TrustedAuthorities": [], // Example: "aec13cdd5ea6a3998aec14ac331ad96bedbb770f" (Thumbprint) + "EnableBasicAuthentication": false, + "RestUser": "", + "RestPass": "", + "EnableCors": true, + "AllowOrigins": [], // Example: "http://www.example.com" + "DisableControllers": [ "WalletController" ], + "EnableCompression": true, + "CompressionLevel": "SmallestSize", // "Fastest" or "Optimal" or "NoCompression" or "SmallestSize" + "EnableForwardedHeaders": false, + "EnableSwagger": true, + "MaxPageSize": 50, + "MaxConcurrentConnections": 40, + "MaxTransactionFee": 10000000, + "MaxGasInvoke": 200000000, + "MaxTransactionSize": 1024, + "WalletSessionTimeout": 120 + } +} + diff --git a/docker-compose-eco-network/docker-compose.yml b/docker-compose-eco-network/docker-compose.yml index 8c25190e..2f4e4b24 100644 --- a/docker-compose-eco-network/docker-compose.yml +++ b/docker-compose-eco-network/docker-compose.yml @@ -41,6 +41,7 @@ services: IS_RPC_SERVER: 1 IS_RPC_CLIENT: 0 IS_ORACLE: 0 + IS_REST_SERVER: 0 labels: autoheal: 'true' networks: @@ -75,7 +76,8 @@ services: environment: IS_RPC_SERVER: 1 IS_RPC_CLIENT: 0 - IS_ORACLE: 0 + IS_ORACLE: 0 + IS_REST_SERVER: 0 labels: autoheal: 'true' networks: @@ -107,7 +109,8 @@ services: environment: IS_RPC_SERVER: 0 IS_RPC_CLIENT: 0 - IS_ORACLE: 0 + IS_ORACLE: 0 + IS_REST_SERVER: 0 labels: autoheal: 'true' networks: @@ -139,7 +142,8 @@ services: environment: IS_RPC_SERVER: 0 IS_RPC_CLIENT: 0 - IS_ORACLE: 0 + IS_ORACLE: 0 + IS_REST_SERVER: 0 labels: autoheal: 'true' networks: @@ -153,10 +157,12 @@ services: ports: - "20337:20337" - "30337:30337" + - "40337:40337" volumes: - $ECO_PWD/docker-compose-eco-network/Neo.CLI/configs/config1RPC.json:/opt/node/Neo.CLI/config.json - $ECO_PWD/docker-compose-eco-network/Neo.CLI/configs/plugins/appLogConfig.json:/opt/node/Neo.CLI/Plugins/ApplicationLogs/config.json - $ECO_PWD/docker-compose-eco-network/Neo.CLI/configs/plugins/rpcServer3.json:/opt/node/Neo.CLI/Plugins/RpcServer/config.json + - $ECO_PWD/docker-compose-eco-network/Neo.CLI/configs/plugins/restServer.json:/opt/node/Neo.CLI/Plugins/RestServer/config.json - $ECO_PWD/docker-compose-eco-network/Neo.CLI/configs/plugins/tokensTracker.json:/opt/node/Neo.CLI/Plugins/TokensTracker/config.json - $ECO_PWD/docker-compose-eco-network/Neo.CLI/configs/plugins/statesDumper.json:/opt/node/Neo.CLI/Plugins/StatesDumper/config.json - $ECO_PWD/docker-compose-eco-network/Neo.CLI/getIncStorage.sh:/opt/getIncStorage.sh @@ -180,7 +186,8 @@ services: environment: IS_RPC_SERVER: 1 IS_RPC_CLIENT: 0 - IS_ORACLE: 1 + IS_REST_SERVER: 1 + IS_ORACLE: 1 labels: autoheal: 'true' networks: diff --git a/docker-neo-csharp-node/docker_build.sh b/docker-neo-csharp-node/docker_build.sh index 84007d54..e11b636a 100755 --- a/docker-neo-csharp-node/docker_build.sh +++ b/docker-neo-csharp-node/docker_build.sh @@ -2,7 +2,7 @@ set -e # This automatically downloads the client from specified NEO_CLI_URL NeoResearch -NEO_CLI_VERSION="3.6.2-all-plugins-monorepo-neocli" +NEO_CLI_VERSION="3.6.2-all-plugins-monorepo-neocli-restServer" BASE_NAME="eco-neo-csharp-node" IMAGE_NAME="$BASE_NAME:$NEO_CLI_VERSION" diff --git a/docker-neo-csharp-node/scripts/run.sh b/docker-neo-csharp-node/scripts/run.sh index fec209a3..1e7b454d 100755 --- a/docker-neo-csharp-node/scripts/run.sh +++ b/docker-neo-csharp-node/scripts/run.sh @@ -52,25 +52,33 @@ sed -i -e "s/eco-neo-csharp-node4-running/$IP_SERVER4/g" /opt/node/Neo.CLI/confi if [[ ${IS_ORACLE} = "0" ]]; then echo "Deleting Oracle" - rm /opt/node/Neo.CLI/Plugins/OracleService.dll + rm -r /opt/node/Neo.CLI/Plugins/OracleService sleep 1 fi if [[ ${IS_RPC_SERVER} = "0" ]]; then echo "Deleting RPCServer" - rm /opt/node/Neo.CLI/Plugins/RpcServer.dll - rm /opt/node/Neo.CLI/Plugins/TokensTracker.dll - rm /opt/node/Neo.CLI/Plugins/ApplicationLogs.dll - rm /opt/node/Neo.CLI/Plugins/StateService.dll + rm -r /opt/node/Neo.CLI/Plugins/RpcServer + rm -r /opt/node/Neo.CLI/Plugins/TokensTracker + rm -r /opt/node/Neo.CLI/Plugins/ApplicationLogs + rm -r /opt/node/Neo.CLI/Plugins/StateService sleep 1 fi if [[ ${IS_RPC_CLIENT} = "0" ]]; then echo "Deleting RpcClient" - rm /opt/node/Neo.CLI/Plugins/RpcClient.dll + rm -r /opt/node/Neo.CLI/Plugins/RpcClient sleep 1 fi +if [[ ${IS_REST_SERVER} = "0" ]]; then + echo "Deleting RestServer" + rm -r /opt/node/Neo.CLI/Plugins/RestServer + sleep 1 +fi + + + echo "LAUNCHING Neo.CLI..."; screen -L -dmS node /opt/start_node.sh