From dae5111258f43737209a5736b52da1b6934e1eb9 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Thu, 8 Jul 2021 17:57:45 -0300 Subject: [PATCH] Make docker run the default run method; move alternative methods to their own page --- README.md | 73 ++--------------------------- docs/other-ways-to-run-otterscan.md | 66 ++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 70 deletions(-) create mode 100644 docs/other-ways-to-run-otterscan.md diff --git a/README.md b/README.md index 8de2e32..1b23385 100644 --- a/README.md +++ b/README.md @@ -123,84 +123,17 @@ To stop Otterscan service, run: docker stop otterscan ``` -By default it assumes your Erigon node is at http://127.0.0.1:8545. You can override the URL by setting the `ERIGON_URL` env variable on `docker run`: +By default it assumes your Erigon node is at `http://127.0.0.1:8545`. You can override the URL by setting the `ERIGON_URL` env variable on `docker run`: ``` docker run --rm -p 5000:80 --name otterscan -d --env ERIGON_URL="" otterscan/otterscan: ``` -### (Alternative 1) Build Otterscan docker image locally and run it - -If you don't want to download from Docker Hub, you can build the docker image from the sources and run it. - -If you just want to build the image locally, there is no need to install the development toolchain, just make sure you have a recent working Docker installation. - -The entire build process will take place inside the docker multi-stage build. - -Clone Otterscan repo and its submodules. Checkout the tag corresponding to your Erigon + Otterscan patches. It uses the same version tag from Erigon + Otterscan repo, i.e., if you built the `v2021.07.01-otterscan`, you should build the `v2021.07.01-otterscan` of Otterscan. - -``` -git clone --recurse-submodules git@github.com:wmitsuda/otterscan.git -cd otterscan -git checkout -docker build -t otterscan -f Dockerfile . -``` - -This will run the entire build process inside a build container, merge the production build of the React app with the 4bytes and trustwallet assets into the same image format it is published in Docker Hub, but locally under the name `otterscan`. - -Then you can start/stop it using the commands: - -``` -docker run --rm -p 5000:80 --name otterscan -d otterscan -docker stop otterscan -``` - -### (Alternative 2) Run a development build from the source - -First, a brief explanation about the app: - -- The app itself is a simple React app which will be run locally and communicates with your Erigon node. -- The app makes use of two sources of external databases for cosmetic reasons: - - Token icons come from the trustwallet public assets repository. - - Method names come from the 4bytes database. -- These 2 repositories were cloned as submodules and are made available to the app through separate http services. They are accessed at browser level and are optional, if the service is down the result will be broken icons and default 4bytes method selectors instead of human-readable names. - -These instructions are subjected to changes in future for the sake of simplification. - -Make sure you have a working node 12/npm installation. - -By default, it assumes your Erigon `rpcdaemon` processs is serving requests at http://127.0.0.1:8545. You can customize this URL by specifying the `REACT_APP_ERIGON_URL` environment variable at build time (it needs to be done at build time because the build process generates a static website). - -To do that, export the variable before running `npm run build`: - -``` -export REACT_APP_ERIGON_URL= -``` - -Start serving 4bytes and trustwallet assets at `localhost:3001` using a dockerized nginx: - -``` -npm run start-assets -``` - -To stop it, run: - -``` -npm run stop-assets -``` - -To run Otterscan development build: - -``` -npm install -npm start -``` - -Otterscan should now be running at http://localhost:3000/. +This is the preferred way to run Otterscan. You can read about other ways [here](docs/other-ways-to-run-otterscan.md). ## Validating the installation (all methods) -**You can make sure it is working correctly if the homepage is able to show the latest block/timestamp your Erigon node is at just bellow the search button.** +You can make sure it is working correctly if the homepage is able to show the latest block/timestamp your Erigon node is at just bellow the search button. ## Kudos diff --git a/docs/other-ways-to-run-otterscan.md b/docs/other-ways-to-run-otterscan.md new file mode 100644 index 0000000..0ebd85c --- /dev/null +++ b/docs/other-ways-to-run-otterscan.md @@ -0,0 +1,66 @@ +# Running Otterscan (other methods) + +## (Alternative 1) Build Otterscan docker image locally and run it + +If you don't want to download from Docker Hub, you can build the docker image from the sources and run it. + +If you just want to build the image locally, there is no need to install the development toolchain, just make sure you have a recent working Docker installation. + +This method requires only `git` and `docker`. + +The entire build process will take place inside the docker multi-stage build. + +Clone Otterscan repo and its submodules. Checkout the tag corresponding to your Erigon + Otterscan patches. It uses the same version tag from Erigon + Otterscan repo, i.e., if you built the `v2021.07.01-otterscan`, you should build the `v2021.07.01-otterscan` of Otterscan. + +``` +git clone --recurse-submodules git@github.com:wmitsuda/otterscan.git +cd otterscan +git checkout +docker build -t otterscan -f Dockerfile . +``` + +This will run the entire build process inside a build container, merge the production build of the React app with the 4bytes and trustwallet assets into the same image format it is published in Docker Hub, but locally under the name `otterscan`. + +Then you can start/stop it using the commands: + +``` +docker run --rm -p 5000:80 --name otterscan -d otterscan +docker stop otterscan +``` + +## (Alternative 2) Run a development build from the source + +First, a brief explanation about the app: + +- The app itself is a simple React app which will be run locally and communicates with your Erigon node. +- The app makes use of two sources of external databases for cosmetic reasons: + - Token icons come from the trustwallet public assets repository. + - Method names come from the 4bytes database. +- These 2 repositories were cloned as submodules and are made available to the app through separate http services. They are accessed at browser level and are optional, if the service is down the result will be broken icons and default 4bytes method selectors instead of human-readable names. + +These instructions are subjected to changes in future for the sake of simplification. + +Make sure you have a working node 12/npm installation. + +By default, it assumes your Erigon `rpcdaemon` processs is serving requests at `http://localhost:8545`. You can customize this URL by changing the `public/config.json` file. + +Start serving 4bytes and trustwallet assets at `localhost:3001` using a dockerized nginx: + +``` +npm run start-assets +``` + +To stop it, run: + +``` +npm run stop-assets +``` + +To run Otterscan development build: + +``` +npm install +npm start +``` + +Otterscan should now be running at `http://localhost:3000/`. \ No newline at end of file