From e242de3eec8fda974898e9954beeda8f1bfc28a1 Mon Sep 17 00:00:00 2001 From: juvdiaz Date: Mon, 25 May 2026 19:31:10 -0600 Subject: [PATCH] Add source links to homelab blog --- apps/website/Dockerfile | 7 -- apps/website/blog.php | 132 +++++++++++++++-------- apps/website/cv-theme.js | 1 - apps/website/index.php | 1 - apps/website/lang/en.php | 5 - apps/website/lang/nah.php | 20 +--- apps/website/lang_helper.php | 4 - apps/website/partials/translation_ui.php | 3 - apps/website/save_lang.php | 6 -- apps/website/styles.css | 39 +++++-- apps/website/translation.js | 30 +----- 11 files changed, 126 insertions(+), 122 deletions(-) diff --git a/apps/website/Dockerfile b/apps/website/Dockerfile index bf85ca4..4ebe838 100644 --- a/apps/website/Dockerfile +++ b/apps/website/Dockerfile @@ -1,6 +1,5 @@ FROM alpine:3.19 -# Install Apache, PHP 8.2, and the SQLite extensions RUN apk update && apk add --no-cache \ apache2 \ php82 \ @@ -11,10 +10,8 @@ RUN apk update && apk add --no-cache \ curl \ shadow -# Symlink php82 to php so scripts run naturally if needed RUN ln -sf /usr/bin/php82 /usr/bin/php -# Alpine keeps Apache site configs here instead of a2enmod RUN sed -i 's/#LoadModule rewrite_module/LoadModule rewrite_module/' /etc/apache2/httpd.conf && \ sed -i 's/#LoadModule headers_module/LoadModule headers_module/' /etc/apache2/httpd.conf && \ sed -i 's/DirectoryIndex index.html/DirectoryIndex index.php index.html/' /etc/apache2/httpd.conf && \ @@ -27,17 +24,14 @@ RUN sed -i 's/#LoadModule rewrite_module/LoadModule rewrite_module/' /etc/apache printf '\nPidFile /tmp/httpd.pid\n' >> /etc/apache2/httpd.conf; \ fi -# Copy files directly into Alpine's default web root COPY . /var/www/localhost/htdocs/ RUN rm -f /var/www/localhost/htdocs/index.html -# Set up the database directory permissions RUN mkdir -p /var/www/localhost/htdocs/db && \ chown -R apache:apache /var/www/localhost/htdocs/db && \ chmod -R 755 /var/www/localhost/htdocs/db -# Match local user permissions for the runtime user (Alpine uses 'apache' instead of 'www-data') RUN usermod -u 1000 apache && \ groupmod -g 1000 apache && \ mkdir -p /run/apache2 /var/log/apache2 /tmp/website-lang && \ @@ -49,5 +43,4 @@ USER apache EXPOSE 8080 -# Start Apache in the foreground CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"] diff --git a/apps/website/blog.php b/apps/website/blog.php index a60d639..de439ab 100644 --- a/apps/website/blog.php +++ b/apps/website/blog.php @@ -28,7 +28,86 @@ $todoKeys = [ 'blog_todo_12', ]; +$stackKeys = [ + 'blog_stack_1', + 'blog_stack_2', + 'blog_stack_3', + 'blog_stack_4', + 'blog_stack_5', + 'blog_stack_6', + 'blog_stack_7', + 'blog_stack_8', + 'blog_stack_9', + 'blog_stack_10', + 'blog_stack_11', +]; + $treeHref = 'homelab-tree.php?lang=' . urlencode($lang); +$giteaSourceBase = 'https://lab2025.duckdns.org/git/jv/my-homelab-configs/src/branch/main/'; +$stackSourceLinks = [ + 'blog_stack_1' => [ + ['label' => 'lab.sh', 'path' => 'lab.sh'], + ['label' => 'cluster/main.tf', 'path' => 'bootstrap/cluster/main.tf'], + ], + 'blog_stack_2' => [ + ['label' => 'cluster/main.tf', 'path' => 'bootstrap/cluster/main.tf'], + ], + 'blog_stack_3' => [ + ['label' => 'lab.sh', 'path' => 'lab.sh'], + ['label' => 'cluster', 'path' => 'bootstrap/cluster/main.tf'], + ['label' => 'platform', 'path' => 'bootstrap/platform/main.tf'], + ['label' => 'apps', 'path' => 'bootstrap/apps/main.tf'], + ['label' => 'edge', 'path' => 'bootstrap/edge/main.tf'], + ], + 'blog_stack_4' => [ + ['label' => 'platform/main.tf', 'path' => 'bootstrap/platform/main.tf'], + ], + 'blog_stack_5' => [ + ['label' => 'apps/main.tf', 'path' => 'bootstrap/apps/main.tf'], + ], + 'blog_stack_6' => [ + ['label' => 'edge/main.tf', 'path' => 'bootstrap/edge/main.tf'], + ['label' => 'nginx template', 'path' => 'bootstrap/edge/templates/default.conf.tftpl'], + ['label' => 'HAProxy template', 'path' => 'bootstrap/edge/templates/haproxy.cfg.tftpl'], + ], + 'blog_stack_7' => [ + ['label' => 'cv-theme.js', 'path' => 'apps/website/cv-theme.js'], + ['label' => 'cv.php', 'path' => 'apps/website/cv.php'], + ['label' => 'styles.css', 'path' => 'apps/website/styles.css'], + ], + 'blog_stack_8' => [ + ['label' => 'media-cruncher.js', 'path' => 'apps/demos-static/public/media-cruncher/media-cruncher.js'], + ['label' => 'media-cruncher page', 'path' => 'apps/demos-static/public/media-cruncher/index.html'], + ], + 'blog_stack_9' => [ + ['label' => 'demo catalog', 'path' => 'apps/demos-static/public/index.html'], + ['label' => 'network-quality.js', 'path' => 'apps/demos-static/public/network-quality/network-quality.js'], + ['label' => 'dev-toolbelt.js', 'path' => 'apps/demos-static/public/dev-toolbelt/dev-toolbelt.js'], + ['label' => 'architecture-simulator.js', 'path' => 'apps/demos-static/public/architecture-simulator/architecture-simulator.js'], + ], + 'blog_stack_10' => [ + ['label' => 'sentiment-sandbox.js', 'path' => 'apps/demos-static/public/sentiment-sandbox/sentiment-sandbox.js'], + ['label' => 'model-drift.js', 'path' => 'apps/demos-static/public/model-drift/model-drift.js'], + ['label' => 'privacy-redactor.js', 'path' => 'apps/demos-static/public/privacy-redactor/privacy-redactor.js'], + ], + 'blog_stack_11' => [ + ['label' => 'demos Dockerfile', 'path' => 'apps/demos-static/Dockerfile'], + ['label' => 'demos web-app.yaml', 'path' => 'apps/demos-static/web-app.yaml'], + ['label' => 'website demos.php', 'path' => 'apps/website/demos.php'], + ], +]; + +function renderStackSourceLinks(string $stackKey, array $sourceLinks, string $sourceBase): void { + if (!isset($sourceLinks[$stackKey])) { + return; + } + echo ''; +} ?> @@ -470,50 +549,15 @@ $treeHref = 'homelab-tree.php?lang=' . urlencode($lang); diff --git a/apps/website/cv-theme.js b/apps/website/cv-theme.js index 63b3593..9d32b8c 100644 --- a/apps/website/cv-theme.js +++ b/apps/website/cv-theme.js @@ -14,7 +14,6 @@ function storeCvTheme(theme) { try { localStorage.setItem(cvThemeStorageKey, theme); } catch (_error) { - // Theme switching should still work when storage is blocked. } } diff --git a/apps/website/index.php b/apps/website/index.php index 7f9834e..8b82315 100644 --- a/apps/website/index.php +++ b/apps/website/index.php @@ -92,7 +92,6 @@