github.com/0xPolygon/supernets2-node@v0.0.0-20230711153321-2fe574524eaa/docs/components/databases.md (about)

     1  # Component: Databases
     2  
     3  Different services rely on several standard PostgresQL databases, the most important one being the State Database.
     4  
     5  Configuring each DB is trivial if done with an orchestration tool such as Docker Compose.
     6  
     7  The following are examples on how one would provision each DB to serve along the components (rpc, aggregator, sequencer...)
     8  
     9  Note the `environment` values will change per DB.
    10  
    11  - **StateDB**:
    12  
    13  The StateDB needs to generate some extra databases and tables (`merkletree`) for use with the MerkleTree/Executor service.
    14  
    15  This is done via an sql file: [init_prover_db.sql](https://github.com/0xPolygon/supernets2-node/blob/develop/db/scripts/init_prover_db.sql)
    16  
    17  ```yaml
    18  supernets2-state-db:
    19      container_name: supernets2-state-db
    20      image: postgres
    21      deploy:
    22        resources:
    23          limits:
    24            memory: 2G
    25          reservations:
    26            memory: 1G
    27      ports:
    28        - 5432:5432
    29      volumes:
    30        - ./init_prover_db.sql:/docker-entrypoint-initdb.d/init.sql
    31      environment:
    32        - POSTGRES_USER=state_user
    33        - POSTGRES_PASSWORD=state_password
    34        - POSTGRES_DB=state_db
    35      command: ["postgres", "-N", "500"]
    36  ```
    37  
    38  - **Other DBs: Pool/RPC**:
    39  
    40  ```yaml
    41    supernets2-pool-db:
    42      container_name: supernets2-pool-db
    43      image: postgres
    44      deploy:
    45        resources:
    46          limits:
    47            memory: 2G
    48          reservations:
    49            memory: 1G
    50      ports:
    51        - 5433:5432
    52      environment:
    53        - POSTGRES_USER=pool_user
    54        - POSTGRES_PASSWORD=pool_password
    55        - POSTGRES_DB=pool_db
    56      command: ["postgres", "-N", "500"]
    57  ```