Files
I-Form_Research_Server_Stack/deploy
2024-01-08 17:55:04 +00:00

30 lines
1.0 KiB
Plaintext
Executable File

#!/usr/bin/env poetry run python
from typing import Optional
import typer # type: ignore
import subprocess
import portainer # type: ignore
def docker_deploy_core(stack_name: Optional[str] = "core"):
"""Simply deploys the core services"""
subprocess.run(["docker", "stack", "deploy", "-c", "docker-compose.yaml", stack_name])
def docker_deploy_stack(username: str, password: str, stack_name: Optional[str] = "stack"):
"""Deploys the stack using the portainer api, to allow for complete control over the stack"""
breakpoint() #! TODO: Implement way of using portainer api to deploy stack
# subprocess.run(["docker", "stack", "deploy", "-c", "stack.yaml", stack_name])
def docker_deploy_all(core_name: Optional[str] = "core", stack_name: Optional[str] = "stack"):
"""Deploys the core services and the stack"""
docker_deploy_core(core_name)
docker_deploy_stack(stack_name)
if __name__ == "__main__":
# typer.run(docker_deploy_all)
# docker_deploy_core("core")
typer.run(docker_deploy_stack)