Skip to content

Initial implementation of Makefile for docs based on PMM Makefile #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: TDE_REL_17_STABLE
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions contrib/pg_tde/documentation/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Documentation Makefile.

DOCDIR := documentation

ifeq ($(shell basename $(CURDIR)),$(DOCDIR))
DIR := $(CURDIR)
else
DIR := $(CURDIR)/$(DOCDIR)
endif

doc-check-images: ## Check if all images are used in documentation
@$(DIR)/_resources/bin/check-images.sh

doc-remove-images: ## Remove unused images from documentation
@ACTION=remove $(DIR)/_resources/bin/check-images.sh

doc-build: ## Build documentation (used in CI)
# This command is used to build and deploy a preview to onrender.com
# Preview URL: https://pmm-doc.onrender.com

mkdocs build -f $(DIR)/mkdocs.yml

doc-build-pdf: ## Build documentation in PDF format
docker run --rm --platform=linux/amd64 -v $(DIR):/docs -w /build perconalab/pmm-doc-md:latest \
bash -c " \
cp -r /docs/* /build/ && \
git init && \
git config user.email '[email protected]' && \
git add --all && \
git commit -am 'Initial commit' > /dev/null && \
ENABLE_PDF_EXPORT=1 mkdocs build -f mkdocs-pdf.yml && \
cp /build/site/pdf/*.pdf /docs/ \
"

doc-build-image: ## Build perconalab/pmm-doc-md:latest image
# @docker buildx build --platform=linux/amd64 --progress=plain -t perconalab/pmm-doc-md:latest -f documentation/resources/Dockerfile.build .

doc-build-preview: ## Build documentation and preview at http://localhost:8000
docker run --rm -v $(DIR):/docs -e ENABLE_PDF_EXPORT=1 perconalab/pmm-doc-md:latest mkdocs serve -a 127.0.0.1:8001

doc-search-icons: ## Search for icons that can be used in documentation
@open https://squidfunk.github.io/mkdocs-material/reference/icons-emojis/#search
31 changes: 31 additions & 0 deletions contrib/pg_tde/documentation/_resource/bin/check-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

set -o errexit nounset

declare -r doc_dir=$(git rev-parse --show-toplevel)/documentation
declare -r img_dir="${doc_dir}/docs/images"
declare -r exceptions="^PMM.png"
declare -r action="${ACTION:-}"
declare file=""

if [ "$action" != "remove" ]; then
echo "Checking for unused images in documentation..."
echo
else
echo "Removing unused images from documentation..."
echo
fi

for file in $(ls -1 "${img_dir}"); do
if ! grep -r --include "*.md" --include "mkdocs*.yml" -m 1 -q $file "${doc_dir}"; then
if [[ "$file" =~ ${exceptions} ]]; then
continue
fi
if [ "$action" = "remove" ]; then
echo "Removing ${img_dir}/${file} ..."
rm -f "${img_dir}/${file}"
else
echo "${img_dir}/${file}"
fi
fi
done
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions contrib/pg_tde/documentation/_resourcepdf/bin/check-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

set -o errexit nounset

declare -r doc_dir=$(git rev-parse --show-toplevel)/documentation
declare -r img_dir="${doc_dir}/docs/images"
declare -r exceptions="^PMM.png"
declare -r action="${ACTION:-}"
declare file=""

if [ "$action" != "remove" ]; then
echo "Checking for unused images in documentation..."
echo
else
echo "Removing unused images from documentation..."
echo
fi

for file in $(ls -1 "${img_dir}"); do
if ! grep -r --include "*.md" --include "mkdocs*.yml" -m 1 -q $file "${doc_dir}"; then
if [[ "$file" =~ ${exceptions} ]]; then
continue
fi
if [ "$action" = "remove" ]; then
echo "Removing ${img_dir}/${file} ..."
rm -f "${img_dir}/${file}"
else
echo "${img_dir}/${file}"
fi
fi
done
72 changes: 72 additions & 0 deletions contrib/pg_tde/documentation/_resourcepdf/overrides/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{#-
This file was automatically generated - do not edit
-#}
{% extends "base.html" %}

{% block announce %}
This is the <strong>Release Candidate 2 (RC2)</strong> of Percona Transparent Data Encryption (TDE) extension.
<p><strong>It is not recommended for production environments at this stage.</strong></p>
<p>We encourage you to test it and <a href= "https://forums.percona.com/c/postgresql/pg-tde-transparent-data-encryption-tde/82">give your feedback</a>.
This will help us improve the product and make it production-ready faster.</p>
{% endblock %}

{% block scripts %}

{{ super() }}
{% endblock %}

{% block site_nav %}
{% if nav %}
{% if page.meta and page.meta.hide %}
{% set hidden = "hidden" if "navigation" in page.meta.hide %}
{% endif %}
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" {{ hidden }}>
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
{% include "partials/nav.html" %}
<br>
<label class="md-nav__title" for="__drawer">
</label>
</div>
</div>
</div>
{% endif %}
{% if "toc.integrate" not in features %}
{% if page.meta and page.meta.hide %}
{% set hidden = "hidden" if "toc" in page.meta.hide %}
{% endif %}
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" {{ hidden }}>
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
{% include "partials/toc.html" %}
</div>
<div class="md-sidebar__inner">
{% include "partials/banner.html" %}
</div>
</div>
</div>
{% endif %}
<script>
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('phc_7unoI9J6Fm0SMrfDp35xNOpCRTkOAibbffQwdGWbHnL',{api_host:'https://eu.posthog.com'})
</script>

<script>
window.addEventListener('beforeprint', (event) => {
for (const detailEl of document.querySelectorAll('details')) {
if (detailEl.getAttribute('open') == null) {
detailEl.setAttribute('data-was-closed', 'true')
}
detailEl.setAttribute('open', '')
}
})
window.addEventListener('afterprint', (event) => {
for (const detailEl of document.querySelectorAll('details')) {
if (detailEl.getAttribute('data-was-closed') != null) {
detailEl.removeAttribute('data-was-closed')
detailEl.removeAttribute('open')
}
}
})
</script>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div data-banner="data-banner">
<p><svg style="display:block;margin:-1em 0 0.75em" width="78" height="69" viewBox="0 0 78 69" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M56.7281 30.7666C62.6528 26.8938 64.5914 18.9942 61.0059 12.7854C59.2094 9.67113 56.3053 7.44082 52.8311 6.50951C49.6122 5.64535 46.2502 5.99872 43.2912 7.49366L39.251 0.5L30.8648 15.0245L11.4811 48.5937H67.021L56.7281 30.7666ZM51.881 10.0674C54.4064 10.7401 56.5079 12.3616 57.8168 14.6194C60.3895 19.0701 59.053 24.7153 54.8808 27.5665L45.1362 10.6905C47.2355 9.68104 49.6034 9.46087 51.881 10.0674ZM39.251 7.87125L60.6339 44.907H48.1228L32.9927 18.7102L39.2499 7.87235L39.251 7.87125ZM17.8682 44.907L30.8637 22.4035L43.8592 44.907H17.8682Z" fill="url(#paint0_linear_2899_1968)"></path><path style="fill:var(--md-typeset-color)" d="M4.981 64.943H3.157V68.207H.756V57.323H5.217C7.822 57.323 9.397 58.861 9.397 61.086V61.116C9.397 63.635 7.433 64.94 4.984 64.94L4.981 64.943V64.943ZM6.961 61.134C6.961 60.061 6.213 59.485 5.011 59.485H3.154V62.812H5.056C6.258 62.812 6.958 62.096 6.958 61.163V61.134H6.961ZM10.738 68.208V57.323H18.973V59.455H13.124V61.664H18.27V63.796H13.124V66.082H19.051V68.214H10.738V68.208 68.208ZM27.557 68.208 25.218 64.726H23.332V68.208H20.931V57.323H25.921C28.496 57.323 30.039 58.677 30.039 60.915V60.945C30.039 62.702 29.088 63.807 27.7 64.32L30.367 68.207H27.556L27.557 68.208ZM27.605 61.041C27.605 60.016 26.887 59.485 25.719 59.485H23.333V62.61H25.767C26.936 62.61 27.605 61.987 27.605 61.071V61.042 61.041ZM36.922 68.499C33.668 68.499 31.249 65.994 31.249 62.825V62.795C31.249 59.659 33.619 57.091 37.019 57.091 39.105 57.091 40.356 57.783 41.383 58.792L39.834 60.571C38.98 59.798 38.113 59.327 37.004 59.327 35.141 59.327 33.795 60.871 33.795 62.762V62.793C33.795 64.684 35.107 66.257 37.004 66.257 38.268 66.257 39.043 65.753 39.913 64.964L41.462 66.524C40.322 67.738 39.059 68.493 36.925 68.493L36.922 68.499ZM47.885 68.499C44.47 68.499 42.021 65.962 42.021 62.825V62.795C42.021 59.659 44.503 57.091 47.915 57.091 51.327 57.091 53.779 59.628 53.779 62.765V62.795C53.779 65.931 51.297 68.499 47.885 68.499ZM51.237 62.795C51.237 60.904 49.846 59.331 47.885 59.331 45.925 59.331 44.567 60.874 44.567 62.766V62.796C44.567 64.688 45.959 66.261 47.919 66.261 49.879 66.261 51.237 64.717 51.237 62.826V62.795 62.795ZM67.001 68.217 72.374 57.091 77.746 68.218H75.052L72.374 62.681 69.705 68.218H67.001V68.217ZM66.007 57.327V68.5L57.813 61.884V68.199H55.264V57.091L63.458 63.681V57.327H66.007Z"></path><defs><linearGradient id="paint0_linear_2899_1968" x1="18.1513" y1="44.7152" x2="61.4356" y2="20.9786" gradientUnits="userSpaceOnUse"><stop stop-color="#FC3519"></stop><stop offset="1" stop-color="#F0D136"></stop></linearGradient></defs></svg></p>
<p>For help, click the link below to get free database assistance or contact our experts for personalized support.</p>

<div class="actions">

<a href="https://docs.percona.com/pg-stat-monitor/get-help.html" style="color: var(--md-typeset-a-color);">Get help from Percona</a>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{#-
This file was automatically generated - do not edit
-#}
<div class="md-copyright">
<div class="md-copyright__highlight">
<a href='https://percona.com' target='_blank'>Percona LLC and/or its affiliates, </a> &copy; {{ build_date_utc.strftime('%Y') }} — <a href="#" onclick="Osano.cm.showDrawer('osano-cm-dom-info-dialog-open')">Cookie Preferences</a>
</div>
{% if not config.extra.generator == false %}
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
{% endif %}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<!--
Copyright (c) 2016-2024 Martin Donath <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-->

<!-- Determine classes -->
{% set class = "md-header" %}
{% if "navigation.tabs.sticky" in features %}
{% set class = class ~ " md-header--shadow md-header--lifted" %}
{% elif "navigation.tabs" not in features %}
{% set class = class ~ " md-header--shadow" %}
{% endif %}

<!-- Header -->
<header class="{{ class }}" data-md-component="header">

<!-- Super Nav -->
<div class="superNav">
<div class="md-header__inner md-grid">
<a href="https://docs.percona.com/percona-for-postgresql/" title="Percona Documentation home page">
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<mask id="a" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="24" height="24">
<path d="M0 0h24v24H0z"/>
</mask>
<g mask="url(#a)">
<path d="m7.825 13 5.6 5.6L12 20l-8-8 8-8 1.425 1.4-5.6 5.6H20v2H7.825Z"/>
</g>
</svg>
<span>Percona Software for PostgreSQL Documentation</span>
</a>
</div>
</div>

<nav
class="md-header__inner md-grid"
aria-label="{{ lang.t('header') }}"
>

<!-- Link to home -->
<a
href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}"
title="{{ config.site_name | e }}"
class="md-header__button md-logo"
aria-label="{{ config.site_name }}"
data-md-component="logo"
>
{% include "partials/logo.html" %}
</a>

<!-- Button to open drawer -->
<label class="md-header__button md-icon" for="__drawer">
{% set icon = config.theme.icon.menu or "material/menu" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</label>

<!-- Header title -->
<div class="md-header__title">
<div class="md-header__ellipsis">
<a href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}" class="md-header__topic">
<span class="md-ellipsis">
{{ config.site_name }}
</span>
</a>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
{% if page.meta and page.meta.title %}
{{ page.meta.title }}
{% else %}
{{ page.title }}
{% endif %}
</span>
</div>
</div>
</div>

<!-- Color palette toggle -->
{% if config.theme.palette %}
{% if not config.theme.palette is mapping %}
{% include "partials/palette.html" %}
{% endif %}
{% endif %}

<!-- User preference: color palette -->
{% if not config.theme.palette is mapping %}
{% include "partials/javascripts/palette.html" %}
{% endif %}

<!-- Site language selector -->
{% if config.extra.alternate %}
{% include "partials/alternate.html" %}
{% endif %}

<!-- Button to open search modal -->
{% if "material/search" in config.plugins %}
<label class="md-header__button md-icon" for="__search">
{% set icon = config.theme.icon.search or "material/magnify" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</label>

<!-- Search interface -->
{% include "partials/search.html" %}
{% endif %}

<!-- Repository information -->
{% if config.repo_url %}
<div class="md-header__source">
{% include "partials/source.html" %}
</div>
{% endif %}
</nav>

<!-- Navigation tabs (sticky) -->
{% if "navigation.tabs.sticky" in features %}
{% if "navigation.tabs" in features %}
{% include "partials/tabs.html" %}
{% endif %}
{% endif %}
</header>
Loading