diff --git a/__swarm/gitea/gitea-swarm.yml b/__swarm/gitea/gitea-swarm.yml index 8e89633..b832ffa 100644 --- a/__swarm/gitea/gitea-swarm.yml +++ b/__swarm/gitea/gitea-swarm.yml @@ -2,11 +2,11 @@ version: '3.9' services: server: environment: - USER_UID: 1000 - USER_GID: 1000 + USER_UID: '1000' + USER_GID: '1000' ROOT_URL: https://gitea.sectorq.eu - ENABLE_PASSWORD_SIGNIN_FORM: false - DISABLE_REGISTRATION: true + ENABLE_PASSWORD_SIGNIN_FORM: 'false' + DISABLE_REGISTRATION: 'true' image: ${DOCKER_REGISTRY:-}gitea/gitea:latest networks: - gitea @@ -23,21 +23,21 @@ services: restart_policy: condition: any labels: - com.centurylinklabs.watchtower.enable: true + com.centurylinklabs.watchtower.enable: 'true' homepage.container: gitea - homepage.description: Version control server - homepage.group: Utilities - homepage.href: https://${APPNAME}.sectorq.eu - homepage.icon: ${APPNAME}.png - homepage.name: Gitea + homepage.description: version control server + homepage.group: utilities + homepage.href: https://${appname}.sectorq.eu + homepage.icon: ${appname}.png + homepage.name: gitea homepage.server: my-docker - homepage.weight: 1 - homepage.widget.key: ${TOKEN} - homepage.widget.type: ${APPNAME} - homepage.widget.url: https://${APPNAME}.sectorq.eu - homepage.widget.version: 2 - wud.watch: true - wud.watch.digest: true + homepage.weight: '1' + homepage.widget.key: ${token} + homepage.widget.type: ${appname} + homepage.widget.url: https://${appname}.sectorq.eu + homepage.widget.version: '2' + wud.watch: 'true' + wud.watch.digest: 'true' placement: constraints: - node.role == manager @@ -46,7 +46,7 @@ services: environment: CONFIG_FILE: /config/config.yaml GITEA_INSTANCE_URL: https://gitea.sectorq.eu/ - GITEA_RUNNER_REGISTRATION_TOKEN: 8nmKqJhkvYwltmNfF2o9vs0tzo70ufHSQpVg6ymb + GITEA_RUNNER_REGISTRATION_TOKEN: 8nmkqjhkvywltmnff2o9vs0tzo70ufhsqpvg6ymb GITEA_RUNNER_NAME: jaydee GITEA_RUNNER_LABELS: jaydee volumes: @@ -59,8 +59,8 @@ services: restart_policy: condition: any labels: - wud.watch: true - wud.watch.digest: true + wud.watch: 'true' + wud.watch.digest: 'true' placement: constraints: - node.role == manager diff --git a/yaml_convert.py b/yaml_convert.py index 9c8aa80..7c8aa6e 100644 --- a/yaml_convert.py +++ b/yaml_convert.py @@ -23,40 +23,51 @@ def convert_service(service): deploy_section = default_deploy() for key, value in service.items(): - + #print(key, value) # Unsupported in Swarm if key in ["container_name", "restart", "depends_on"]: continue # Move labels → deploy.labels + #print(f"Labels: {deploy_section['labels']}") if key == "labels": + input(f"Key: {key} Value: {value}") + #print("Processing Labels:") if isinstance(value, dict): - deploy_section["labels"].update(value) + deploy_section["labels"].update({k: str(v).lower() for k, v in value.items()}) + + elif isinstance(value, list): for item in value: if "=" in item: k, v = item.split("=", 1) - deploy_section["labels"][k] = v + deploy_section["labels"][k] = str(v).lower() + continue - + swarm_service[key] = value - - print(swarm_service['environment']) - + for en in swarm_service['environment']: + #print(f"Environment Variable: {en} : {swarm_service['environment'][en]}") + swarm_service['environment'][en] = str(swarm_service['environment'][en]).lower() + #print("Deploy Section:") + #print(swarm_service) # Merge user deploy section if present + #input(service) if "deploy" in service: user_deploy = service["deploy"] - + #print("User Deploy Section:") # merge deploy.labels if "labels" in user_deploy: + ##print("User Deploy Labels:") labels = user_deploy["labels"] if isinstance(labels, dict): deploy_section["labels"].update(labels) elif isinstance(labels, list): for item in labels: + #print(f"Label Item: {item}") if "=" in item: k, v = item.split("=", 1) - deploy_section["labels"][k] = v + deploy_section["labels"][k] = str(v).lower() # merge placement constraints if "placement" in user_deploy: