Reputation: 100
I am looking for a docker-compose file that will include Postgre, Cordite, Corda Nodes, and the respective backend server (spring boot). I can run Postgre, Cordite, and Corda nodes individually but I want to group them together in a single file. I think it will be easy for deployment purposes.
Upvotes: 0
Views: 183
Reputation: 3252
Cordite do a good open source example of this. This is the docker-compose.yml file: https://gitlab.com/cordite/cordite/blob/master/test/docker-compose.yml
This is the spin up script: https://gitlab.com/cordite/cordite/-/blob/master/test/build_env.sh
This an example of the "spin up a service and wait for it to be ready" pattern:
docker-compose -p ${ENVIRONMENT_SLUG} up -d network-map
until docker-compose -p ${ENVIRONMENT_SLUG} logs network-map | grep -q "io.cordite.networkmap.NetworkMapApp - started"
do
echo -e "waiting for network-map to start"
sleep 5
done
So the up
command starts the service and then the bash script reads the logs from the container every 5 seconds and checks for io.cordite.networkmap.NetworkMapApp - started
in the log. Obviously you'll need to update what it looks for depending on which docker image you are spinning up.
Edit: Some questions raised offline:
"How to place the cordapp or mount the cordapp?"
You have 2 options, either create your own Docker image which extends from the cordite one and place your CorDapps in the CorDapp folder. Or use a volume mount to allow the running container to see your CorDapps (which will exist on the host). The details are here https://hub.docker.com/r/cordite/cordite/ Specifically you can mount into /opt/corda/cordapps
to override the CorDapps.
"How to add my springboot service for each node?"
Just add new services to the docker-compose.yml file which use your Springboot server docker image. There are 3 "normal" nodes in the example docker-compose.yml emea
, apac
and amer
. I guess you want to create a new Springboot service for each one.
Upvotes: 1