Compare commits

..

No commits in common. "c41839980798109a2c657e01d402b078285805cd" and "cf44cb59b3b972c3c8044047084b9f607b7ae73f" have entirely different histories.

8 changed files with 19 additions and 93 deletions

View File

@ -23,11 +23,11 @@ Moreover, our vision goes beyond just IT infrastructure; it extends to the broad
Ultimately, our vision is to redefine the way IT infrastructure is deployed and managed, offering a solution that is swift, secure, and scalable, capable of meeting the needs of businesses, individuals, NGOs, and large enterprises. CyMaIS will empower all stakeholders by providing a foundation for a decentralized, transparent, and resilient digital future—setting a new benchmark for security, reliability, and sovereignty in the digital age. Ultimately, our vision is to redefine the way IT infrastructure is deployed and managed, offering a solution that is swift, secure, and scalable, capable of meeting the needs of businesses, individuals, NGOs, and large enterprises. CyMaIS will empower all stakeholders by providing a foundation for a decentralized, transparent, and resilient digital future—setting a new benchmark for security, reliability, and sovereignty in the digital age.
## Key Points ## Key Points
- Empower people and institutions 1. Empowerment people and institutions
- Data sovereignty 2. Data sovereignty
- Control over infrastructure 3. Control over infrastructure
- Automated infrastructure setup 4. Automated infrastructure setup
- Open Source 5. Open Source
- Decentralized Services 6. Decentralized Services
- Scalabel 7. Scalabel
- Global resilience and security 8. Global resilience and security

View File

@ -23,8 +23,7 @@ defaults_domains:
mailu: "mail.{{primary_domain}}" mailu: "mail.{{primary_domain}}"
mastodon: "microblog.{{primary_domain}}" mastodon: "microblog.{{primary_domain}}"
# ATTENTION: Will be owerwritten by the values in domains. Not merged. # ATTENTION: Will be owerwritten by the values in domains. Not merged.
mastodon_alternates: mastodon_alternates: ["mastodon.{{primary_domain}}"]
- "mastodon.{{primary_domain}}"
matomo: "matomo.{{primary_domain}}" matomo: "matomo.{{primary_domain}}"
matrix_synapse: "matrix.{{primary_domain}}" matrix_synapse: "matrix.{{primary_domain}}"
matrix_element: "element.{{primary_domain}}" matrix_element: "element.{{primary_domain}}"
@ -48,6 +47,7 @@ defaults_domains:
yourls: "s.{{primary_domain}}" yourls: "s.{{primary_domain}}"
# ATTENTION: Will be owerwritten by the values in domains. Not merged. # ATTENTION: Will be owerwritten by the values in domains. Not merged.
wordpress: wordpress:
- "wordpress.{{primary_domain}}"
- "blog.{{primary_domain}}" - "blog.{{primary_domain}}"
## Domain Redirects ## Domain Redirects
@ -74,4 +74,3 @@ defaults_redirect_domain_mappings:
- { source: "snipe-it.{{primary_domain}}", target: "{{domains.snipe_it}}" } - { source: "snipe-it.{{primary_domain}}", target: "{{domains.snipe_it}}" }
- { source: "taiga.{{primary_domain}}", target: "{{domains.taiga}}" } - { source: "taiga.{{primary_domain}}", target: "{{domains.taiga}}" }
- { source: "videos.{{primary_domain}}", target: "{{domains.peertube}}" } - { source: "videos.{{primary_domain}}", target: "{{domains.peertube}}" }
- { source: "wordpress.{{primary_domain}}", target: "{{domains.wordpress[0]}}" }

View File

@ -85,18 +85,10 @@ class LookupModule(LookupBase):
except Exception as e: except Exception as e:
raise AnsibleError("Error reading '{}': {}".format(meta_path, str(e))) raise AnsibleError("Error reading '{}': {}".format(meta_path, str(e)))
# Retrieve domains and applications from the variables # Build URL and retrieve iframe flag
domains = variables.get("domains", {}) domains = variables.get("domains", {})
applications = variables.get("applications", {}) applications = variables.get("applications", {})
domain_url = domains.get(application_id, "") domain_url = domains.get(application_id, "")
# Check if domain_url is a list. If so, select the first element.
if isinstance(domain_url, list):
domain_url = domain_url[0]
else:
domain_url = ""
# Construct the URL using the domain_url if available.
url = "https://" + domain_url if domain_url else "" url = "https://" + domain_url if domain_url else ""
app_data = applications.get(application_id, {}) app_data = applications.get(application_id, {})

View File

@ -1,28 +1,2 @@
# Docker Healer 🩺 # heal-docker
docker-compose restart for containers which are unhealty or excited
## Description
This Ansible role automatically restarts Docker Compose configurations with exited or unhealthy containers on Arch Linux systems. It ensures the stability of containerized workloads by recovering from common error conditions like port binding issues.
## Overview
Tailored for Arch Linux, this role monitors containers for failure states and initiates a controlled restart of affected Compose configurations. If port conflicts prevent recovery, the role stops the affected stack, restarts Docker, and recreates the container environment.
## Purpose
The purpose of this role is to provide automated healing for Docker Compose environments, minimizing manual recovery effort and reducing downtime.
## Features
- **Container Health Monitoring:** Detects unhealthy or exited containers.
- **Automated Recovery:** Restarts failed containers and resolves port binding issues.
- **Run-once Setup Logic:** Ensures idempotent execution by controlling task flow with internal flags.
- **System Role Integration:** Seamlessly integrates with CyMaIS system maintenance logic.
## Credits 📝
Developed and maintained by **Kevin Veen-Birkenbach**.
Learn more at [www.veen.world](https://www.veen.world)
Part of the [CyMaIS Project](https://github.com/kevinveenbirkenbach/cymais)
License: [CyMaIS NonCommercial License (CNCL)](https://s.veen.world/cncl)

View File

@ -12,11 +12,10 @@ def bash(command):
process = subprocess.Popen([command], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) process = subprocess.Popen([command], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
out, err = process.communicate() out, err = process.communicate()
stdout = out.splitlines() stdout = out.splitlines()
stderr = err.decode("utf-8").strip() # decode stderr
output = [line.decode("utf-8") for line in stdout] output = [line.decode("utf-8") for line in stdout]
if process.returncode > 0: if process.wait() > bool(0):
print(command, out, err) print(command, out, err)
raise Exception(stderr) # pass the actual error text raise Exception("Exitcode is greater than 0")
return output return output
def list_to_string(lst): def list_to_string(lst):
@ -61,23 +60,11 @@ def main(base_directory):
if compose_file_path: if compose_file_path:
print("Restarting unhealthy container in:", compose_file_path) print("Restarting unhealthy container in:", compose_file_path)
project_path = os.path.dirname(compose_file_path) print_bash(f'cd {os.path.dirname(compose_file_path)} && docker-compose -p "{repo}" restart')
try:
print_bash(f'cd {project_path} && docker-compose -p "{repo}" restart')
except Exception as e:
if "port is already allocated" in str(e):
print("Detected port allocation problem. Executing recovery steps...")
print_bash(f'cd {project_path} && docker-compose down')
print_bash('systemctl restart docker')
print_bash(f'cd {project_path} && docker-compose -p "{repo}" up -d')
else:
print("Unhandled exception during restart:", e)
errors += 1
else: else:
print("Error: Docker Compose file not found for:", repo) print("Error: Docker Compose file not found for:", repo)
errors += 1 errors += 1
print("Finished restart procedure.") print("Finished restart procedure.")
exit(errors) exit(errors)

View File

@ -1,5 +1,4 @@
- name: restart heal-docker.cymais.service - name: "reload heal-docker.cymais.service"
systemd: systemd:
name: heal-docker.cymais.service name: heal-docker.cymais.service
state: restarted
daemon_reload: yes daemon_reload: yes

View File

@ -1,26 +1,2 @@
---
galaxy_info:
author: "Kevin Veen-Birkenbach"
description: "Automated recovery for unhealthy or exited Docker Compose containers."
license: "CyMaIS NonCommercial License (CNCL)"
license_url: "https://s.veen.world/cncl"
company: |
Kevin Veen-Birkenbach
Consulting & Coaching Solutions
https://www.veen.world
min_ansible_version: "2.9"
platforms:
- name: Archlinux
versions:
- rolling
galaxy_tags:
- docker
- docker-compose
- systemd
- automation
- archlinux
repository: https://s.veen.world/cymais
issue_tracker_url: https://s.veen.world/cymaisissues
documentation: https://s.veen.world/cymais
dependencies: dependencies:
- system-maintenance-lock - system-maintenance-lock

View File

@ -9,14 +9,13 @@
copy: copy:
src: heal-docker.py src: heal-docker.py
dest: "{{heal_docker}}heal-docker.py" dest: "{{heal_docker}}heal-docker.py"
notify: restart heal-docker.cymais.service
when: run_once_heal_docker is not defined when: run_once_heal_docker is not defined
- name: create heal-docker.cymais.service - name: create heal-docker.cymais.service
template: template:
src: heal-docker.service.j2 src: heal-docker.service.j2
dest: /etc/systemd/system/heal-docker.cymais.service dest: /etc/systemd/system/heal-docker.cymais.service
notify: restart heal-docker.cymais.service notify: reload heal-docker.cymais.service
when: run_once_heal_docker is not defined when: run_once_heal_docker is not defined
- name: set service_name to the name of the current role - name: set service_name to the name of the current role