mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 23:08:06 +02:00
Decoupeled Sphinx
This commit is contained in:
@@ -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
|
||||
|
||||
|
@@ -27,4 +27,5 @@ galaxy_info:
|
||||
documentation: "https://s.veen.world/cymais"
|
||||
logo:
|
||||
class: "fa-solid fa-book"
|
||||
dependencies: []
|
||||
dependencies:
|
||||
- package-manager
|
||||
|
@@ -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
|
@@ -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:
|
||||
|
@@ -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
|
27
roles/update-pkgmgr/README.md
Normal file
27
roles/update-pkgmgr/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# Update pkgmgr
|
||||
|
||||
## Description
|
||||
|
||||
This role checks if the [package manager](https://github.com/kevinveenbirkenbach/package-manager) is available on the system. If so, it runs `pkgmgr update --all` to update all repositories managed by the `pkgmgr`.
|
||||
|
||||
## Overview
|
||||
|
||||
This role performs the following tasks:
|
||||
- Checks if the `pkgmgr` command is available.
|
||||
- If available, runs `pkgmgr update --all` to update all repositories.
|
||||
|
||||
## Purpose
|
||||
|
||||
The purpose of this role is to simplify system updates by using the `pkgmgr` package manager to handle all repository updates with a single command.
|
||||
|
||||
## Features
|
||||
|
||||
- **Conditional Execution**: Runs only if the `pkgmgr` command is found on the system.
|
||||
- **Automated Updates**: Automatically runs `pkgmgr update --all` to update all repositories.
|
||||
|
||||
## License
|
||||
|
||||
CyMaIS NonCommercial License (CNCL)
|
||||
[Learn More](https://s.veen.world/cncl)
|
||||
|
||||
|
1
roles/update-pkgmgr/defaults/main.yml
Normal file
1
roles/update-pkgmgr/defaults/main.yml
Normal file
@@ -0,0 +1 @@
|
||||
pkgmgr_command: "pkgmgr"
|
24
roles/update-pkgmgr/meta/main.yml
Normal file
24
roles/update-pkgmgr/meta/main.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birkenbach"
|
||||
description: "Checks if the pkgmgr command is available and runs 'pkgmgr update --all' to update all repositories."
|
||||
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: Linux
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags:
|
||||
- update
|
||||
- package-manager
|
||||
- pkgmgr
|
||||
- system
|
||||
repository: "https://s.veen.world/cymais"
|
||||
issue_tracker_url: "https://s.veen.world/cymaisissues"
|
||||
documentation: "https://s.veen.world/cymais"
|
||||
dependencies: []
|
2
roles/update-pkgmgr/tasks/main.yml
Normal file
2
roles/update-pkgmgr/tasks/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
- name: "Update all repositories with pkgmgr"
|
||||
command: "pkgmgr update --all"
|
@@ -39,4 +39,13 @@
|
||||
- name: "Update with pip"
|
||||
include_role:
|
||||
name: update-pip
|
||||
when: pip_installed.rc == 0
|
||||
|
||||
- name: "Check if pkgmgr command is available"
|
||||
command: "which pkgmgr"
|
||||
register: pkgmgr_available
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Update all repositories using pkgmgr"
|
||||
include_role:
|
||||
name: update-pkgmgr
|
||||
when: pkgmgr_available.rc == 0
|
||||
|
Reference in New Issue
Block a user