From e3ddc43944c6d5f86b8e3f725f1f5d0ce043431f Mon Sep 17 00:00:00 2001
From: Kevin Veen-Birkenbach <kevin@veen.world>
Date: Thu, 10 Apr 2025 00:28:23 +0200
Subject: [PATCH] Implemented presentation

---
 group_vars/all/03_domains.yml                 |  1 +
 group_vars/all/07_applications.yml            | 12 +++++--
 group_vars/all/09_ports.yml                   |  1 +
 group_vars/all/10_networks.yml                |  2 ++
 roles/docker-presentation/README.md           | 32 +++++++++++++++++++
 roles/docker-presentation/meta/main.yml       | 30 +++++++++++++++++
 roles/docker-presentation/tasks/main.yml      | 28 ++++++++++++++++
 .../templates/docker-compose.yml.j2           | 20 ++++++++++++
 roles/docker-presentation/templates/env.j2    |  0
 roles/docker-presentation/vars/main.yml       |  1 +
 tasks/server.yml                              |  5 +++
 11 files changed, 129 insertions(+), 3 deletions(-)
 create mode 100644 roles/docker-presentation/README.md
 create mode 100644 roles/docker-presentation/meta/main.yml
 create mode 100644 roles/docker-presentation/tasks/main.yml
 create mode 100644 roles/docker-presentation/templates/docker-compose.yml.j2
 create mode 100644 roles/docker-presentation/templates/env.j2
 create mode 100644 roles/docker-presentation/vars/main.yml

diff --git a/group_vars/all/03_domains.yml b/group_vars/all/03_domains.yml
index fc7af45c..4ae5c100 100644
--- a/group_vars/all/03_domains.yml
+++ b/group_vars/all/03_domains.yml
@@ -39,6 +39,7 @@ defaults_domains:
   phpmyldap:               "phpmyldap.{{primary_domain}}"
   pixelfed:                "picture.{{primary_domain}}"
   portfolio:               "{{primary_domain}}"
+  presentation:            "slides.{{primary_domain}}"
   roulette-wheel:          "roulette.{{primary_domain}}"
   snipe_it:                "inventory.{{primary_domain}}"
   sphinx:                  "docs.{{primary_domain}}"
diff --git a/group_vars/all/07_applications.yml b/group_vars/all/07_applications.yml
index 8bd62208..58c03a64 100644
--- a/group_vars/all/07_applications.yml
+++ b/group_vars/all/07_applications.yml
@@ -703,6 +703,12 @@ defaults_applications:
     css_enabled:                  "{{css_enabled_default}}"                 # Enables\Disables Global CSS Style
     landingpage_iframe_enabled:   false                                     # Doesn't make sense to load landingpage in landingpage
 
+  ## Presentation
+  presentation:
+    matomo_tracking_enabled:      "{{matomo_tracking_enabled_default}}"     # Enables\Disables Matomo Tracking
+    css_enabled:                  "{{css_enabled_default}}"                 # Enables\Disables Global CSS Style
+    landingpage_iframe_enabled:   False                                     # Makes sense to make the documentary allways in iframe available
+
   # Snipe-IT
   snipe_it:
     version:                      "latest"
@@ -714,9 +720,9 @@ defaults_applications:
 
   ## Sphinx
   sphinx:
-    matomo_tracking_enabled:      "{{matomo_tracking_enabled_default}}"               # Enables\Disables Matomo Tracking
-    css_enabled:                  "{{css_enabled_default}}"                           # Enables\Disables Global CSS Style
-    landingpage_iframe_enabled:   true                                                # Makes sense to make the documentary allways in iframe available
+    matomo_tracking_enabled:      "{{matomo_tracking_enabled_default}}"     # Enables\Disables Matomo Tracking
+    css_enabled:                  "{{css_enabled_default}}"                 # Enables\Disables Global CSS Style
+    landingpage_iframe_enabled:   true                                      # Makes sense to make the documentary allways in iframe available
 
   ## Taiga
   taiga:
diff --git a/group_vars/all/09_ports.yml b/group_vars/all/09_ports.yml
index 9ae18381..2ccae91d 100644
--- a/group_vars/all/09_ports.yml
+++ b/group_vars/all/09_ports.yml
@@ -52,6 +52,7 @@ ports:
       sphinx:           8036
       phpldapadmin:     8037
       fusiondirectory:  8038
+      presentation:     8039
       bigbluebutton:    48087 # This port is predefined by bbb. @todo Try to change this to a 8XXX port
   # Ports which are exposed to the World Wide Web
   public:
diff --git a/group_vars/all/10_networks.yml b/group_vars/all/10_networks.yml
index 9e2e51d3..ff7068d5 100644
--- a/group_vars/all/10_networks.yml
+++ b/group_vars/all/10_networks.yml
@@ -78,6 +78,8 @@ defaults_networks:
       subnet: 192.168.103.16/28
     fusiondirectory:
       subnet: 192.168.103.32/28
+    presentation:
+      subnet: 192.168.103.48/28
       
     # /24 Networks / 254 Usable Clients
     bigbluebutton:
diff --git a/roles/docker-presentation/README.md b/roles/docker-presentation/README.md
new file mode 100644
index 00000000..5ea20040
--- /dev/null
+++ b/roles/docker-presentation/README.md
@@ -0,0 +1,32 @@
+# CyMaIS Presentation 🚀
+
+## Description
+
+This **CyMaIS Presentation** is a powerful tool designed for showcasing the CyMaIS platform to various audiences, including **Administrators**, **Developers**, **End-Users**, **Businesses**, and **Investors**. The presentation leverages **Reveal.js** to create an interactive, engaging, and fully containerized experience that can be easily deployed with Docker.
+
+This role automates the process of setting up and running the CyMaIS presentation in a Docker container, ensuring a reproducible and isolated environment for displaying the content.
+
+## Overview
+
+The **CyMaIS Presentation** role automates the setup of an environment using Docker, providing a seamless process for pulling your source repository, building the presentation, and serving the slides through a lightweight HTTP server. It uses **[Reveal.js](https://revealjs.com/)** for building and serving the presentation slides and can be deployed with **Kevin's Package Manager**.
+
+### Features
+
+- **Fully Automated Setup**: The role handles all tasks, including pulling the source repository, building the Docker image, and serving the presentation through a web server.
+- **Dockerized Environment**: The entire process is contained within Docker, ensuring consistent builds and easy deployment.
+- **Interactive Slides**: The presentation is built with **Reveal.js**, allowing for interactive slides with advanced features like fragments, transitions, and more.
+- **Customizable**: Easily configurable to point to your own source code or documentation.
+
+## Further Resources
+
+For more information about the **CyMaIS Presentation**, check out the GitHub repository: [CyMaIS Presentation](https://github.com/kevinveenbirkenbach/cymais-presentation)
+
+For more about **Reveal.js**, visit: [Reveal.js](https://revealjs.com/)
+
+## License 📄
+
+This project is licensed under the **CyMaIS NonCommercial License (CNCL)** - see the [LICENSE](LICENSE) file for details.
+
+---
+
+For additional details about CyMaIS, visit: [cymais.cloud](https://cymais.cloud)
diff --git a/roles/docker-presentation/meta/main.yml b/roles/docker-presentation/meta/main.yml
new file mode 100644
index 00000000..42d101bc
--- /dev/null
+++ b/roles/docker-presentation/meta/main.yml
@@ -0,0 +1,30 @@
+galaxy_info:
+  author: "Kevin Veen-Birkenbach"
+  description: "Automates the process of presenting CyMaIS using Reveal.js in a containerized environment. Ideal for administrators, developers, end-users, businesses, and investors."
+  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:
+    - presentation
+    - revealjs
+    - docker
+    - automation
+    - deployment
+  repository: "https://github.com/kevinveenbirkenbach/cymais-presentation"
+  issue_tracker_url: "https://s.veen.world/cymaisissues"
+  documentation: "https://s.veen.world/cymais"
+  logo:
+    class: "fa-solid fa-presentation-screen"
+dependencies:
+  - package-manager
\ No newline at end of file
diff --git a/roles/docker-presentation/tasks/main.yml b/roles/docker-presentation/tasks/main.yml
new file mode 100644
index 00000000..f947c4c3
--- /dev/null
+++ b/roles/docker-presentation/tasks/main.yml
@@ -0,0 +1,28 @@
+---
+# Docker Routines
+- name: "include docker-compose role"
+  include_role: 
+    name: docker-compose
+
+- name: install cymais-presentation
+  command:
+    cmd: "pkgmgr install cymais-presentation --clone-mode https"
+  notify: docker compose project build and setup
+
+- name: Get path of cymais-presentation using pkgmgr
+  command: pkgmgr path cymais-presentation
+  register: path_cymais_presentation_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] }}"
+    http_port: 	"{{ ports.localhost.http[application_id] }}"
+
+- name: "copy docker-compose.yml and env file"
+  include_tasks: copy-docker-compose-and-env.yml
\ No newline at end of file
diff --git a/roles/docker-presentation/templates/docker-compose.yml.j2 b/roles/docker-presentation/templates/docker-compose.yml.j2
new file mode 100644
index 00000000..124d3b9e
--- /dev/null
+++ b/roles/docker-presentation/templates/docker-compose.yml.j2
@@ -0,0 +1,20 @@
+services:
+  cymais-presentation:
+    build:
+      context:    {{ path_cymais_presentation_output.stdout }}
+      dockerfile: {{ path_cymais_presentation_output.stdout }}/Dockerfile
+    ports:
+      - "127.0.0.1:{{ports.localhost.http[application_id]}}:5000"
+    healthcheck:
+      test: ["CMD", "curl", "-f", "http://127.0.0.1:5000"]
+      interval: 1m
+      timeout: 10s
+      retries: 3
+    volumes:
+      - {{ path_cymais_presentation_output.stdout }}:/app
+      - {{ path_cymais_output.stdout }}:/source
+{% include 'roles/docker-compose/templates/services/base.yml.j2' %}
+{% include 'templates/docker/container/networks.yml.j2' %}
+
+{% include 'templates/docker/compose/networks.yml.j2' %}
+
diff --git a/roles/docker-presentation/templates/env.j2 b/roles/docker-presentation/templates/env.j2
new file mode 100644
index 00000000..e69de29b
diff --git a/roles/docker-presentation/vars/main.yml b/roles/docker-presentation/vars/main.yml
new file mode 100644
index 00000000..7334a022
--- /dev/null
+++ b/roles/docker-presentation/vars/main.yml
@@ -0,0 +1 @@
+application_id: "presentation"
\ No newline at end of file
diff --git a/tasks/server.yml b/tasks/server.yml
index d7f7db13..b697da79 100644
--- a/tasks/server.yml
+++ b/tasks/server.yml
@@ -211,6 +211,11 @@
   include_role:
     name: docker-pgadmin
 
+- name: setup presentation
+  when: ("presentation" in group_names)
+  include_role:
+    name: docker-presentation
+
 # Native Webserver Roles
 - name: setup nginx-serve-htmls
   when: ("nginx-serve-htmls" in group_names)