stack-orchestrator/stack_orchestrator/deploy/deployer.py

69 lines
1.7 KiB
Python
Raw Normal View History

2023-10-24 20:44:48 +00:00
# Copyright © 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
from abc import ABC, abstractmethod
2023-11-06 06:21:53 +00:00
from pathlib import Path
2023-10-24 20:44:48 +00:00
class Deployer(ABC):
@abstractmethod
def up(self, detach, services):
2023-10-24 20:44:48 +00:00
pass
@abstractmethod
def down(self, timeout, volumes):
2023-10-24 20:44:48 +00:00
pass
2023-12-05 21:13:32 +00:00
@abstractmethod
def update(self):
pass
2023-10-24 20:44:48 +00:00
@abstractmethod
def ps(self):
2023-10-24 20:44:48 +00:00
pass
@abstractmethod
def status(self):
pass
2023-10-24 20:44:48 +00:00
@abstractmethod
def port(self, service, private_port):
2023-10-24 20:44:48 +00:00
pass
@abstractmethod
2023-10-30 04:26:15 +00:00
def execute(self, service_name, command, tty, envs):
2023-10-24 20:44:48 +00:00
pass
@abstractmethod
def logs(self, services, tail, follow, stream):
2023-10-24 20:44:48 +00:00
pass
@abstractmethod
def run(self, image: str, command=None, user=None, volumes=None, entrypoint=None, env={}, ports=[], detach=False):
2023-10-24 20:44:48 +00:00
pass
class DeployerException(Exception):
def __init__(self, *args: object) -> None:
super().__init__(*args)
2023-11-06 06:21:53 +00:00
class DeployerConfigGenerator(ABC):
@abstractmethod
def generate(self, deployment_dir: Path):
pass