mirror of
https://github.com/logos-blockchain/logos-blockchain-block-explorer-template.git
synced 2026-01-04 06:03:09 +00:00
29 lines
697 B
Python
29 lines
697 B
Python
|
|
from os import environ
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
from python_on_whales.docker_client import DockerClient
|
||
|
|
|
||
|
|
from node.manager.base import NodeManager
|
||
|
|
|
||
|
|
|
||
|
|
class DockerModeManager(NodeManager):
|
||
|
|
COMPOSE_FILE: Path = Path(environ["NODE_COMPOSE_FILEPATH"])
|
||
|
|
|
||
|
|
def __init__(self):
|
||
|
|
self.client: DockerClient = DockerClient(
|
||
|
|
client_type="docker",
|
||
|
|
compose_files=[
|
||
|
|
self.COMPOSE_FILE,
|
||
|
|
],
|
||
|
|
)
|
||
|
|
|
||
|
|
async def start(self):
|
||
|
|
self.client.compose.up(
|
||
|
|
detach=True,
|
||
|
|
build=False,
|
||
|
|
remove_orphans=True,
|
||
|
|
)
|
||
|
|
|
||
|
|
async def stop(self):
|
||
|
|
self.client.compose.down(remove_orphans=True, volumes=True)
|