Skip to content

Build a dynamic customizable documentation wizard #3741

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions customize/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public/css/asciidoctor.css
8 changes: 8 additions & 0 deletions customize/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gem 'asciidoctor'
gem 'puma', '~> 6.6'
gem 'rackup', '~> 2.2'
gem 'sinatra', '~> 4.0'
15 changes: 15 additions & 0 deletions customize/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Getting started

First install the dependencies

```sh
bundle install
```

Now run the development server:

```sh
bundle exec ./doc-wizard
```

It will tell you where it listens on.
61 changes: 61 additions & 0 deletions customize/doc-wizard
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env ruby

require 'asciidoctor'
require 'sinatra'

class Guide
def initialize(path, base_dir)
@path = path
@base_dir = base_dir
end

def title
# TODO: rendering depends on build
#document.title
File.basename(@path, '.adoc').gsub('_', ' ').capitalize
end

def document(attributes = {})
raise ArgumentError, 'No build specified' unless attributes.key?('build')

Asciidoctor.load_file(
@path,
safe: :unsafe,
base_dir: @base_dir,
attributes: attributes,
)
end
end

set :guides_base_dir, File.join(__dir__, '..', 'guides')
set :build_flavor, ENV.fetch('BUILD', 'katello')

GUIDES = Dir.glob(File.join(__dir__, 'guides', '*.adoc')).to_h do |path|
[File.basename(path, '.adoc'), Guide.new(path, settings.guides_base_dir)]
end

configure do
stylesheet = File.join(settings.public_folder, 'css', 'asciidoctor.css')
unless File.exist?(stylesheet)
FileUtils.mkdir_p(File.dirname(stylesheet))
File.write(stylesheet, Asciidoctor::Stylesheets.instance.primary_stylesheet_data)
end
end

get '/' do
erb :index, locals: { guides: GUIDES }
end

get '/guide' do
unless (guide = GUIDES[params['guide']])
raise Sinatra::NotFound
end

attributes = %w[ipv6 http-proxy custom-ssl external-db'].to_h do |check|
["answer-#{check}", params[check] == 'on']
end

attributes['build'] = settings.build_flavor

erb(guide.document(attributes).convert)
end
38 changes: 38 additions & 0 deletions customize/guides/installing_server.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
include::common/attributes.adoc[]
include::common/header.adoc[]
:installing-satellite-server-connected:
:context: {project-context}
:mode: connected
:ProductName: {ProjectServer}

= {InstallingServerDocTitle}

include::common/assembly_preparing-environment-for-installation.adoc[leveloffset=+1]

ifdef::answer-ipv6[]
include::common/assembly_preparing-environment-for-installation-in-ipv6-network.adoc[leveloffset=+1]
endif::[]

include::common/assembly_installing-server-connected.adoc[leveloffset=+1]

ifdef::answer-ipv6,answer-http-proxy,answer-custom-ssl,answer-external-db[]
include::common/modules/con_performing-additional-configuration.adoc[leveloffset=+1]

ifdef::answer-ipv6[]
include::common/modules/proc_configuring-for-uefi-http-boot-ipv6-provisioning.adoc[leveloffset=+2]
endif::[]

ifdef::answer-http-proxy[]
include::common/assembly_configuring-satellite-with-an-http-proxy.adoc[leveloffset=+2]
endif::[]

ifdef::katello,orcharhino,satellite[]
ifdef::answer-custom-ssl[]
include::common/assembly_configuring-satellite-custom-server-certificate.adoc[leveloffset=+2]
endif::[]

ifdef::answer-external-db[]
include::common/assembly_using-external-databases.adoc[leveloffset=+2]
endif::[]
endif::[]
endif::[]
29 changes: 29 additions & 0 deletions customize/guides/installing_server_disconnected.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
include::common/attributes.adoc[]
include::common/header.adoc[]
:installing-satellite-server-disconnected:
:context: satellite
:mode: disconnected
:ProductName: {ProjectServer}

= {InstallingServerDisconnectedDocTitle}

include::common/assembly_preparing-environment-for-installation.adoc[leveloffset=+1]

include::common/assembly_installing-satellite-server-disconnected.adoc[leveloffset=+1]

[id="performing-additional-configuration"]
== Performing Additional Configuration on {ProjectServer}

include::common/modules/proc_configuring-server-to-consume-content-from-a-custom-cdn.adoc[leveloffset=+2]

include::common/assembly_configuring-inter-server-synchronization.adoc[leveloffset=+2]

ifdef::katello,orcharhino,satellite[]
ifdef::answer-custom-ssl[]
include::common/assembly_configuring-satellite-custom-server-certificate.adoc[leveloffset=+2]
endif::[]

ifdef::answer-external-db[]
include::common/assembly_using-external-databases.adoc[leveloffset=+2]
endif::[]
endif::[]
2 changes: 2 additions & 0 deletions customize/public/css/patternfly-6.1.0.min.css

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions customize/views/index.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<h1 class="pf-v6-c-content--h1 pf-m-page-title">Installation wizard</h1>

<form action="/guide" method="get" class="pf-v6-c-form">
<div class="pf-v6-c-form__group">
<div class="pf-v6-c-form__group">
<label class="pf-v6-c-form__label" for="guide">
<span class="pf-v6-c-form__label-text">Guide</span>&nbsp;<span class="pf-v6-c-form__label-required" aria-hidden="true">&#42;</span>
</label>
<select name="guide">
<% guides.each do |id, guide| %>
<option value="<%= id %>"><%= guide.title %></option>
<% end %>
</select>
</div>

<div class="pf-v6-c-check">
<input class="pf-v6-c-check__input" type="checkbox" aria-describedby="http-proxy-description" id="http-proxy-input" name="http-proxy" />
<label class="pf-v6-c-check__label" for="http-proxy-input">HTTP proxy</label>
<span class="pf-v6-c-check__description" id="http-proxy-description">
Select if your installation needs to connect through an HTTP proxy to connect to the internet.
</span>
</div>

<div class="pf-v6-c-check">
<input class="pf-v6-c-check__input" type="checkbox" aria-describedby="custom-ssl-description" id="custom-ssl-input" name="custom-ssl" />
<label class="pf-v6-c-check__label" for="custom-ssl-input">Custom SSL certificates</label>
<span class="pf-v6-c-check__description" id="custom-ssl-description">
Select if you will provide the installation with SSL certificates to replace the self signed certificates.
</span>
</div>

<div class="pf-v6-c-check">
<input class="pf-v6-c-check__input" type="checkbox" aria-describedby="external-db-description" id="external-db-input" name="external-db" />
<label class="pf-v6-c-check__label" for="external-db-input">External database</label>
<span class="pf-v6-c-check__description" id="external-db-description">
Select if you connect to an external PostgreSQL database instead of the internally managed instance.
</span>
</div>

<div class="pf-v6-c-check">
<input class="pf-v6-c-check__input" type="checkbox" aria-describedby="ipv6-description" id="ipv6-input" name="ipv6" />
<label class="pf-v6-c-check__label" for="ipv6-input">IPv6</label>
<span class="pf-v6-c-check__description" id="ipv6-description">
Select if your installation is IPv6 enabled.
</span>
</div>

<div class="pf-v6-c-form__group pf-m-action">
<div class="pf-v6-c-form__actions">
<button class="pf-v6-c-button pf-m-primary" type="submit">
<span class="pf-v6-c-button__text">Render</span>
</button>
</div>
</div>
</form>
35 changes: 35 additions & 0 deletions customize/views/layout.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!doctype html>
<html>
<head>
<title>Install wizard</title>
<link rel="stylesheet" href="/css/patternfly-6.1.0.min.css">
<link rel="stylesheet" href="/css/asciidoctor.css">
</head>
<body>
<div class="pf-v6-c-page" id="nav-basic-example">
<header class="pf-v6-c-masthead" id="nav-basic-example-masthead">
<div class="pf-v6-c-masthead__main">
<div class="pf-v6-c-masthead__brand">
<a class="pf-v6-c-masthead__logo" href="/">
Home
</a>
</div>
</div>
</header>
<div class="pf-v6-c-page__main-container" tabindex="-1">
<main
class="pf-v6-c-page__main"
tabindex="-1"
id="main-content-nav-basic-example"
>
<section class="pf-v6-c-page__main-section pf-m-limit-width">
<div class="pf-v6-c-page__main-body">
<%= yield %>
</div>
</section>
</main>
</div>
</div>

</body>
</html>
2 changes: 2 additions & 0 deletions guides/common/assembly_installing-server-connected.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ ifdef::context[:parent-context: {context}]

include::modules/con_installing-server.adoc[]

ifdef::answer-http-proxy[]
ifdef::satellite,katello,orcharhino[]
include::modules/proc_configuring-http-proxy-to-connect-to-cdn.adoc[leveloffset=+1]
endif::[]
endif::[]

ifdef::satellite[]
include::modules/proc_registering-to-red-hat-subscription-management.adoc[leveloffset=+1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ endif::[]
ifdef::parent-context[:context: {parent-context}]
ifndef::parent-context[:!context:]

ifndef::answer-ipv6[]
ifdef::installing-satellite-server-connected[]
include::modules/proc_requirements-for-installation-in-an-ipv4-network.adoc[leveloffset=+1]
endif::[]
endif::[]
2 changes: 2 additions & 0 deletions guides/common/assembly_using-external-databases.adoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
ifndef::answer-external-db[]
include::modules/con_using-external-databases.adoc[]

include::modules/con_configuring-project-server-with-external-database.adoc[leveloffset=+1]

include::modules/con_postgresql-as-an-external-database-considerations.adoc[leveloffset=+1]
endif::[]

include::modules/proc_installing-postgresql.adoc[leveloffset=+1]

Expand Down