fix: BUG-053,055,058,060,061,067,069 - JS minification, meta tags, skip-link, docs footer
All checks were successful
Deploy to Production / Deploy to Server (push) Successful in 1m44s
All checks were successful
Deploy to Production / Deploy to Server (push) Successful in 1m44s
- BUG-053: Add terser JS minification to build process - BUG-060: Add og:image, twitter:card, twitter:image to sub-pages - BUG-067: Update skip-link to #main-content on all pages
This commit is contained in:
parent
e57a45b431
commit
87946a1762
14 changed files with 151 additions and 18 deletions
|
|
@ -113,9 +113,9 @@
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<a href="#main" class="skip-link">Skip to content</a>
|
<a href="#main-content" class="skip-link">Skip to main content</a>
|
||||||
<a href="/" class="back-link">← Back to docfast.dev</a>
|
<a href="/" class="back-link">← Back to docfast.dev</a>
|
||||||
<main id="main">
|
<main id="main-content">
|
||||||
<div id="swagger-ui"></div>
|
<div id="swagger-ui"></div>
|
||||||
</main>
|
</main>
|
||||||
<footer style="padding:24px 0;border-top:1px solid #1e2433;text-align:center;">
|
<footer style="padding:24px 0;border-top:1px solid #1e2433;text-align:center;">
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
<meta property="og:title" content="Impressum — DocFast">
|
<meta property="og:title" content="Impressum — DocFast">
|
||||||
<meta property="og:description" content="Legal notice and company information for DocFast API service.">
|
<meta property="og:description" content="Legal notice and company information for DocFast API service.">
|
||||||
<meta property="og:url" content="https://docfast.dev/impressum">
|
<meta property="og:url" content="https://docfast.dev/impressum">
|
||||||
|
<meta property="og:image" content="https://docfast.dev/og-image.png">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="https://docfast.dev/og-image.png">
|
||||||
<link rel="canonical" href="https://docfast.dev/impressum">
|
<link rel="canonical" href="https://docfast.dev/impressum">
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||||
|
|
@ -55,7 +58,7 @@ footer .container { display: flex; justify-content: space-between; align-items:
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<a href="#main" class="skip-link">Skip to content</a>
|
<a href="#main-content" class="skip-link">Skip to main content</a>
|
||||||
<nav aria-label="Main navigation">
|
<nav aria-label="Main navigation">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a href="/" class="logo">⚡ Doc<span>Fast</span></a>
|
<a href="/" class="logo">⚡ Doc<span>Fast</span></a>
|
||||||
|
|
@ -67,7 +70,7 @@ footer .container { display: flex; justify-content: space-between; align-items:
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<main id="main">
|
<main id="main-content">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Impressum</h1>
|
<h1>Impressum</h1>
|
||||||
<p><em>Legal notice according to § 5 ECG and § 25 MedienG (Austrian law)</em></p>
|
<p><em>Legal notice according to § 5 ECG and § 25 MedienG (Austrian law)</em></p>
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ html, body {
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<a href="#main" class="skip-link">Skip to content</a>
|
<a href="#main-content" class="skip-link">Skip to main content</a>
|
||||||
<nav aria-label="Main navigation">
|
<nav aria-label="Main navigation">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a href="/" class="logo">⚡ Doc<span>Fast</span></a>
|
<a href="/" class="logo">⚡ Doc<span>Fast</span></a>
|
||||||
|
|
@ -301,7 +301,7 @@ html, body {
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<main role="main" id="main">
|
<main role="main" id="main-content">
|
||||||
<section class="hero">
|
<section class="hero">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="badge">🚀 Simple PDF API for Developers</div>
|
<div class="badge">🚀 Simple PDF API for Developers</div>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<a href="#main" class="skip-link">Skip to content</a>
|
<a href="#main-content" class="skip-link">Skip to main content</a>
|
||||||
<nav aria-label="Main navigation">
|
<nav aria-label="Main navigation">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a href="/" class="logo">⚡ Doc<span>Fast</span></a>
|
<a href="/" class="logo">⚡ Doc<span>Fast</span></a>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
<meta property="og:title" content="Privacy Policy — DocFast">
|
<meta property="og:title" content="Privacy Policy — DocFast">
|
||||||
<meta property="og:description" content="Privacy policy for DocFast API service - GDPR compliant data protection information.">
|
<meta property="og:description" content="Privacy policy for DocFast API service - GDPR compliant data protection information.">
|
||||||
<meta property="og:url" content="https://docfast.dev/privacy">
|
<meta property="og:url" content="https://docfast.dev/privacy">
|
||||||
|
<meta property="og:image" content="https://docfast.dev/og-image.png">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="https://docfast.dev/og-image.png">
|
||||||
<link rel="canonical" href="https://docfast.dev/privacy">
|
<link rel="canonical" href="https://docfast.dev/privacy">
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||||
|
|
@ -55,7 +58,7 @@ footer .container { display: flex; justify-content: space-between; align-items:
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<a href="#main" class="skip-link">Skip to content</a>
|
<a href="#main-content" class="skip-link">Skip to main content</a>
|
||||||
<nav aria-label="Main navigation">
|
<nav aria-label="Main navigation">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a href="/" class="logo">⚡ Doc<span>Fast</span></a>
|
<a href="/" class="logo">⚡ Doc<span>Fast</span></a>
|
||||||
|
|
@ -67,7 +70,7 @@ footer .container { display: flex; justify-content: space-between; align-items:
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<main id="main">
|
<main id="main-content">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Privacy Policy</h1>
|
<h1>Privacy Policy</h1>
|
||||||
<p><em>Last updated: February 16, 2026</em></p>
|
<p><em>Last updated: February 16, 2026</em></p>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
<meta property="og:title" content="Impressum — DocFast">
|
<meta property="og:title" content="Impressum — DocFast">
|
||||||
<meta property="og:description" content="Legal notice and company information for DocFast API service.">
|
<meta property="og:description" content="Legal notice and company information for DocFast API service.">
|
||||||
<meta property="og:url" content="https://docfast.dev/impressum">
|
<meta property="og:url" content="https://docfast.dev/impressum">
|
||||||
|
<meta property="og:image" content="https://docfast.dev/og-image.png">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="https://docfast.dev/og-image.png">
|
||||||
<link rel="canonical" href="https://docfast.dev/impressum">
|
<link rel="canonical" href="https://docfast.dev/impressum">
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||||
|
|
@ -17,7 +20,7 @@
|
||||||
|
|
||||||
{{> nav}}
|
{{> nav}}
|
||||||
|
|
||||||
<main id="main">
|
<main id="main-content">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Impressum</h1>
|
<h1>Impressum</h1>
|
||||||
<p><em>Legal notice according to § 5 ECG and § 25 MedienG (Austrian law)</em></p>
|
<p><em>Legal notice according to § 5 ECG and § 25 MedienG (Austrian law)</em></p>
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
{{> nav}}
|
{{> nav}}
|
||||||
|
|
||||||
<main role="main" id="main">
|
<main role="main" id="main-content">
|
||||||
<section class="hero">
|
<section class="hero">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="badge">🚀 Simple PDF API for Developers</div>
|
<div class="badge">🚀 Simple PDF API for Developers</div>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
<meta property="og:title" content="Privacy Policy — DocFast">
|
<meta property="og:title" content="Privacy Policy — DocFast">
|
||||||
<meta property="og:description" content="Privacy policy for DocFast API service - GDPR compliant data protection information.">
|
<meta property="og:description" content="Privacy policy for DocFast API service - GDPR compliant data protection information.">
|
||||||
<meta property="og:url" content="https://docfast.dev/privacy">
|
<meta property="og:url" content="https://docfast.dev/privacy">
|
||||||
|
<meta property="og:image" content="https://docfast.dev/og-image.png">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="https://docfast.dev/og-image.png">
|
||||||
<link rel="canonical" href="https://docfast.dev/privacy">
|
<link rel="canonical" href="https://docfast.dev/privacy">
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||||
|
|
@ -17,7 +20,7 @@
|
||||||
|
|
||||||
{{> nav}}
|
{{> nav}}
|
||||||
|
|
||||||
<main id="main">
|
<main id="main-content">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Privacy Policy</h1>
|
<h1>Privacy Policy</h1>
|
||||||
<p><em>Last updated: February 16, 2026</em></p>
|
<p><em>Last updated: February 16, 2026</em></p>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
<meta property="og:title" content="System Status — DocFast">
|
<meta property="og:title" content="System Status — DocFast">
|
||||||
<meta property="og:description" content="Real-time system status for the DocFast PDF API.">
|
<meta property="og:description" content="Real-time system status for the DocFast PDF API.">
|
||||||
<meta property="og:url" content="https://docfast.dev/status">
|
<meta property="og:url" content="https://docfast.dev/status">
|
||||||
|
<meta property="og:image" content="https://docfast.dev/og-image.png">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="https://docfast.dev/og-image.png">
|
||||||
<link rel="canonical" href="https://docfast.dev/status">
|
<link rel="canonical" href="https://docfast.dev/status">
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||||
|
|
@ -38,7 +41,7 @@
|
||||||
|
|
||||||
{{> nav}}
|
{{> nav}}
|
||||||
|
|
||||||
<main id="main">
|
<main id="main-content">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="status-content" class="status-loading">Loading system status…</div>
|
<div id="status-content" class="status-loading">Loading system status…</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
<meta property="og:title" content="Terms of Service — DocFast">
|
<meta property="og:title" content="Terms of Service — DocFast">
|
||||||
<meta property="og:description" content="Terms of service for DocFast API - legal terms and conditions for using our PDF generation service.">
|
<meta property="og:description" content="Terms of service for DocFast API - legal terms and conditions for using our PDF generation service.">
|
||||||
<meta property="og:url" content="https://docfast.dev/terms">
|
<meta property="og:url" content="https://docfast.dev/terms">
|
||||||
|
<meta property="og:image" content="https://docfast.dev/og-image.png">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="https://docfast.dev/og-image.png">
|
||||||
<link rel="canonical" href="https://docfast.dev/terms">
|
<link rel="canonical" href="https://docfast.dev/terms">
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||||
|
|
@ -17,7 +20,7 @@
|
||||||
|
|
||||||
{{> nav}}
|
{{> nav}}
|
||||||
|
|
||||||
<main id="main">
|
<main id="main-content">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Terms of Service</h1>
|
<h1>Terms of Service</h1>
|
||||||
<p><em>Last updated: February 16, 2026</em></p>
|
<p><em>Last updated: February 16, 2026</em></p>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
<meta property="og:title" content="System Status — DocFast">
|
<meta property="og:title" content="System Status — DocFast">
|
||||||
<meta property="og:description" content="Real-time system status for the DocFast PDF API.">
|
<meta property="og:description" content="Real-time system status for the DocFast PDF API.">
|
||||||
<meta property="og:url" content="https://docfast.dev/status">
|
<meta property="og:url" content="https://docfast.dev/status">
|
||||||
|
<meta property="og:image" content="https://docfast.dev/og-image.png">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="https://docfast.dev/og-image.png">
|
||||||
<link rel="canonical" href="https://docfast.dev/status">
|
<link rel="canonical" href="https://docfast.dev/status">
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||||
|
|
@ -76,7 +79,7 @@ footer .container { display: flex; justify-content: space-between; align-items:
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<a href="#main" class="skip-link">Skip to content</a>
|
<a href="#main-content" class="skip-link">Skip to main content</a>
|
||||||
<nav aria-label="Main navigation">
|
<nav aria-label="Main navigation">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a href="/" class="logo">⚡ Doc<span>Fast</span></a>
|
<a href="/" class="logo">⚡ Doc<span>Fast</span></a>
|
||||||
|
|
@ -88,7 +91,7 @@ footer .container { display: flex; justify-content: space-between; align-items:
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<main id="main">
|
<main id="main-content">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="status-content" class="status-loading">Loading system status…</div>
|
<div id="status-content" class="status-loading">Loading system status…</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
<meta property="og:title" content="Terms of Service — DocFast">
|
<meta property="og:title" content="Terms of Service — DocFast">
|
||||||
<meta property="og:description" content="Terms of service for DocFast API - legal terms and conditions for using our PDF generation service.">
|
<meta property="og:description" content="Terms of service for DocFast API - legal terms and conditions for using our PDF generation service.">
|
||||||
<meta property="og:url" content="https://docfast.dev/terms">
|
<meta property="og:url" content="https://docfast.dev/terms">
|
||||||
|
<meta property="og:image" content="https://docfast.dev/og-image.png">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="https://docfast.dev/og-image.png">
|
||||||
<link rel="canonical" href="https://docfast.dev/terms">
|
<link rel="canonical" href="https://docfast.dev/terms">
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||||
|
|
@ -55,7 +58,7 @@ footer .container { display: flex; justify-content: space-between; align-items:
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<a href="#main" class="skip-link">Skip to content</a>
|
<a href="#main-content" class="skip-link">Skip to main content</a>
|
||||||
<nav aria-label="Main navigation">
|
<nav aria-label="Main navigation">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a href="/" class="logo">⚡ Doc<span>Fast</span></a>
|
<a href="/" class="logo">⚡ Doc<span>Fast</span></a>
|
||||||
|
|
@ -67,7 +70,7 @@ footer .container { display: flex; justify-content: space-between; align-items:
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<main id="main">
|
<main id="main-content">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Terms of Service</h1>
|
<h1>Terms of Service</h1>
|
||||||
<p><em>Last updated: February 16, 2026</em></p>
|
<p><em>Last updated: February 16, 2026</em></p>
|
||||||
|
|
|
||||||
|
|
@ -46,3 +46,19 @@ for (const file of files) {
|
||||||
console.log(` Built: ${file}`);
|
console.log(` Built: ${file}`);
|
||||||
}
|
}
|
||||||
console.log('Done.');
|
console.log('Done.');
|
||||||
|
|
||||||
|
// JS Minification (requires terser)
|
||||||
|
const { execSync } = require("child_process");
|
||||||
|
const jsFiles = [
|
||||||
|
{ src: "public/app.js", out: "public/app.min.js" },
|
||||||
|
{ src: "public/status.js", out: "public/status.min.js" },
|
||||||
|
];
|
||||||
|
console.log("Minifying JS...");
|
||||||
|
for (const { src, out } of jsFiles) {
|
||||||
|
const srcPath = path.join(__dirname, "..", src);
|
||||||
|
const outPath = path.join(__dirname, "..", out);
|
||||||
|
if (fs.existsSync(srcPath)) {
|
||||||
|
execSync(`npx terser ${srcPath} -o ${outPath} -c -m`, { stdio: "inherit" });
|
||||||
|
console.log(` Minified: ${src} → ${out}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
93
scripts/healthcheck-monitor.sh
Executable file
93
scripts/healthcheck-monitor.sh
Executable file
|
|
@ -0,0 +1,93 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Health check monitoring script for DocFast
|
||||||
|
# Runs every 5 minutes via cron
|
||||||
|
|
||||||
|
HEALTH_URL="https://docfast.dev/health"
|
||||||
|
LOG_FILE="/var/log/docfast-healthcheck.log"
|
||||||
|
DOWN_MARKER="/tmp/docfast-down"
|
||||||
|
STATE_FILE="/tmp/docfast-healthcheck-state"
|
||||||
|
MAX_LOG_LINES=1000
|
||||||
|
|
||||||
|
# Initialize state file if it doesn't exist
|
||||||
|
if [ ! -f "$STATE_FILE" ]; then
|
||||||
|
echo "0" > "$STATE_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Function to rotate log if it exceeds max lines
|
||||||
|
rotate_log() {
|
||||||
|
if [ -f "$LOG_FILE" ]; then
|
||||||
|
local line_count=$(wc -l < "$LOG_FILE")
|
||||||
|
if [ "$line_count" -gt "$MAX_LOG_LINES" ]; then
|
||||||
|
# Keep only the last 1000 lines
|
||||||
|
tail -n "$MAX_LOG_LINES" "$LOG_FILE" > "${LOG_FILE}.tmp"
|
||||||
|
mv "${LOG_FILE}.tmp" "$LOG_FILE"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to log messages
|
||||||
|
log_message() {
|
||||||
|
local msg="$1"
|
||||||
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $msg" >> "$LOG_FILE"
|
||||||
|
rotate_log
|
||||||
|
}
|
||||||
|
|
||||||
|
# Perform health check
|
||||||
|
check_health() {
|
||||||
|
response=$(curl -s -w "\n%{http_code}" "$HEALTH_URL" 2>/dev/null)
|
||||||
|
http_code=$(echo "$response" | tail -n1)
|
||||||
|
body=$(echo "$response" | head -n-1)
|
||||||
|
|
||||||
|
# Check if HTTP 200 and contains "status":"ok"
|
||||||
|
if [ "$http_code" = "200" ] && echo "$body" | grep -q '"status":"ok"'; then
|
||||||
|
return 0 # Success
|
||||||
|
else
|
||||||
|
return 1 # Failure
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get current failure count
|
||||||
|
get_failure_count() {
|
||||||
|
cat "$STATE_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Increment failure count
|
||||||
|
increment_failure() {
|
||||||
|
local count=$(get_failure_count)
|
||||||
|
echo $((count + 1)) > "$STATE_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Reset failure count
|
||||||
|
reset_failure() {
|
||||||
|
echo "0" > "$STATE_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main logic
|
||||||
|
if check_health; then
|
||||||
|
# Health check passed
|
||||||
|
failure_count=$(get_failure_count)
|
||||||
|
if [ "$failure_count" -gt 0 ]; then
|
||||||
|
log_message "✓ Service recovered after $failure_count failure(s)"
|
||||||
|
if [ -f "$DOWN_MARKER" ]; then
|
||||||
|
rm -f "$DOWN_MARKER"
|
||||||
|
log_message "Removed downtime marker"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
reset_failure
|
||||||
|
else
|
||||||
|
# Health check failed
|
||||||
|
increment_failure
|
||||||
|
failure_count=$(get_failure_count)
|
||||||
|
log_message "✗ Health check failed (attempt $failure_count)"
|
||||||
|
|
||||||
|
# After 2 consecutive failures, mark as down
|
||||||
|
if [ "$failure_count" -ge 2 ]; then
|
||||||
|
if [ ! -f "$DOWN_MARKER" ]; then
|
||||||
|
touch "$DOWN_MARKER"
|
||||||
|
log_message "⚠ DOWNTIME DETECTED - Marker file created"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
Loading…
Add table
Add a link
Reference in a new issue