From 7e960263418ad263f7bdd1dee09a5cce91bfd6e8 Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Fri, 12 Jan 2024 16:15:23 +0000 Subject: [PATCH] Added versions and fixed kwargs in deploy --- backend.yaml | 5 ----- deploy | 23 +++++++++++++---------- frontend.yaml | 5 ----- networks.yaml | 2 ++ secrets.yaml | 2 ++ volumes.yaml | 2 ++ 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/backend.yaml b/backend.yaml index 5dca7e9..0bfeb33 100644 --- a/backend.yaml +++ b/backend.yaml @@ -1,10 +1,5 @@ version: "3.8" -include: - - volumes.yaml - - networks.yaml - - secrets.yaml - services: ###~~~~~~ First, we should plan our network management services ~~~~~~### # Obviously, we should add the portainer agent service for managing swarm resources diff --git a/deploy b/deploy index 490e607..e6f21c0 100755 --- a/deploy +++ b/deploy @@ -33,21 +33,24 @@ def portainer_deploy_stack(stack_file: str, stacks: portainer.api.stacks_api.Sta else: raise FileNotFoundError(f"Could not find stack file {stack_file}") - print(f"Deploying stack {stack_name} from {stack_path}") stack_name = stack_name or stack_path.stem + repository_url = fetch_repository_url() + print(f"Deploying stack {stack_name} from {stack_path} @ {repository_url}") + scoped_kwargs = { + # "auto_update": portainer.PortainerAutoUpdateSettings( + # interval="60m", + # ), + "name": stack_name, + "compose_file": str(stack_path), + "swarm_id": docker.from_env().swarm.id, + "repository_url": repository_url, + } + scoped_kwargs.update(kwargs) stacks.stack_create_docker_swarm_repository( endpoint_id=endpoint_id, body = portainer.StacksSwarmStackFromGitRepositoryPayload( - **{ - # "auto_update": portainer.PortainerAutoUpdateSettings( - # interval="60m", - # ), - "name": stack_name, - "compose_file": str(stack_path), - "swarm_id": docker.from_env().swarm.id, - "repository_url": fetch_repository_url(), - }.update(kwargs), + **scoped_kwargs, ) ) print(f"Stack {stack_name} deployed") diff --git a/frontend.yaml b/frontend.yaml index 2ef44cb..9717d9f 100644 --- a/frontend.yaml +++ b/frontend.yaml @@ -1,10 +1,5 @@ version: "3.8" -include: - - volumes.yaml - - networks.yaml - - secrets.yaml - services: # This service runs a grafana instance for hosting dashboards grafana: diff --git a/networks.yaml b/networks.yaml index bd1f960..b71dd67 100644 --- a/networks.yaml +++ b/networks.yaml @@ -1,3 +1,5 @@ +version: "3.8" + networks: i-form_research_server_stack: driver: overlay diff --git a/secrets.yaml b/secrets.yaml index c875f79..9d17489 100644 --- a/secrets.yaml +++ b/secrets.yaml @@ -1,3 +1,5 @@ +version: "3.8" + secrets: elabftw_sql_key: external: true diff --git a/volumes.yaml b/volumes.yaml index 9afc712..dd85e5b 100644 --- a/volumes.yaml +++ b/volumes.yaml @@ -1,3 +1,5 @@ +version: "3.8" + # This defines the NFS volumes for persistence #! This requires nodes to be IP whitelisted in the NAS volumes: