Decoupeled Sphinx

This commit is contained in:
2025-04-09 16:56:41 +02:00
parent fc552d1130
commit 36bf5af288
35 changed files with 107 additions and 1215 deletions

View File

@@ -6,7 +6,7 @@ Sphinx is a powerful documentation generator originally created for Python proje
## Overview
This Docker Compose deployment leverages Ansible to automatically pull your source repository, build the documentation using Sphinx, and serve the generated HTML through a lightweight HTTP server. The entire process is containerized, which guarantees a consistent and isolated environment regardless of the host system.
This Docker Compose deployment leverages Ansible to automatically pull your source repository, build the documentation using Sphinx, and serve the generated HTML through a lightweight HTTP server. The entire process is containerized, which guarantees a consistent and isolated environment regardless of the host system. By default it uses [CyMaIS Sphinx](https://github.com/kevinveenbirkenbach/cymais-sphinx) to build the docs.
## Purpose

View File

@@ -27,4 +27,5 @@ galaxy_info:
documentation: "https://s.veen.world/cymais"
logo:
class: "fa-solid fa-book"
dependencies: []
dependencies:
- package-manager

View File

@@ -4,35 +4,49 @@
include_role:
name: docker-compose
- name: "Create {{ host_sphinx_source_dir_absolute }} directory"
file:
path: "{{ host_sphinx_source_dir_absolute }}"
state: directory
mode: '0755'
- name: update cymais for up to date docs
command:
cmd: "pkgmgr update cymais"
- name: "pull the source repository to build the Sphinx documentation from {{ applications.sphinx.repository_sphinx_source }} to {{ host_sphinx_source_dir_absolute }}"
git:
repo: "{{ applications.sphinx.repository_sphinx_source }}"
dest: "{{ host_sphinx_source_dir_absolute }}"
update: yes
clone: yes
notify: docker compose project build and setup
become: true
- name: install cymais-sphinx
command:
cmd: "pkgmgr install cymais-sphinx --clone-mode https"
- name: Get path of cymais-sphinx using pkgmgr
command: pkgmgr path cymais-sphinx
register: path_cymais_sphinx_output
- name: Get path of cymais using pkgmgr
command: pkgmgr path cymais
register: path_cymais_output
- name: "include role nginx-domain-setup for {{application_id}}"
include_role:
name: nginx-domain-setup
vars:
domain: "{{ domains[application_id] }}"
domain: "{{ domains[application_id] }}"
http_port: "{{ ports.localhost.http[application_id] }}"
- name: "create {{ sphinx_host_dockerfile }}"
copy:
src: "{{ sphinx_control_node_dockerfile }}"
dest: "{{ sphinx_host_dockerfile }}"
mode: '770'
- name: "Link {{ path_cymais_sphinx_output.stdout }} to {{ host_sphinx_exec_dir_absolute }}"
file:
src: "{{ path_cymais_sphinx_output.stdout }}"
dest: "{{ host_sphinx_exec_dir_absolute }}"
state: link
force: yes
- name: "Link {{ path_cymais_sphinx_output.stdout }}/Dockerfile to {{ sphinx_host_dockerfile }}"
file:
src: "{{ path_cymais_sphinx_output.stdout }}/Dockerfile"
dest: "{{ sphinx_host_dockerfile }}"
state: link
force: yes
- name: "Link {{ path_cymais_output.stdout }} to {{ host_sphinx_source_dir_absolute }}"
file:
src: "{{ path_cymais_output.stdout }}"
dest: "{{ host_sphinx_source_dir_absolute }}"
state: link
force: yes
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

@@ -4,12 +4,8 @@ services:
context: .
dockerfile: Dockerfile
args:
SPHINX_SOURCE_DIR: {{docker_source_dir}}
SPHINX_OUTPUT_DIR: {{docker_output_dir}}
SPHINX_EXEC_DIR: {{docker_exec_dir}}
SPHINX_DOCKER_EXEC_DIR: {{docker_app_dir}}
SPHINX_SOURCE_DIR_RELATIVE: {{host_sphinx_source_dir_relative}}
DOCKER_PYTHON_VERSION: {{applications[application_id].version}}
SPHINX_HOST_SOURCE_DIR_RELATIVE: {{host_sphinx_source_dir_relative}}/
SPHINX_HOST_EXEC_DIR_RELATIVE: {{host_sphinx_exec_dir_relative}}/
ports:
- "127.0.0.1:{{ports.localhost.http[application_id]}}:8000"
healthcheck:

View File

@@ -1,12 +1,9 @@
application_id: "sphinx"
host_sphinx_source_dir_relative: "volumes/source/" # Place where the sphinx source repository is stored on the host
host_sphinx_source_dir_relative: "services/cymais" # 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: "/output/" # Folder to which the output is fuuuucking putted!
docker_exec_dir: "{{ [ docker_app_dir, applications.sphinx.sphinx_exec_dir_relative ] | path_join }}" # Folder which contains the sphinxs makefile and logic
host_sphinx_exec_dir_relative: "services/cymais-sphinx" # Place where the sphinx source repository is stored on the host
host_sphinx_exec_dir_absolute: "{{docker_compose.directories.instance}}{{host_sphinx_source_dir_relative}}" # Place where the sphinx source repository is stored on the host
sphinx_host_dockerfile: "{{ docker_compose.directories.instance }}Dockerfile" # Path to the Dockerfile to build sphinx on the server
sphinx_control_node_dockerfile: "{{ [ playbook_dir, 'docs/Dockerfile' ] | path_join }}" # Path to the Dockerfile on the control node
sphinx_host_dockerfile: "{{ docker_compose.directories.instance }}Dockerfile" # Path to the Dockerfile to build sphinx on the server