openwallet-foundation / acapy

ACA-Py is a foundation for building decentralized identity applications and services running in non-mobile environments.
https://aca-py.org
Apache License 2.0
419 stars 510 forks source link

Can't start acapy with "Error opening store" #3285

Closed alterkim closed 3 weeks ago

alterkim commented 1 month ago

Hi, I'm trying to start acapy v1.0.0 with this docker-compose.yml.

version: '3'

services:
  acapy:
    image: ghcr.io/hyperledger/aries-cloudagent-python:py3.12-1.0.0
    restart: on-failure
    depends_on:
      - db
    env_file:
      - holder1.env
    environment:
      WAIT_HOSTS: "db:5432"
      WAIT_HOSTS_TIMEOUT: "300"
      WAIT_SLEEP_INTERVAL: "5"
      WAIT_HOST_CONNECT_TIMEOUT: "3"
    ports:
      - "${ADMIN_PORT}:${ADMIN_PORT}"
      - "${ENDPOINT_PORT}:${ENDPOINT_PORT}"
    entrypoint: /bin/bash
    command: [
      "-c",
      "curl -d '{\"seed\":\"${WALLET_SEED}\", \"role\":\"TRUST_ANCHOR\", \"alias\":\"${LABEL}\"}' -X POST ${LEDGER_URL}/register; \
      sleep 5; \
      /wait; \
      aca-py start \
      --label ${LABEL}
      --endpoint http://${IP_ADDRESS}:${ENDPOINT_PORT} \
      --inbound-transport http '0.0.0.0' ${ENDPOINT_PORT} \
      --outbound-transport http \
      --admin '0.0.0.0' ${ADMIN_PORT} \
      --admin-insecure-mode \
      --auto-provision \
      --auto-ping-connection \
      --auto-respond-messages \
      --auto-accept-invites \
      --auto-accept-requests \
      --multitenant \
      --multitenant-admin \
      --multitenancy-config '{\"wallet_type\":\"single-wallet-askar\"}' \
      --plugin multitenant_provider.v1_0 \
      --jwt-secret ${MULTITENANT_JWT_SECRET} \
      --preserve-exchange-records \
      --wallet-type askar \
      --wallet-name ${WALLET_NAME} \
      --wallet-key ${WALLET_KEY} \
      --wallet-storage-type postgres_storage \
      --wallet-storage-config '{\"url\":\"db:5432\", \"max_connections\":5}' \
      --wallet-storage-creds '{\"account\":\"${DB_ACCOUNT_NAME}\",\"password\":\"${DB_ACCOUNT_PASSWORD}\",\"admin_account\":\"${DB_ACCOUNT_NAME}\",\"admin_password\":\"${DB_ACCOUNT_PASSWORD}\"}' \
      --webhook-url ${WEBHOOK_URL}
      --seed ${WALLET_SEED} \
      --genesis-url ${LEDGER_URL}/genesis \
      --log-file acapy.log \
      --log-level ${LOG_LEVEL} \
      --log-config aries_cloudagent.config:default_per_tenant_logging_config.ini",
    ]
    networks:
      - holder1

  db:
    image: postgres:15.3
    restart: on-failure
    env_file:
      - holder1.env
    volumes:
      - wallet_data:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: ${DB_ACCOUNT_NAME}
      POSTGRES_PASSWORD: ${DB_ACCOUNT_PASSWORD}
    expose:
      - 5432
    networks:
      - holder1

networks:
  holder1:
    external: true
    name: von_von

volumes:
  wallet_data:

But I am fighting with this error.

ERROR:aries_cloudagent.commands.start:Exception during startup:
Traceback (most recent call last):
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/askar/store.py", line 163, in open_store

Shutting down
    store = await Store.open(
            ^^^^^^^^^^^^^^^^^
  File "/home/aries/.local/lib/python3.12/site-packages/aries_askar/store.py", line 352, in open
    return Store(await bindings.store_open(uri, key_method, pass_key, profile), uri)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aries/.local/lib/python3.12/site-packages/aries_askar/bindings/__init__.py", line 87, in store_open
    return await invoke_async(
           ^^^^^^^^^^^^^^^^^^^
  File "/home/aries/.local/lib/python3.12/site-packages/aries_askar/bindings/lib.py", line 362, in invoke_async
    return await self.loaded.invoke_async(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/futures.py", line 287, in __await__
    yield self  # This tells Task to wait for completion.
    ^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 385, in __wakeup
    future.result()
  File "/usr/local/lib/python3.12/asyncio/futures.py", line 203, in result
    raise self._exception.with_traceback(self._exception_tb)
aries_askar.error.AskarError: Error fetching store configuration
Caused by: error returned from database: relation "config" does not exist

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/commands/start.py", line 72, in init
    await startup
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/commands/start.py", line 28, in start_app
    await conductor.setup()
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/core/conductor.py", line 144, in setup
    self.root_profile, self.setup_public_did = await wallet_config(context)
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/config/wallet.py", line 54, in wallet_config
    profile = await mgr.open(context, profile_cfg)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/askar/profile.py", line 337, in open
    opened = await store_config.open_store(provision=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/askar/store.py", line 172, in open_store
    self._handle_open_error(err, retry=True)
  File "/home/aries/.local/lib/python3.12/site-packages/aries_cloudagent/askar/store.py", line 143, in _handle_open_error
    raise ProfileError("Error opening store") from err
aries_cloudagent.core.error.ProfileError: Error opening store

I tried to solve it, but it didn't work. Can I get any idea how to solve it?

WadeBarnes commented 1 month ago

It looks like you're not supplying the DB_ACCOUNT_NAME and DB_ACCOUNT_PASSWORD environment variables to the acapy container, along with several other environment variables you've listed in the startup command.

Example; https://github.com/bcgov/aries-vcr/blob/main/docker/docker-compose.yml

jamshale commented 3 weeks ago

I don't think this needs an open issue. If you have additional context or problems, please re-open.