diff --git a/piker/data/_ahab.py b/piker/data/_ahab.py index 9ec805a8..59bb4d55 100644 --- a/piker/data/_ahab.py +++ b/piker/data/_ahab.py @@ -186,6 +186,7 @@ async def open_marketstore( log = get_console_log('info', name=__name__) async with open_docker() as client: + # create a mount from user's local piker config dir into container config_dir_mnt = docker.types.Mount( target='/etc', @@ -193,6 +194,20 @@ async def open_marketstore( type='bind', ) + # create a user config subdir where the marketstore + # backing filesystem database can be persisted. + persistent_data_dir = os.path.join( + config._config_dir, 'data', + ) + if not os.path.isdir(persistent_data_dir): + os.mkdir(persistent_data_dir) + + data_dir_mnt = docker.types.Mount( + target='/data', + source=persistent_data_dir, + type='bind', + ) + cntr: Container = client.containers.run( 'alpacamarkets/marketstore:latest', # do we need this for cmds? @@ -203,7 +218,7 @@ async def open_marketstore( '5993/tcp': 5993, # jsonrpc '5995/tcp': 5995, # grpc }, - mounts=[config_dir_mnt], + mounts=[config_dir_mnt, data_dir_mnt], detach=True, stop_signal='SIGINT', init=True,