Persist backing `/data/` filesystem across container runs
parent
a0c3d5f32f
commit
88411a6a26
|
@ -186,6 +186,7 @@ async def open_marketstore(
|
||||||
log = get_console_log('info', name=__name__)
|
log = get_console_log('info', name=__name__)
|
||||||
|
|
||||||
async with open_docker() as client:
|
async with open_docker() as client:
|
||||||
|
|
||||||
# create a mount from user's local piker config dir into container
|
# create a mount from user's local piker config dir into container
|
||||||
config_dir_mnt = docker.types.Mount(
|
config_dir_mnt = docker.types.Mount(
|
||||||
target='/etc',
|
target='/etc',
|
||||||
|
@ -193,6 +194,20 @@ async def open_marketstore(
|
||||||
type='bind',
|
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(
|
cntr: Container = client.containers.run(
|
||||||
'alpacamarkets/marketstore:latest',
|
'alpacamarkets/marketstore:latest',
|
||||||
# do we need this for cmds?
|
# do we need this for cmds?
|
||||||
|
@ -203,7 +218,7 @@ async def open_marketstore(
|
||||||
'5993/tcp': 5993, # jsonrpc
|
'5993/tcp': 5993, # jsonrpc
|
||||||
'5995/tcp': 5995, # grpc
|
'5995/tcp': 5995, # grpc
|
||||||
},
|
},
|
||||||
mounts=[config_dir_mnt],
|
mounts=[config_dir_mnt, data_dir_mnt],
|
||||||
detach=True,
|
detach=True,
|
||||||
stop_signal='SIGINT',
|
stop_signal='SIGINT',
|
||||||
init=True,
|
init=True,
|
||||||
|
|
Loading…
Reference in New Issue