Skip to content

Commit

Permalink
Test showroom created
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarvesh Pandit committed Nov 8, 2024
1 parent 8706bb0 commit 9b43d8c
Show file tree
Hide file tree
Showing 25 changed files with 735 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .camel-jbang/camel-jbang-run.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
camel.main.sourceLocationEnabled=true
camel.main.modeline=true
camel.jbang.compileWorkDir=.camel-jbang/compile
camel.jbang.health=false
camel.jbang.metrics=false
camel.jbang.console=false
camel.jbang.verbose=false
camel.jbang.backlogTracing=true
camel.jbang.camel-version=4.4.1
camel.jbang.kameletsVersion=4.4.0
camel.main.routesIncludePattern=file\:/Users/ramyelessawy/.vscode/extensions/redhat.vscode-camelk-0.0.38/resources/simple-java-file/UsedToWarmupDependenciesDownload.java
dependency=mvn\:org.apache.camel\:camel-kamelet\:4.4.1
dependency=mvn\:org.apache.camel\:camel-java-joor-dsl\:4.4.1
dependency=mvn\:org.apache.camel\:camel-endpointdsl\:4.4.1
dependency=mvn\:org.apache.camel\:camel-rest\:4.4.1
dependency=mvn\:org.apache.camel\:camel-core-languages\:4.4.1
dependency=mvn\:org.apache.camel\:camel-timer\:4.4.1
Binary file not shown.
44 changes: 44 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
run: |
mkdir output
docker run --user=$(id -u) --rm -v `pwd`:/showroom/repo --mount 'type=tmpfs,dst=/showroom/repo/.cache' --entrypoint antora -w /showroom/repo ghcr.io/rhpds/showroom-content:latest --to-dir=output default-site.yml
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'output'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
www
node_modules
package-lock.json
gh-pages
.cache
.DS_Store
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"cSpell.words": [
"keycloak",
"Quarkus",
"RHDH",
"RHTAP",
"Sigstore",
"Tekton"
],
"asciidoc.antora.enableAntoraSupport": true
}
109 changes: 109 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
=== Getting Started

This template is designed to be used as a base for your showroom lab guides.

The content is built using Antora, a static site generator for creating documentation sites from AsciiDoc documents.

This git repo template was created to make it easy for you to start developing your lab instructions.

Features:

. 0% cruft
. Red Hat Demo Platform UI Bundle default
. Dev Mode extension that displays the asciidoc attributes you have to work with
. Content is generated using Antora, a static site generator for creating documentation sites from AsciiDoc documents.

== Getting Started

=== Using Containers (Recommended)

In order to test and develop on your local machine, you can use a specially built container with Podman or Docker as follows.

. Create a git repo from this template
.. Suggested naming: `showroom_<lab-name>`
. Clone your new repo and `cd` into it
. When you make changes to the content, all you need is to kill the container and run it again.
+
[source,sh]
----
podman run --rm --name antora -v $PWD:/antora -p 8080:8080 -i -t ghcr.io/juliaaano/antora-viewer
----

For SELinux environments, `:z` may need to be appended to the volume mount:

----
podman run --rm --name antora -v $PWD:/antora:z -p 8080:8080 -i -t ghcr.io/juliaaano/antora-viewer
----

Live-reload is not supported.

=== Using Local Files (Less Recommended)

. Create a git repo from this template
. Clone the repo and `cd` into it
. Run ./utilities/lab-serve
. Open http://localhost:8080 in your browser
. Run ./utilities/lab-build to build your html

To rebuild your html, run `./utilites/build`.

== Editing Files

Now you are ready to go!
You can start editing the files in the `content/modules/ROOT/pages/` directory.

Many modern editors such as Visual Studio Code offer live Asciidoc Preview extensions.

=== Understanding the Basic Template Directory Structure

[source,sh]
----
./content/modules/ROOT/
├── assets
│ └── images # Images used in your content
│ └── example-image.png
├── examples # You can add downloadable assets here
│ └── example-bash-script.sh # e.g. an example bash script
├── nav.adoc # Navigation for your lab
├── pages # Your content goes here
│ ├── index.adoc # First page of your lab, e.g. overview etc
│ ├── module-01.adoc
│ └── module-02.adoc # Sample lab has 2 modules including index.adoc
└── partials # You can add partials here, reusable content inserted inline into your modules
└── example_partial.adoc
----

== Adding Additional Links

You can add links to external content in the convenient "Links" drop-down on the upper-right of the Showroom Summit 2024 UI.

../content/antora.yml
[source,yaml]
----
asciidoc:
attributes:
page-links:
- url: https://redhat.com
text: Red Hat
----

image::ui-links.png[]

== Dev Mode

As a convenience to developers, the Dev Mode Extention (disabled by default) displays the asciidoc attributes you have to work with while writing your lab instructions.

. Disable/Enable Dev Mode by changing `enabled: true` or `enabled: false`
+
.default-site.yml
[source,yaml]
----
extensions:
- id: dev-mode
require: ./content/lib/dev-mode.js
enabled: false
----

. Produces
+
image::dev-mode.png[]
1 change: 0 additions & 1 deletion README.md

This file was deleted.

21 changes: 21 additions & 0 deletions content/antora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: modules
version: master
nav:
- modules/ROOT/nav.adoc


asciidoc:
attributes:
release-version: master
page-pagination: true
experimental:
numbered:
lab_name: "TAP Workshop"
guid: my-guid
ssh_user: devops
ssh_password: devops
ssh_command: ssh devops@bastion.{guid}.example.opentlc.com

extensions:
- ./content/lib/tab-block.js
- ./content/lib/remote-include-processor.js
11 changes: 11 additions & 0 deletions content/lib/remote-include-processor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = function () {
this.includeProcessor(function () {
this.$option('position', '>>')
this.handles((target) => target.startsWith('http'))
this.process((doc, reader, target, attrs) => {
const contents = require('child_process').execFileSync('curl', ['--silent', '-L', target], { encoding: 'utf8' })
reader.pushInclude(contents, target, target, 1, attrs)
})
})
}

99 changes: 99 additions & 0 deletions content/lib/tab-block.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/* Copyright (c) 2018 OpenDevise, Inc.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
* Extends the AsciiDoc syntax to support a tabset. The tabset is created from
* a dlist enclosed in an example block that is marked with the tabs style.
*
* Usage:
*
* [tabs]
* ====
* Tab A::
* +
* --
* Contents of tab A.
* --
* Tab B::
* +
* --
* Contents of tab B.
* --
* ====
*
* @author Dan Allen <[email protected]>
*/
const IdSeparatorCh = "-";
const ExtraIdSeparatorsRx = /^-+|-+$|-(-)+/g;
const InvalidIdCharsRx = /[^a-zA-Z0-9_]/g;
const List = Opal.const_get_local(Opal.module(null, "Asciidoctor"), "List");
const ListItem = Opal.const_get_local(
Opal.module(null, "Asciidoctor"),
"ListItem"
);

const generateId = (str, idx) =>
`tabset${idx}_${str
.toLowerCase()
.replace(InvalidIdCharsRx, IdSeparatorCh)
.replace(ExtraIdSeparatorsRx, "$1")}`;

function tabsBlock() {
this.onContext("example");
this.process((parent, reader, attrs) => {
const createHtmlFragment = html => this.createBlock(parent, "pass", html);
const tabsetIdx = parent.getDocument().counter("idx-tabset");
const nodes = [];
nodes.push(createHtmlFragment('<div class="tabset is-loading">'));
const container = this.parseContent(
this.createBlock(parent, "open"),
reader
);
const sourceTabs = container.getBlocks()[0];
if (
!(
sourceTabs &&
sourceTabs.getContext() === "dlist" &&
sourceTabs.getItems().length
)
)
return;
const tabs = List.$new(parent, "ulist");
tabs.addRole("tabs");
const panes = {};
sourceTabs.getItems().forEach(([[title], details]) => {
const tab = ListItem.$new(tabs);
tabs.$append(tab);
const id = generateId(title.getText(), tabsetIdx);
tab.text = `[[${id}]]${title.text}`;
let blocks = details.getBlocks();
const numBlocks = blocks.length;
if (numBlocks) {
if (blocks[0].context === "open" && numBlocks === 1)
blocks = blocks[0].getBlocks();
panes[id] = blocks.map(block => (block.parent = parent) && block);
}
});
nodes.push(tabs);
nodes.push(createHtmlFragment('<div class="content">'));
Object.entries(panes).forEach(([id, blocks]) => {
nodes.push(
createHtmlFragment(`<div class="tab-pane" aria-labelledby="${id}">`)
);
nodes.push(...blocks);
nodes.push(createHtmlFragment("</div>"));
});
nodes.push(createHtmlFragment("</div>"));
nodes.push(createHtmlFragment("</div>"));
parent.blocks.push(...nodes);
});
}

function register(registry, context) {
registry.block("tabs", tabsBlock);
}

module.exports.register = register;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions content/modules/ROOT/examples/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
echo "Hello World"
7 changes: 7 additions & 0 deletions content/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* xref:module-01.adoc[1. RPM Native Container]
** xref:module-01.adoc#repositories[Repositories]
** xref:module-01.adoc#software[Software]
* xref:module-02.adoc[2. GitHub Sourced Container]
** xref:module-02.adoc#prerequisites[Install Prerequisites]
** xref:module-02.adoc#container[Enable Container]
43 changes: 43 additions & 0 deletions content/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
= {lab_name}

The `lab_name` var, known as an asciidoc attribute, above was set in `./content/antora.yml` and can be used to set the lab_name or title of your content.
You are both free to change its value and if you prefer to use a different var name, you can change the value of `lab_name`, for example to `title` in `./content/antora.yml` and then reference it in your content as `\{title}`. +

image::rhel-logo-black.jpg[rhel-logo-black,55%,55%]

== Variables

Other vars can also be set there, such as `ssh_user` and `ssh_password`, and referenced inline in the lab content by using the `\{foo}` syntax.

This is another var, or asciidoc attribute, from `./content/antora.yml` {my_var}

== Writing your lab

Whatever type of content you are writing we'll refer to your *content* as "your lab" in this document.

=== Lab structure

Wether you are writing a lab

* First, we will build a monolithic application already compiled as RPM packages and put it into a container. This will allow us to deploy the application, copy it between machines, and update it separately from the operating system. This process affords us a portable and easily maintained component instead of tightly coupling the application with your operating system maintenance.

* In closing we will build a second container on a different operating system version that makes an application not packaged into RPMs. This will be similar to a web application deployment, positioning the correct files at the right locations. To do this, we will pull a project from GitHub and position the component files within our container image. The purpose of this is to achieve a portable application container that can deploy on several different versions of Red Hat Enterprise Linux. This also provides the benefit of decoupling your application maintenance, which would all happen by building new containers versus operating system maintenance. The container is no longer reliant on the operating system installed on the machine where the application is deployed.

. Now let's examine this cluster a bit more by describing the cluster (the `$GUID` environment variable is already set for you so you can immediately describe your individual cluster):
+
[source,sh,role=execute]
----
podman ps
----
+
.Sample Output
[source,texinfo,subs="attributes"]
----
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2dcfee9e50c4 docker.io/library/httpd:2.4 httpd-foreground 3 hours ago Up 3 hours 0.0.0.0:8080->80/tcp showroom-httpd
----

=== Lab Access

The terminal window to your right is *already* logged into the lab environment as the `{ssh_user}` user via `ssh`.
All steps of this lab are to be completed as the `{ssh_user}` user.
Loading

0 comments on commit 9b43d8c

Please sign in to comment.