mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Huge role refactoring/cleanup. Other commits will propably follow. Because some bugs will exist. Still important for longrun and also for auto docs/help/slideshow generation
This commit is contained in:
39
roles/web-app-sphinx/README.md
Normal file
39
roles/web-app-sphinx/README.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Sphinx
|
||||
|
||||
## Description
|
||||
|
||||
Sphinx is a powerful documentation generator originally created for Python projects and now widely used to build and maintain comprehensive documentation for all kinds of software projects. This role automates the process of building and deploying Sphinx documentation using Docker, ensuring reproducible builds and seamless updates.
|
||||
|
||||
## 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. By default it uses [CyMaIS Sphinx](https://github.com/kevinveenbirkenbach/cymais-sphinx) to build the docs.
|
||||
|
||||
## Purpose
|
||||
|
||||
By automating the Sphinx build process and containerized deployment, this role minimizes manual intervention and helps you ensure that your documentation is always up-to-date with the latest changes in your codebase. It is ideal for continuous integration environments and for projects that require frequent documentation updates.
|
||||
|
||||
## Features
|
||||
|
||||
- **Automated Sphinx Build:**
|
||||
The role automatically triggers a Sphinx build using a Makefile. This build process compiles source files into clean, navigable HTML documentation.
|
||||
|
||||
- **Dynamic and Reproducible Builds:**
|
||||
Source code is dynamically pulled from your repository before each build. This ensures that every documentation update accurately reflects the latest version of your project.
|
||||
|
||||
- **Docker Compose Integration:**
|
||||
By harnessing Docker Compose, the role deploys the Sphinx build and serving process in an isolated, reproducible container environment, which simplifies the setup and improves portability.
|
||||
|
||||
- **Customizable Configuration:**
|
||||
Variables allow you to define source and output directories, build parameters, and other settings. This flexibility enables you to tailor the documentation build process to your project’s specific needs.
|
||||
|
||||
- **Reliable Serving of Documentation:**
|
||||
Once the build is complete, the generated HTML is served through a lightweight HTTP server. Health checks are in place to ensure the service is running reliably.
|
||||
|
||||
- **Consistent Deployment Workflow:**
|
||||
The entire process—from pulling the repository to serving the final output—is automated. This reduces human error and makes it easy to update or roll back documentation builds.
|
||||
|
||||
## Further Resources
|
||||
|
||||
For more information about Sphinx and its capabilities, please visit the [Sphinx Official Website](https://www.sphinx-doc.org/).
|
||||
|
||||
For detailed Sphinx documentation, see the [Sphinx Documentation](https://www.sphinx-doc.org/en/master/).
|
29
roles/web-app-sphinx/meta/main.yml
Normal file
29
roles/web-app-sphinx/meta/main.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: "Marko Pjevac, Kevin Veen-Birkenbach"
|
||||
description: "Automates building and serving Sphinx documentation. Unlock comprehensive insights with our extensive documentation. Explore guides, tutorials, and support resources designed to help you navigate software effortlessly."
|
||||
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: Docker
|
||||
versions:
|
||||
- all
|
||||
- name: Linux
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags:
|
||||
- documentation
|
||||
- sphinx
|
||||
- docker
|
||||
- automation
|
||||
- deployment
|
||||
repository: "https://s.veen.world/cymais"
|
||||
issue_tracker_url: "https://s.veen.world/cymaisissues"
|
||||
documentation: "https://s.veen.world/cymais"
|
||||
logo:
|
||||
class: "fa-solid fa-book"
|
28
roles/web-app-sphinx/tasks/main.yml
Normal file
28
roles/web-app-sphinx/tasks/main.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
# Docker Routines
|
||||
- name: "pkgmgr install"
|
||||
include_role:
|
||||
name: pkgmgr-install
|
||||
vars:
|
||||
package_name: cymais-sphinx
|
||||
# package_notify: docker compose up
|
||||
|
||||
- name: Get path of cymais-sphinx using pkgmgr
|
||||
command: pkgmgr path cymais-sphinx
|
||||
register: path_cymais_sphinx_output
|
||||
|
||||
- name: "include docker-compose role"
|
||||
include_role:
|
||||
name: docker-compose
|
||||
|
||||
- name: "include role webserver-proxy-domain for {{application_id}}"
|
||||
include_role:
|
||||
name: webserver-proxy-domain
|
||||
vars:
|
||||
domain: "{{ domains | get_domain(application_id) }}"
|
||||
http_port: "{{ ports.localhost.http[application_id] }}"
|
||||
|
||||
# Hack because it wasn't possible to fix an handler bug in pkgmgr install
|
||||
- name: „Trigger“ docker compose up
|
||||
command: /bin/true
|
||||
notify: docker compose up
|
13
roles/web-app-sphinx/templates/docker-compose.yml.j2
Normal file
13
roles/web-app-sphinx/templates/docker-compose.yml.j2
Normal file
@@ -0,0 +1,13 @@
|
||||
{% include 'roles/docker-compose/templates/base.yml.j2' %}
|
||||
application:
|
||||
{% set container_port = 8000 %}
|
||||
build:
|
||||
context: {{ path_cymais_sphinx_output.stdout }}
|
||||
dockerfile: {{ path_cymais_sphinx_output.stdout }}/Dockerfile
|
||||
ports:
|
||||
- "127.0.0.1:{{ports.localhost.http[application_id]}}:{{ container_port }}"
|
||||
{% include 'roles/docker-container/templates/healthcheck/curl.yml.j2' %}
|
||||
{% include 'roles/docker-container/templates/base.yml.j2' %}
|
||||
{% include 'roles/docker-container/templates/networks.yml.j2' %}
|
||||
|
||||
{% include 'roles/docker-compose/templates/networks.yml.j2' %}
|
0
roles/web-app-sphinx/templates/env.j2
Normal file
0
roles/web-app-sphinx/templates/env.j2
Normal file
16
roles/web-app-sphinx/vars/configuration.yml
Normal file
16
roles/web-app-sphinx/vars/configuration.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
features:
|
||||
matomo: true
|
||||
css: true
|
||||
portfolio_iframe: true
|
||||
csp:
|
||||
flags:
|
||||
script-src:
|
||||
unsafe-eval: true
|
||||
script-src-elem:
|
||||
unsafe-inline: true
|
||||
unsafe-eval: true
|
||||
style-src:
|
||||
unsafe-inline: true
|
||||
domains:
|
||||
canonical:
|
||||
- "docs.{{ primary_domain }}"
|
1
roles/web-app-sphinx/vars/main.yml
Normal file
1
roles/web-app-sphinx/vars/main.yml
Normal file
@@ -0,0 +1 @@
|
||||
application_id: "sphinx"
|
Reference in New Issue
Block a user