substrate-developer-hub / substrate-cms

5 stars 5 forks source link

Use docker to start a blockchain #15

Closed kaichaosun closed 1 year ago

kaichaosun commented 4 years ago

This is feedback from one of the community members. The initial requirements are:

Is there a reason that all these tutorials, like this one (https://substrate.dev/docs/en/tutorials/start-a-private-network-with-substrate) are installing and using local rustc versions and not using docker with all this built inside? (or something like that). I'm working on multiple projects with different versions of rust and there are always some problems with rust nightly versions that are installed and that give errors while running this scripts inside. Although this is not a problem with project itself but with rustc and the way it works, all this could be bypassed by building docker images that contain all this things inside. The flow would be much simpler especially for new users by using docker.

A few potential solutions for docker usage could be:

shawntabrizi commented 4 years ago

Before we do this, I want to understand what a set of docs which use docker would look like.

I want to see an example of another set of docs which rely heavily on docker, or some similar service, and see how they make things move smoothly.

The biggest problem I see with depending on Docker or some other virtual environment is that ultimately, these environments are not what should be used for long term development. Thus we start them off this path, and then later also have to teach them to set up their computer anyway.

I think it is possible that the solution to the problem trying to be solved here is the Substrate Playground, which really is just like a Docker container, but from your browser. I think also easier to maintain from our side.

kaichaosun commented 4 years ago

@shawntabrizi Here is what I found.

Before we do this, I want to understand what a set of docs which use docker would look like.

I'm thinking something like adding another section with docker in Installing Substrate, the prebuild image basically does:

FROM ubuntu
RUN curl https://getsubstrate.io -sSf | bash -s -- --fast

Then in the Substrate node template, it placed with a docker-compose file and reference the above prebuild image. The user starts the network by running docker-compose run .... This step could be put in the tutorials as an alternative to start the node if that makes sense.

I want to see an example of another set of docs which rely heavily on docker, or some similar service, and see how they make things move smoothly.

Here are few tutorials from hyperledger that leverages docker, https://github.com/hyperledger/fabric-samples/tree/release-1.4/basic-network Here is the document around one of the tutorials: https://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html#

these environments are not what should be used for long term development.

I don't quite get this one. Actually my current full-time job heavily depends on docker to provide local dev environment, also for production usage.

I like the idea of Substrate playground, but here the docker is more like an alternative for daily dev workflow and potentially in prod (polkadot do have a install section with docker).

shawntabrizi commented 4 years ago

@kaichaosun okay, after quickly looking at their docs, I am indeed interested.

If it is not crazy work, it would be cool to see us try this, and if you can provide a sample to showcase it, that would be great.

Before you do too much work reinventing the wheel, I do believe we do have some auto-generated docker stuff for Substrate. Reach out to the Devops team to see what they have, and if it is not right, then go down your path and do it on your own :)