-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(docker for local development) #523
Conversation
fc83035
to
d1753cd
Compare
@@ -4,4 +4,4 @@ set -euo pipefail | |||
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" 2>&1 && pwd )" | |||
cd ${SCRIPTS_DIR}/../../testing/vendor/ganache | |||
ganache_block_time=${GANACHE_BLOCK_TIME:-12} | |||
node_modules/.bin/ganache-cli --port 9545 --blockTime $ganache_block_time --gasLimit 10000000 --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200,10000000000000000000000000000" --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501201,10000000000000000000000000000" --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501202,10000000000000000000000000000" | |||
node_modules/.bin/ganache-cli --port 9545 --blockTime $ganache_block_time --gasLimit 10000000 --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200,10000000000000000000000000000" --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501201,10000000000000000000000000000" --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501202,10000000000000000000000000000" --db localnet -h 0.0.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why make Ganache listen on all interfaces? This may be undesirable, especially for those who are not using Docker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I can connect to it from the host, use metamask for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that if someone is not using Docker, this will let anyone on the same network to connect. So this should be optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realise your concerns, but this is meant for local development purposes, so I don't see a need for high security measures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be changed to only add this switch if run inside Docker?
./cli/index.js start eth2near-relay --metrics-port 8080 | ||
./cli/index.js start near2eth-relay --eth-master-sk 0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501201 --metrics-port 8181 | ||
./cli/index.js start bridge-watchdog --eth-master-sk 0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501202 | ||
nohup ./node_modules/.bin/http-server ~/.near/localnet/node0/ -p 9000 -d & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the use for http-server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Near explorer requires genesis URL, this is a neat hack to simply enable it
fc480ee
to
2febe56
Compare
docker build -t nearprotocol/bridge:new .
...
+ ./cli/index.js init-eth-ed25519
Deploying ETH contract
Error: ENOENT: no such file or directory, open '/usr/src/contracts/eth/nearbridge/artifacts/contracts/Ed25519.sol/Ed25519.json'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at EthContractInitializer.execute (/usr/src/cli/init/eth-contracts.js:33:44)
at execute (/usr/src/cli/init/eth-contracts.js:71:50)
at Command.<anonymous> (/usr/src/utils/config/index.js:38:37)
at Command.listener [as _actionHandler] (/usr/src/node_modules/commander/index.js:413:31)
at Command._parseCommand (/usr/src/node_modules/commander/index.js:914:14)
at Command._dispatchSubcommand (/usr/src/node_modules/commander/index.js:865:18)
at Command._parseCommand (/usr/src/node_modules/commander/index.js:882:12)
at Command.parse (/usr/src/node_modules/commander/index.js:717:10)
at Command.parseAsync (/usr/src/node_modules/commander/index.js:744:10)
at /usr/src/cli/index.js:914:17
at Object.<anonymous> (/usr/src/cli/index.js:915:3)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/usr/src/contracts/eth/nearbridge/artifacts/contracts/Ed25519.sol/Ed25519.json'
}
Can't deploy /usr/src/contracts/eth/nearbridge/artifacts/contracts/Ed25519.sol/Ed25519.json
The command '/bin/sh -c sh -c "./utils/scripts/docker_prepare.sh"' returned a non-zero code: 1 |
is it fixed? |
@idirall22 it should be fixed now. @ilyar @idirall22 can you share what is your use case for the bridge docker image? |
@mfornet thank you for your quick response.
Then when I try to build the Docker container using: |
@idirall22 regarding the first error, it was because after #564 compiled binaries of solidity contracts are not longer stored, but instructions or scripts were not updated accordingly. I added the compilation line here If you want to run this locally, please compile ethereum contracts with:
|
The second error is because you are using the outdated version of the Dockerfile. Please use the version of the Dockerfile included in this PR. |
@mfornet |
@mfornet we plan to use it here https://github.com/4IRE-Labs/near-sdk/blob/main/docker-compose.yml for a local testing environment |
* fix(docker for local development) * Update Dockerfile * Compile contracts * Remove comment Co-authored-by: Marcelo <mfornet94@gmail.com>
No description provided.