Added versions and fixed kwargs in deploy

This commit is contained in:
Cian Hughes
2024-01-12 16:15:23 +00:00
parent c422a9f7d9
commit 7e96026341
6 changed files with 19 additions and 20 deletions

View File

@@ -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

17
deploy
View File

@@ -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}")
stacks.stack_create_docker_swarm_repository(
endpoint_id=endpoint_id,
body = portainer.StacksSwarmStackFromGitRepositoryPayload(
**{
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": fetch_repository_url(),
}.update(kwargs),
"repository_url": repository_url,
}
scoped_kwargs.update(kwargs)
stacks.stack_create_docker_swarm_repository(
endpoint_id=endpoint_id,
body = portainer.StacksSwarmStackFromGitRepositoryPayload(
**scoped_kwargs,
)
)
print(f"Stack {stack_name} deployed")

View File

@@ -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:

View File

@@ -1,3 +1,5 @@
version: "3.8"
networks:
i-form_research_server_stack:
driver: overlay

View File

@@ -1,3 +1,5 @@
version: "3.8"
secrets:
elabftw_sql_key:
external: true

View File

@@ -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: