Compare commits

..

9 Commits

18 changed files with 264 additions and 137 deletions

View File

@ -1,11 +1,10 @@
# License Agreement
## CyMaIS NonCommercial License (CNCL)
# CyMaIS NonCommercial License (CNCL)
### Definitions
## Definitions
- **"Software":** Refers to *"[CyMaIS - Cyber Master Infrastructure Solution](https://cymais.cloud/)"* and its associated source code.
- **"Commercial Use":** Any use of the Software intended for direct or indirect financial gain, including but not limited to sales, rentals, or provision of services.
### Provisions
## Provisions
1. **Attribution of the Original Licensor:** In any distribution or publication of the Software or derivative works, the original licensor, *Kevin Veen-Birkenbach, Email: [license@veen.world](mailto:license@veen.world), Website: [https://www.veen.world/](https://www.veen.world/)* must be explicitly named.
@ -24,5 +23,5 @@
7. **Ownership of Rights:** All rights, including copyright, trademark, and other forms of intellectual property related to the Software, belong exclusively to Kevin Veen-Birkenbach.
### Consent
## Consent
By using, modifying, or distributing the Software, you agree to these terms.

View File

@ -1,5 +1,4 @@
# CyMaIS
## Cyber Master Infrastructure Solution
# CyMaIS - Cyber Master Infrastructure Solution
[![GitHub Sponsors](https://img.shields.io/badge/Sponsor-GitHub%20Sponsors-blue?logo=github)](https://github.com/sponsors/kevinveenbirkenbach) [![Patreon](https://img.shields.io/badge/Support-Patreon-orange?logo=patreon)](https://www.patreon.com/c/kevinveenbirkenbach) [![Buy Me a Coffee](https://img.shields.io/badge/Buy%20me%20a%20Coffee-Funding-yellow?logo=buymeacoffee)](https://buymeacoffee.com/kevinveenbirkenbach) [![PayPal](https://img.shields.io/badge/Donate-PayPal-blue?logo=paypal)](https://s.veen.world/paypaldonate)
@ -15,7 +14,7 @@ Our intuitive interface, coupled with in-depth documentation, makes it accessibl
With CyMaIS, setting up a secure, scalable, and robust IT infrastructure is not just faster and easier, but also aligned with the best industry practices, ensuring that your organization stays ahead in the ever-evolving digital landscape.
### Vision
## Vision
Our project is anchored in the vision of transforming IT infrastructure deployment into a seamless, secure, and scalable experience.
We are committed to developing a fully automated solution that enables businesses of any size and industry to set up a 100% secure and infinitely scalable IT infrastructure in just 24 hours.
@ -46,7 +45,7 @@ For a deeper understanding of our goals and the ethos driving our project, we in
CyMaIS is more than just an IT solution; it's a commitment to empowering your business with the technology it needs to thrive in todays digital landscape, effortlessly and securely.
### Professional CyMaIS Implementation
## Professional CyMaIS Implementation
<img src="https://cybermaster.space/wp-content/uploads/sites/7/2023/11/FVG_8364BW-scaled.jpg" width="300" style="float: right; margin-left: 30px;">
My name is Kevin Veen-Birkenbach and I'm glad to assist you in the implementation of your secure and scalable IT infrastrucutre solution with CyMaIS.
@ -61,6 +60,6 @@ Contact me for more details:
📧 Email: [kevin@veen.world](mailto:kevin@veen.world)<br />
☎️ Phone: [+ 49 178 179 80 23](tel:00491781798023)
### License
## License
This project is licensed from Kevin Veen-Birkenbach. The full license is available in the [LICENSE.md](./LICENSE.md) of this repository.

View File

@ -550,8 +550,8 @@ defaults_applications:
## Sphinx
sphinx:
version: "3.9-slim" # Use latest docker image
volumes:
source_dir: "{ansible_playbook_dir}" # Path from which sphinx reads the documentation
repository_sphinx_source: "https://github.com/kevinveenbirkenbach/cymais.git" # Repository address to pull the source repository from
sphinx_exec_dir_relative: "sphinx/" # The relative path to the sphinx Makefile folder from the source dir
## Taiga

View File

@ -1,3 +1,4 @@
# Applications by Category
Applications by Category
=========================
.. roles-overview::

View File

@ -676,6 +676,7 @@ navigation:
{% endif %}
{% endif %}
{% endif %}
- name: Support Us
description: "Discover all the ways you can support our work."
icon:
@ -701,13 +702,17 @@ navigation:
icon:
class: fa-brands fa-github
url: https://s.veen.world/githubsponsors
{% if "spinx" in group_names %}
- name: Documentation & Support
{% if "sphinx" in group_names %}
- name: Documentation
description: Access our comprehensive documentation and support resources to help you get the most out of the software.
icon:
class: fas fa-book
url: https://{{domains.sphinx}}
{% endif %}
- name: Imprint
description: Check out the imprint information
icon:

View File

@ -0,0 +1,33 @@
ARG DOCKER_PYTHON_VERSION
FROM python:${DOCKER_PYTHON_VERSION}
ARG SPHINX_SOURCE_DIR
ARG SPHINX_BUILD_DIR
ARG SPHINX_EXEC_DIR
ARG SPHINX_APP_DIR
ARG SPHINX_SOURCE_DIR_RELATIVE
# Set the environment variables so they are available during build for Makefile
ENV SPHINX_SOURCE_DIR=${SPHINX_SOURCE_DIR}
ENV SPHINX_BUILD_DIR=${SPHINX_BUILD_DIR}
# Install required packages
RUN apt-get update && apt-get install -y make curl
# Set the working directory
WORKDIR ${SPHINX_APP_DIR}
# Copy the project files into the container
COPY ${SPHINX_SOURCE_DIR_RELATIVE} ${SPHINX_APP_DIR}
# Install Python packages via requirements.txt
RUN cd ${SPHINX_EXEC_DIR} && pip install --upgrade pip && pip install -r requirements.txt
# Build the HTML documentation using Sphinx with the defined directories
RUN cd ${SPHINX_EXEC_DIR} && make html
# Expose port 8000 where the HTTP server will run
EXPOSE 8000
# Start a simple HTTP server to serve the built documentation
CMD python -m http.server 8000 --directory "${SPHINX_BUILD_DIR}html/"

View File

@ -4,12 +4,19 @@
include_role:
name: docker-compose
- name: pull cymais repository
- name: "Create {{ host_sphinx_source_dir_absolute }} directory"
file:
path: "{{ host_sphinx_source_dir_absolute }}"
state: directory
mode: '0755'
- name: pull the source repository to build the Sphinx documentation from {{ applications.sphinx.repository_sphinx_source }}
git:
repo: "{{ repository_address_cymais }}"
dest: "{{ host_cymais_volume_dir_absolute }}"
repo: "{{ applications.sphinx.repository_sphinx_source }}"
dest: "{{ host_sphinx_source_dir_absolute }}"
update: yes
notify: docker compose project setup
clone: yes
notify: docker compose project build and setup
become: true
- name: "include role nginx-domain-setup for {{application_id}}"
@ -20,12 +27,12 @@
http_port: "{{ ports.localhost.http[application_id] }}"
- name: "create {{ sphinx_docker_file }}"
template:
src: "Dockerfile.j2"
copy:
src: "Dockerfile"
dest: "{{ sphinx_docker_file }}"
mode: '770'
force: yes
notify: docker compose project setup
notify: docker compose project build and setup
- name: "copy docker-compose.yml and env file"
include_tasks: copy-docker-compose-and-env.yml

View File

@ -1,22 +0,0 @@
FROM python:{{applications[application_id].version}}
# Install required packages including 'make'
RUN apt-get update && apt-get install -y make
# Set the working directory
WORKDIR {{docker_app_dir}}
# Copy the project files into the container
COPY {{host_cymais_volume_dir_relative}} {{docker_app_dir}}
# Install Python packages via requirements.txt
RUN cd {{docker_sphinx_dir}} && pip install --upgrade pip && pip install -r requirements.txt
# Build the HTML documentation using Sphinx with the defined directories
RUN cd {{docker_sphinx_dir}} && make html
# Expose port 8000 where the HTTP server will run
EXPOSE 8000
# Start a simple HTTP server to serve the built documentation
CMD ["python", "-m", "http.server", "8000", "--directory", "${BUILD_DIR}"]

View File

@ -1,6 +1,15 @@
services:
application:
build: .
build:
context: .
dockerfile: Dockerfile
args:
SPHINX_SOURCE_DIR: {{docker_source_dir}}
SPHINX_BUILD_DIR: {{docker_output_dir}}
SPHINX_EXEC_DIR: {{docker_exec_dir}}
SPHINX_APP_DIR: {{docker_app_dir}}
SPHINX_SOURCE_DIR_RELATIVE: {{host_sphinx_source_dir_relative}}
DOCKER_PYTHON_VERSION: {{applications[application_id].version}}
ports:
- "127.0.0.1:{{ports.localhost.http[application_id]}}:8000"
healthcheck:
@ -8,6 +17,7 @@ services:
interval: 1m
timeout: 10s
retries: 3
{% include 'roles/docker-compose/templates/services/base.yml.j2' %}
{% include 'templates/docker/container/networks.yml.j2' %}
{% include 'templates/docker/compose/networks.yml.j2' %}

View File

@ -1,2 +0,0 @@
SOURCE_DIR={{docker_source_dir}}
BUILD_DIR={{docker_output_dir}}

View File

@ -1,13 +1,11 @@
application_id: "sphinx"
repository_address_cymais: "https://github.com/kevinveenbirkenbach/cymais.git" # Repository address to pull cymais from
host_cymais_volume_dir_absolute: "{{docker_compose.directories.volumes}}cymais/" # Place where the cymais repository is stored on the host
host_cymais_volume_dir_relative: "volumes/cymais/" # Place where the cymais repository is stored on the host
host_sphinx_source_dir_relative: "volumes/source/" # Place where the sphinx source repository is stored on the host
host_sphinx_source_dir_absolute: "{{docker_compose.directories.instance}}{{host_sphinx_source_dir_relative}}" # Place where the sphinx source repository is stored on the host
docker_app_dir: "/app/" # Folder in which the application is running
docker_source_dir: "{{docker_app_dir}}" # Folder which is used to be screened
docker_output_dir: "/docs/" # Folder to which the output is fuuuucking putted!
docker_sphinx_dir: "{{docker_app_dir}}/sphinx/" # Folder which contains the sphinxs makefile and logic
docker_exec_dir: "{{docker_app_dir}}{{applications.sphinx.sphinx_exec_dir_relative}}" # Folder which contains the sphinxs makefile and logic
sphinx_docker_file: "{{ docker_compose.directories.instance }}/Dockerfile"
sphinx_docker_file: "{{ docker_compose.directories.instance }}Dockerfile" # Path to the Dockerfile to build sphinx

View File

@ -1,4 +1,5 @@
# Application Glosar
Application Glosar
===================
.. toctree::
:maxdepth: 1

View File

@ -605,7 +605,21 @@ html[native-dark-active] my-app button, button {
--dropdown-item-hover-bg: var(--color-05); /* Hover background: very dark */
--dropdown-item-hover-color: var(--color-60); /* Hover text: a bit lighter */
--dropdown-item-color: var(--color-70); /* Regular dropdown item text */
--dropdown-item-active-color: var(--color-99);/* Active state: very light (white) */
--dropdown-item-active-color: var(--color-99); /* Active state: very light (white) */
}
/** Sphinx **/
.bg-background\/95 {
background-color: var(--color-96);
}
.border-border {
border-color: var(--color-85);
}
{# Hide Toogle Button #}
nav.flex.items-center.space-x-1{
display:none;
}
/** Taiga **/

View File

@ -2,19 +2,19 @@
#
# You can set these variables from the command line, and also
# from the environment for the first two.
# from the environment
SPHINXOPTS ?= -c .
SPHINXBUILD ?= sphinx-build
SOURCE_DIR = ../
BUILD_DIR = ../docs
SPHINX_SOURCE_DIR ?= ../
SPHINX_BUILD_DIR ?= ../docs
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCE_DIR)" "$(BUILD_DIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M help "$(SPHINX_SOURCE_DIR)" "$(SPHINX_BUILD_DIR)" $(SPHINXOPTS) $(O)
.PHONY: help install Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCE_DIR)" "$(BUILD_DIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SPHINX_SOURCE_DIR)" "$(SPHINX_BUILD_DIR)" $(SPHINXOPTS) $(O)

View File

@ -1,25 +1,19 @@
{% macro render_headings(headings) %}
<ul>
{% for item in headings %}
<li>
<a href="{{ pathto(item.link).replace("#", "") + '#' + item.anchor }}">{{ item.text }}</a>
{% if item.children %}
{{ render_headings(item.children) }}
{% endif %}
</li>
{% endfor %}
</ul>
{% endmacro %}
{% if local_md_headings %}
<div class="local-md-headings">
<h3>Page Headings</h3>
{% set ns = namespace(current_level=0) %}
{% for item in local_md_headings %}
{# If the current heading level is greater than the previous, open new <ul> tags #}
{% if item.level > ns.current_level %}
{% for i in range(ns.current_level, item.level) %}
<ul>
{% endfor %}
{# If the current heading level is less than the previous, close the open <ul> tags #}
{% elif item.level < ns.current_level %}
{% for i in range(item.level, ns.current_level) %}
</ul>
{% endfor %}
{% endif %}
<li><a href="{{ pathto(item.link).replace("#","") + "#" + item.anchor}}">{{ item.text }}</a></li>
{% set ns.current_level = item.level %}
{% endfor %}
{# Close any remaining open <ul> tags #}
{% for i in range(ns.current_level) %}
</ul>
{% endfor %}
<h3>Overview</h3>
{{ render_headings(local_md_headings) }}
</div>
{% endif %}

View File

@ -25,25 +25,25 @@ exclude_patterns = ['docs', 'venv', 'venv/**']
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'alabaster'
html_theme = 'sphinxawesome_theme'
html_static_path = ['_static']
html_sidebars = {
'**': [
'globaltoc.html',
'relations.html',
'sourcelink.html',
#'globaltoc.html',
# 'relations.html',
# 'sourcelink.html',
'local_md_files.html', # Include your custom template
'searchbox.html',
# 'searchbox.html',
]
}
html_theme_options = {
'fixed_sidebar': True,
# 'fixed_sidebar': True,
"show_prev_next": False,
}
# Liste der Dateiendungen, die Sphinx verarbeiten soll:
source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown',
@ -59,10 +59,8 @@ extensions = [
]
autosummary_generate = True
# Optional: Zusätzliche MyST-Konfigurationen
myst_enable_extensions = [
"colon_fence", # Für erweiterte Syntax wie ::: Hinweisboxen etc.
# weitere Erweiterungen nach Bedarf
"colon_fence",
]
def setup(app):

View File

@ -4,8 +4,9 @@ from sphinx.util import logging
logger = logging.getLogger(__name__)
# Set the maximum heading level to include (e.g., include headings up to H3)
# Set the maximum heading level for Markdown headings
MAX_HEADING_LEVEL = 3
DEFAULT_MAX_NAV_DEPTH = 2 # Default maximum navigation depth; configurable via conf.py
def natural_sort_key(text):
"""
@ -16,30 +17,38 @@ def natural_sort_key(text):
def extract_headings_from_file(filepath, max_level=MAX_HEADING_LEVEL):
"""
Extract Markdown headings (up to max_level) from the file at filepath.
Skips fenced code blocks.
Extract headings from a file.
For Markdown files, look for lines starting with '#' (up to max_level).
For reStructuredText files, look for a line immediately followed by an underline made of punctuation.
"""
headings = []
ext = os.path.splitext(filepath)[1].lower()
try:
with open(filepath, 'r', encoding='utf-8') as f:
if ext == '.md':
in_code_block = False
for line in f:
# Toggle code block state if a line starts with ```
if line.strip().startswith("```"):
in_code_block = not in_code_block
continue
if in_code_block:
continue
# Match Markdown headings: one or more '#' followed by a space and the title.
match = re.match(r'^(#{1,})\s+(.*)$', line)
if match:
level = len(match.group(1))
if level <= max_level:
heading_text = match.group(2).strip()
# Create a simple slug for the anchor:
# - convert to lowercase
# - replace spaces with hyphens
# - remove non-alphanumeric characters (except hyphens)
anchor = re.sub(r'\s+', '-', heading_text.lower())
anchor = re.sub(r'[^a-z0-9\-]', '', anchor)
headings.append({'level': level, 'text': heading_text, 'anchor': anchor})
elif ext == '.rst':
lines = f.readlines()
for i in range(len(lines)-1):
text_line = lines[i].rstrip("\n")
underline = lines[i+1].rstrip("\n")
if len(underline) >= 3 and re.fullmatch(r'[-=~\^\+"\'`]+', underline):
level = 1 # default level; adjust if needed
heading_text = text_line.strip()
anchor = re.sub(r'\s+', '-', heading_text.lower())
anchor = re.sub(r'[^a-z0-9\-]', '', anchor)
headings.append({'level': level, 'text': heading_text, 'anchor': anchor})
@ -47,14 +56,72 @@ def extract_headings_from_file(filepath, max_level=MAX_HEADING_LEVEL):
logger.warning(f"Error reading {filepath}: {e}")
return headings
def group_headings(headings):
"""
Converts a flat list of headings into a tree structure based on their level.
Each heading gets a 'children' list.
"""
tree = []
stack = []
for heading in headings:
heading['children'] = []
while stack and stack[-1]['level'] >= heading['level']:
stack.pop()
if stack:
stack[-1]['children'].append(heading)
else:
tree.append(heading)
stack.append(heading)
return tree
def sort_tree(tree):
"""
Sorts a list of headings (and their children) first by their 'priority' (default 1)
and then by the natural sort key of their text.
"""
tree.sort(key=lambda x: (x.get('priority', 1), natural_sort_key(x['text'])))
def collect_nav_items(dir_path, base_url, current_depth, max_depth):
"""
Recursively collects navigation items from subdirectories.
For each subdirectory, if an 'index.rst' exists (preferred) or a 'readme.md' exists,
the first heading from that file is used as the title.
"""
nav_items = []
# Look for candidate file in this subdirectory (prefer index.rst, then readme.md)
candidate = None
for cand in ['index.rst', 'readme.md']:
candidate_path = os.path.join(dir_path, cand)
if os.path.isfile(candidate_path):
candidate = cand
break
if candidate:
candidate_path = os.path.join(dir_path, candidate)
headings = extract_headings_from_file(candidate_path)
if headings:
title = headings[0]['text']
else:
title = os.path.splitext(candidate)[0].capitalize()
# Build link relative to base_url
link = os.path.join(base_url, os.path.splitext(candidate)[0])
nav_items.append({
'level': 1,
'text': title,
'link': link,
'anchor': '',
'priority': 0
})
# Recurse into subdirectories if within max_depth
if current_depth < max_depth:
for item in os.listdir(dir_path):
full_path = os.path.join(dir_path, item)
if os.path.isdir(full_path):
sub_base_url = os.path.join(base_url, item)
nav_items.extend(collect_nav_items(full_path, sub_base_url, current_depth + 1, max_depth))
return nav_items
def add_local_md_headings(app, pagename, templatename, context, doctree):
"""
For every Markdown file in the same directory as the current page,
extract its headings, sort them in natural ascending order, and add them
to the context.
"""
srcdir = app.srcdir
# Determine the directory of the current page (e.g., "directory/file" -> "directory")
directory = os.path.dirname(pagename)
abs_dir = os.path.join(srcdir, directory)
if not os.path.isdir(abs_dir):
@ -62,24 +129,49 @@ def add_local_md_headings(app, pagename, templatename, context, doctree):
context['local_md_headings'] = []
return
max_nav_depth = getattr(app.config, 'local_nav_max_depth', DEFAULT_MAX_NAV_DEPTH)
# Collect navigation items from subdirectories only
nav_items = []
for item in os.listdir(abs_dir):
full_path = os.path.join(abs_dir, item)
if os.path.isdir(full_path):
nav_items.extend(collect_nav_items(full_path, os.path.join(directory, item), current_depth=1, max_depth=max_nav_depth))
# Process files in the current directory.
files = os.listdir(abs_dir)
files_lower = [f.lower() for f in files]
# If both index.rst and readme.md exist in the current directory, keep only index.rst.
if "index.rst" in files_lower:
files = [f for f in files if f.lower() != "readme.md"]
local_md_headings = []
for file in os.listdir(abs_dir):
if file.endswith('.md'):
for file in files:
if file.endswith('.md') or file.endswith('.rst'):
filepath = os.path.join(abs_dir, file)
headings = extract_headings_from_file(filepath)
basename, _ = os.path.splitext(file)
# Set priority: index/readme files get priority 0.
if basename.lower() in ['index', 'readme']:
priority = 0
else:
priority = 1
for heading in headings:
# Build file link: zunächst Pfad + Dateiname, dann Ersetzen der .md-Endung durch .html
file_link = os.path.join(directory, file).replace(".md","") if directory else file
file_link = os.path.join(directory, basename)
local_md_headings.append({
'level': heading['level'],
'text': heading['text'],
'link': file_link,
'anchor': heading['anchor']
'anchor': heading['anchor'],
'priority': priority
})
# Sort headings in natural ascending order using natural_sort_key.
local_md_headings.sort(key=lambda x: natural_sort_key(x['text']))
context['local_md_headings'] = local_md_headings
# Combine current directory items with subdirectory nav items.
# If an index or readme from the current directory exists, it will be included only once.
all_items = local_md_headings + nav_items
tree = group_headings(all_items)
sort_tree(tree)
context['local_md_headings'] = tree
def setup(app):
app.add_config_value('local_nav_max_depth', DEFAULT_MAX_NAV_DEPTH, 'env')
app.connect('html-page-context', add_local_md_headings)
return {'version': '0.1', 'parallel_read_safe': True}

View File

@ -1,3 +1,3 @@
myst-parser
sphinx
sphinx-rtd-theme
sphinxawesome-theme