iotaledger / one-click-tangle

"One Click Tangle" intends to make lives easier to IOTA adopters by providing pre-configured scripts and recipes that allow to deploy IOTA Networks and Nodes "in one click".
MIT License
55 stars 36 forks source link

ERROR CP DEPLOY EXPLORER IN HORNET PRIVATE #90

Open informaticavera opened 8 months ago

informaticavera commented 8 months ago

Bug description

root@iotah:~/one-click-tangle/explorer# ./tangle-explorer.sh install ../hornet-private-net/ Cloning into './explorer-src'... remote: Enumerating objects: 33421, done. remote: Counting objects: 100% (7555/7555), done. remote: Compressing objects: 100% (1703/1703), done. remote: Total 33421 (delta 5908), reused 7296 (delta 5718), pack-reused 25866 Receiving objects: 100% (33421/33421), 17.61 MiB | 11.78 MiB/s, done. Resolving deltas: 100% (27188/27188), done. Stopping containers... Config ab72057b26fd4a88789224018444857914d9992c23a300b18de5940e2c228c11 cp: cannot create regular file './explorer-src/client/src/assets/config/config.local.json': No such file or directory

Docker and docker-compose version

Docker version 24.0.6, build ed223bc docker-compose version 1.25.0, build unknown

Hardware specification

What hardware are you using?

Ubuntu 20.04.6 LTS 8GB 2 Cores VM-XCP

Chen-Michael commented 8 months ago

you need modify the shell file

vi /root/one-click-tangle/explorer/tangle-explorer.sh

find the function installExplorer, add mkdir command after "git clone https://github.com/iotaledger/explorer $EXPLORER_SRC"

like

installExplorer () {
  # We need to create network it will fail if it does exist
  set +e
  docker network create private-tangle 2> /dev/null
  set -e

  clean

  git clone https://github.com/iotaledger/explorer $EXPLORER_SRC

  mkdir -p $EXPLORER_SRC/client/src/assets/config/

  # We stop container after having source code available otherwise docker-compose would fail
  stopContainers

  # If the input parameter is a folder with config then we need to build it
  if [ "$is_config_folder" = true ]; then
    buildConfig
  fi

  copyConfig
}
informaticavera commented 8 months ago

Thanks Chen. Seems there is other error:

=> ERROR [7/7] RUN npm run build 9.8s


[7/7] RUN npm run build:
0.748
0.748 > explorer-client@3.2.0 build
0.748 > run-s lint sass-lint build-internal
0.748
1.280 1.280 > explorer-client@3.2.0 lint 1.280 > eslint src --ext .tsx,.ts 1.280 9.651 The react/jsx-sort-default-props rule is deprecated. It has been renamed to react/sort-default-props. 9.655 9.655 Oops! Something went wrong! :( 9.655 9.655 ESLint: 8.52.0 9.655 9.655 TypeError: Cannot read properties of undefined (reading 'getAllComments') 9.655 Occurred while linting /usr/src/app/src/app/App.tsx:1 9.655 Rule: "unicorn/expiring-todo-comments" 9.655 at Object.Program (/usr/src/app/node_modules/eslint/lib/rules/no-warning-comments.js:193:45) 9.655 at Program (/usr/src/app/node_modules/eslint-plugin-unicorn/rules/expiring-todo-comments.js:511:10) 9.655 at /usr/src/app/node_modules/eslint-plugin-unicorn/rules/utils/rule.js:39:18 9.655 at ruleErrorHandler (/usr/src/app/node_modules/eslint/lib/linter/linter.js:1091:28) 9.655 at /usr/src/app/node_modules/eslint/lib/linter/safe-emitter.js:45:58 9.655 at Array.forEach () 9.655 at Object.emit (/usr/src/app/node_modules/eslint/lib/linter/safe-emitter.js:45:38) 9.655 at NodeEventGenerator.applySelector (/usr/src/app/node_modules/eslint/lib/linter/node-event-generator.js:297:26) 9.655 at NodeEventGenerator.applySelectors (/usr/src/app/node_modules/eslint/lib/linter/node-event-generator.js:326:22) 9.655 at NodeEventGenerator.enterNode (/usr/src/app/node_modules/eslint/lib/linter/node-event-generator.js:340:14) 9.712 ERROR: "lint" exited with 2.

Dockerfile:23

21 | # Running required steps to prepare the web app prod build 22 | RUN npm install 23 | >>> RUN npm run build 24 |
25 | EXPOSE 80

ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1 ERROR: Service 'explorer-webapp' failed to build : Build failed

Chen-Michael commented 8 months ago
  1. modify the shell file
    vi /root/one-click-tangle/explorer/tangle-explorer.sh

remove startExplorer in install block

original

case "${command}" in
  "help")
    help
    ;;
  "install")
    installExplorer
    startExplorer
    ;;
  "start")
    startExplorer
    ;;
  "stop")
    stopExplorer
    ;;
  "update")
    updateExplorer
    ;;
  *)
    echo "Command not Found."
    help
    exit 127;
    ;;
esac

new

case "${command}" in
  "help")
    help
    ;;
  "install")
    installExplorer
    ;;
  "start")
    startExplorer
    ;;
  "stop")
    stopExplorer
    ;;
  "update")
    updateExplorer
    ;;
  *)
    echo "Command not Found."
    help
    exit 127;
    ;;
esac
  1. run command
/root/one-click-tangle/explorer/tangle-explorer.sh install ../hornet-private-net/
  1. modify package.json
    vi /root/one-click-tangle/explorer/explorer-src/client/package.json

remove lint at script build

origin

    "scripts": {
        "start": "cross-env PORT=3000 craco start",
        "lint": "eslint src --ext .tsx,.ts",
        "sass-lint": "stylelint ./src/**/*.scss",
        "build-internal": "craco build",
        "build": "run-s lint sass-lint build-internal",
        "test": "craco test"
    },

new

    "scripts": {
        "start": "cross-env PORT=3000 craco start",
        "lint": "eslint src --ext .tsx,.ts",
        "sass-lint": "stylelint ./src/**/*.scss",
        "build-internal": "craco build",
        "build": "run-s sass-lint build-internal",
        "test": "craco test"
    },
  1. modify env.js
mv /root/one-click-tangle/explorer/explorer-src/client/public/env.js.template /root/one-click-tangle/explorer/explorer-src/client/public/env.js
vi /root/one-click-tangle/explorer/explorer-src/client/public/env.js

modify to your server ip

like

window.env = {
        API_ENDPOINT: 'http://XXX.XXX.XXX.XXX:4000'
};
  1. modify network.json(I don't know your network.json path, so I use my path)
    vi /root/one-click-tangle/explorer/application-data/network/private-network.json

change network to your need

legacy-mainnet mainnet devnet shimmer testnet alphanet

  1. run command

    /root/one-click-tangle/explorer/tangle-explorer.sh start
  2. run init

curl http://your_domain:4000/init
informaticavera commented 8 months ago

mmm, extrange

["Initializing","Success Creating Local Storage for /app/data/.local-storage/network","Failed Creating Local Storage for /app/data/.local-storage/currency","EACCES: permission denied, mkdir '/app/data/.local-storage/currency'","Initialization Failed"]

Chen-Michael commented 8 months ago
  1. open file
    vi /root/one-click-tangle/explorer/docker-compose.yaml

find the volumes of explorer-api

like

volumes:
      - ./application-data:/app/data/.local-storage

path "./application-data" mapping to docker path "/app/data/.local-storage"

  1. create folder

    cd /root/one-click-tangle/explorer/
    mkdir ./application-data/currency
  2. run init

    curl http://your_domain:4000/init

ps: maybe you need change permission for folder, but if it works properly, you don't need

chmod -R (775 or 777) ./application-data/currency

============

These are the steps that took me a lot of time to find to solve the problem, the maintainer seems to have given up on maintaining this project.

informaticavera commented 8 months ago

Solved, thanks