0
votes

Our sample CorDapp is configured to use PostgreSQL as standalone node database. The network bootstrapper tool is used to create the node configuration in dev mode.

  1. As per my understanding, the network boostrapper tool generates the node configuration files. However we noticed that it requires the PostgreSQL instance up and running (with schema already created). The tool does connect to the database while generating the node configuration files.

    Why does it connects to database? I think the database creation should be allowed to be done, after the initial network boostrapping.

  2. In our case, we are deploying PostgreSQL as docker container. The container and network boostrapping tool both reside on same host. As discussed, the network boostrapper tool tries to connect with the node database (based on configured datasource url in node.conf). However it expects the Postgres to expose the port 5432 publically.

    i.e. This setting does not work. "pg_party_a" is name of our docker container.

    dataSourceProperties = {
        dataSourceClassName = "org.postgresql.ds.PGSimpleDataSource"
        "dataSource.url" = "jdbc:postgresql://pg_party_a:5432/postgres"
        "dataSource.user" = postgres
        "dataSource.password" = postgres
    }
    

    This setting works.

    dataSourceProperties = {
        dataSourceClassName = "org.postgresql.ds.PGSimpleDataSource"
        "dataSource.url" = "jdbc:postgresql://localhost:5432/postgres"
        "dataSource.user" = postgres
        "dataSource.password" = postgres
    }
    

    The Corda node is able to connect the database using container name. However the bootstrapping tool does not support it.

    In our PoC application, the Corda Node and PostgreSQL database, both will reside on same host. So there is no need to expose PostgreSQL publicly. However due to network boostrapper, it seems to be difficult. Is there any other way to handle this situation?

1

1 Answers

1
votes

Why is database access required during bootstrapping as of Corda 3.2?

  • As part of bootstrapping, the node needs to generate its NodeInfo to send to the other network nodes
  • The node has to start up to generate its NodeInfo
  • Upon starting up, the node needs access to its database

There is no way around this with the existing bootstrapper.