Stand up Orderer node using orderer.yaml and docker in Fabric v1.4

Dilip Manjunatha
Sep 20 · 4 min read
Image for post
Image for post


In this article, we will see how to bring up an orderer by configuring the orderer.yaml file and docker yaml files using fabric-samples 1.4.x.

There are few ways to stand up/bring up an orderer(ordering service) out of which using orderer.yaml file is one of them.

If you already have fabric setup done, go ahead and jump to Step 2.

Step 1: Fabric setup

If not done so, run the below command to pull fabric-samples code, binaries, config files and images for the specified version. In this case we have specified Fabric v1.4.8.

curl -sSL | bash -s -- 1.4.8 1.4.8 0.4.21

Once complete, the fabric-samples will be present in the directory from which the above command is executed. config folder within fabric-samples contains 3 yaml files namely configtx.yaml, core.yaml and orderer.yaml.

Image for post
Image for post
orderer.yaml in fabric-samples directory

core.yaml is used by peers and orderers use orderer.yaml. Necessary changes has to be done in order for peer and orderer to bootstrap with the core.yaml and orderer.yaml files respectively.

There are various configurations in the orderer.yaml, however we will see how to bootstrap the orderer with a genesis block.

Step 2: Copy orderer.yaml into first-network directory

Copy the orderer.yaml folder into first-network directory.

Image for post
Image for post

Step 3: Generate artifacts

From the first-network directory, run the below command which creates required certificates and channel artifacts.

./ generate

A genesis block file named genesis.block gets created within channel-artifacts folder which uses TwoOrgsOrdererGenesis profile (solo orderer) as specified in the script.

Step 4: Create new genesis block

We will generate a new genesis block file to use SampleMultiNodeEtcdRaft profile in configtx.yaml which is a raft setup. You can even use Kafka profile if required. Make sure that the bin folder is present inside fabric-samples directory. Run the following command from first-network directory.

../bin/configtxgen -profile SampleMultiNodeEtcdRaft -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesisA.block
Image for post
Image for post

This creates a genesis file named genesisA.block within channel-artifacts. Let’s use this genesis file to bootstrap the orderer.

Note that the channel-artifacts folder also contains a file named genesis.block as a result of running the ./ generate command earlier. Delete this file as it is of no use for us in this case.

Step 5: Configure docker YAML files

Note: If we need to use orderer.yaml to bootstrap the orderer, we need to create a volume and mount it to the path where orderer.yaml file is present.

The base folder contains docker-compose-base.yaml and peer-base.yaml.

Image for post
Image for post

In docker-compose-base.yaml, add a volume and mount the directory path of orderer.yaml with default FABRIC_CFG_PATH of orderer.

Since genesis block file resides in channel-artifacts folder and orderer.yaml file is present within first-network folder, we will mount first-network directory to FABRIC_CFG_PATH of orderer.

Image for post
Image for post

In peer-base.yaml file, comment or remove the highlighted environment variable shown below.

Image for post
Image for post

Step 6: Configure orderer.yaml file

Change the orderer.yaml present in the path as shown below. Orderer uses this configuration during bootstrap.

Image for post
Image for post

Now the orderer will bootstrap with the genesisA.block file and SampleMultiNodeEtcdRaft profile. We can change other variables as well if we want to do so. But we will keep things simple in this article.

Lastly, spin-up the docker container of just orderer using below command.

docker-compose -f docker-compose-cli.yaml up -d

If everything goes fine, the orderer container will be created successfully. We can check the docker logs to find out whether our configuration is applied or not.

Image for post
Image for post
docker log of orderer

We can see that our configuration for genesis block is applied during bootstrap.

Image for post
Image for post
docker log of orderer

The orderer is now using Raft consensus as specified in orderer.yaml.

Note: Just as we configured orderer with genesis block, we can do all sorts of configurations which is supported by orderer.yaml config file.

P.S: Hope this article was helpful to you in some way. If you like the article, please give a clap.

Please let me know for any suggestions or corrections :) Cheers !

Curious Manava

Just a droplet of knowledge to quench the thirst of your curiosity

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store