1

I have a node instance running testrpc on localhost:8545, I'm able to access it when running it from another node instance from the same computer and make web3 calls to it.

const port = (process.env.PORT || 8545);
server.listen(port, function(err, blockchain) {})

I understand with heroku, everything is mapped to port:80

web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); 
// this works fine

web3 = new Web3(new Web3.providers.HttpProvider("http://192.168.1.254:80")); 
// this should, but does not work

How do I solve this problem, or what PAAS would help me access a personal testnet running on a remote machine?

3

Using heroku & docker :

To build the Docker container from source:

git clone https://github.com/ethereumjs/testrpc.git && cd testrpc docker build -t ethereumjs/testrpc .

Modify the docker file :

CMD ["node", "./build/cli.node.js"] instead of ENTRYPOINT ["node", "./build/cli.node.js"]

Modify cli.js, line 64 become :

port: argv.p || argv.port || process.env.PORT || "8545",

Create a new heroku app then

heroku git:remote -a your_new_created_app

then :

heroku container:login

heroku container:push web

Et voila ! A fresh testrpc is running on port 80.

1

Same answer as above but:

CMD ["node", "./cli.js"] instead of ENTRYPOINT ["node", "./build/cli.node.js"]

In step 3, you edit cli.js so you should load it. If you try to edit cli.node.js and keep step 2 the same, you will get Error: Cannot find module './package.json'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.