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
412 stars 512 forks source link

Multi-tenancy mode: wallets are not recreated upon restart when using postgres storage #1344

Closed JovanShandro closed 3 years ago

JovanShandro commented 3 years ago

Hello! Sorry if this has already been asked but I couldn't find anything on it.

I am trying to start a multi tenant agent and also use postgres for storing the wallets. The command I am using to start the agent is:

aca-py start --admin-api-key secret \
                -e http://localhost:8000 \
                --genesis-url http://dev.greenlight.bcovrin.vonx.io/genesis \
                --inbound-transport http 0.0.0.0 8000 \
                --admin 0.0.0.0 8001 \
                --outbound-transport http \
                --webhook-url <my webhook url> \
                --trace-target log --trace-tag acapy.events --trace-label test.trace \
                -l my_agent \
                --multitenant \
                --multitenant-admin \
                --jwt-secret secret \
                --wallet-storage-type postgres_storage \
                --wallet-storage-config '{"url":"localhost:5432", "wallet_scheme":"DatabasePerWallet"}' \
                --wallet-storage-creds '{"account": "admin","password": "secret","admin_account":"admin", "admin_password":"secret"}' \
                --storage-type 'indy' \
                --wallet-type 'indy' \
                --wallet-name 'bobwallet' --wallet-key 'bobkey'

Every functionality works fine as I have tried creating multiple wallets, create connections between them etc. In the postgres database one database is created per wallet, however when I stop the agent (e.g via ctrl-c), the wallets are still stored in postgres, but when I restart the agent and try to query the wallets it shows there are no wallets. If I try to create a wallet with the same name as one of the wallets already stored in postgres, it gives an error that a wallet with that name already exists, however if I query the wallets (via /multitenancy/wallets) it will return this new wallet that shouldn't have been created due to the error.

I have also tried to remove the last 3/4 parameters and also tried the --auto-provision one but they didn't work.

I wanted to ask how can we make the agent store the data somewhere so that nothing is lost on restart? If yes how? Any help would be greatly appreciated! Thank you!

swcurran commented 3 years ago

Heads up on this -- @TimoGlastra @dbluhm

@shaangill025 -- when you are back online, could you please take a look at this and see if you can spot anything? Thanks!

esune commented 3 years ago

@JovanShandro we are using the multi-tenant wallet and postgres without issues in aries-vcr-issuer-agency. You can see the startup parameters we use in this docker-compose: at first glimpse other than needing the --auto-provision flag you also seem to be missing the --wallet-key and --seed parameters to be used for the base wallet.

JovanShandro commented 3 years ago

@esune Thank you! Just adding the missing flags worked!