Added autogenerated portainer api

This commit is contained in:
Cian Hughes
2024-01-08 17:55:04 +00:00
parent fec3d49129
commit 753742c868
11 changed files with 573 additions and 2 deletions

29
deploy Executable file
View File

@@ -0,0 +1,29 @@
#!/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)