diff --git a/.github/workflows/publish-workshops.yaml b/.github/workflows/publish-workshops.yaml new file mode 100644 index 0000000..806e49b --- /dev/null +++ b/.github/workflows/publish-workshops.yaml @@ -0,0 +1,75 @@ +name: Publish Workshops + +on: + push: + tags: + - "[0-9]+.[0-9]+" + - "[0-9]+.[0-9]+-alpha.[0-9]+" + - "[0-9]+.[0-9]+-beta.[0-9]+" + - "[0-9]+.[0-9]+-rc.[0-9]+" + branches: + - main + - develop + workflow_dispatch: + +jobs: + publish-workshops: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install Carvel tools + shell: bash + run: curl -L https://carvel.dev/install.sh | bash + + - name: Install Educates CLI + shell: bash + run: | + imgpkg pull -i ghcr.io/vmware-tanzu-labs/educates-client-programs:2.7.2 -o /tmp/client-programs + mv /tmp/client-programs/educates-linux-amd64 /usr/local/bin/educates + + - name: Setup repository variables and release details + shell: bash + run: | + REPOSITORY_NAME=${{github.event.repository.name}} + echo "REPOSITORY_NAME=${REPOSITORY_NAME,,}" >>${GITHUB_ENV} + echo "REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV} + echo "REPOSITORY_TAG=${GITHUB_REF##*/}" >>${GITHUB_ENV} + + - name: Publish workshops and create workshop definitions + shell: bash + run: | + for WORKSHOP_DIRECTORY in workshops/*; do + mkdir -p ${{runner.temp}}/${WORKSHOP_DIRECTORY}/resources + educates publish-workshop ${WORKSHOP_DIRECTORY} \ + --export-workshop ${{runner.temp}}/${WORKSHOP_DIRECTORY}/resources/workshop.yaml \ + --image-repository=ghcr.io/${REPOSITORY_OWNER} \ + --workshop-version=${REPOSITORY_TAG} \ + --registry-username=${{github.actor}} \ + --registry-password=${{secrets.GITHUB_TOKEN}} + done + + - name: Generate archives containing the workshop definitions + shell: bash + run: | + ytt -f ${{runner.temp}}/workshops > ${{runner.temp}}/workshops.yaml + (cd ${{runner.temp}}; tar cvfz workshops.tar.gz workshops) + (cd ${{runner.temp}}; zip workshops.zip -r workshops) + + - name: Create the GitHub release for the workshops + id: create_release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + tag_name: ${{env.REPOSITORY_TAG}} + name: ${{env.REPOSITORY_NAME}}:${{env.REPOSITORY_TAG}} + draft: false + prerelease: false + files: | + ${{runner.temp}}/workshops.tar.gz + ${{runner.temp}}/workshops.zip + ${{runner.temp}}/workshops.yaml + resources/trainingportal.yaml diff --git a/README.md b/README.md new file mode 100644 index 0000000..2e2ac0c --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +Authoring Guides +================ + +This repository contains a set of workshops for learning about how to create +workshops for Educates. The workshops are: + +* [Getting Started](workshops/lab-authoring-environment) - Workshop on getting started with workshop authoring. diff --git a/resources/trainingportal.yaml b/resources/trainingportal.yaml new file mode 100644 index 0000000..e69de29 diff --git a/workshops/lab-authoring-environment/README.md b/workshops/lab-authoring-environment/README.md new file mode 100644 index 0000000..3bd963e --- /dev/null +++ b/workshops/lab-authoring-environment/README.md @@ -0,0 +1,5 @@ +# Authoring Environment + +This Educates workshop will teach you about how to install Educates to create +your own authoring environment, use it to host workshops, and how to create your +first workshop. diff --git a/workshops/lab-authoring-environment/resources/workshop.yaml b/workshops/lab-authoring-environment/resources/workshop.yaml new file mode 100644 index 0000000..07b405f --- /dev/null +++ b/workshops/lab-authoring-environment/resources/workshop.yaml @@ -0,0 +1,199 @@ +apiVersion: training.educates.dev/v1beta1 +kind: Workshop +metadata: + name: "lab-authoring-environment" +spec: + title: "Authoring Environment" + description: "A workshop on getting started with workshop authoring." + publish: + image: "$(image_repository)/labs-authoring-guides/lab-authoring-environment-files:$(workshop_version)" + workshop: + files: + - image: + url: "$(image_repository)/labs-authoring-guides/lab-authoring-environment-files:$(workshop_version)" + includePaths: + - /workshop/** + - /exercises/** + - /README.md + packages: + - name: educates + files: + - image: + url: $(oci_image_cache)/educates-client-programs:3.0.0-alpha.12 + path: bin + includePaths: + - educates-linux-$(platform_arch) + session: + namespaces: + budget: x-large + security: + policy: baseline + token: + enabled: false + applications: + terminal: + enabled: true + layout: split + editor: + enabled: true + console: + enabled: false + docker: + enabled: true + socket: + enabled: false + compose: + services: + registry: + image: registry:2.8.3 + ports: + - "0.0.0.0:5001:5000" + registry: + enabled: false + vcluster: + enabled: false + volumes: + - name: admin-credentials-config + secret: + secretName: $(session_name)-kubeconfig + volumeMounts: + - name: admin-credentials-config + mountPath: /opt/kubeconfig + dashboards: + - name: Docs + url: https://docs.educates.dev/ + objects: + - apiVersion: v1 + kind: Secret + metadata: + name: $(session_name)-admin-vcluster-values + namespace: $(workshop_namespace) + stringData: + values.yaml: | + vcluster: + image: rancher/k3s:v1.25.3-k3s1 + syncer: + extraArgs: + - --tls-san=admin-vcluster.$(session_namespace).svc.$(cluster_domain) + - --out-kube-config-server=https://admin-vcluster.$(session_namespace).svc.$(cluster_domain) + mapServices: + fromHost: + - from: $(workshop_namespace)/registry-$(session_name) + to: default/registry + - from: $(workshop_namespace)/localhost-$(session_name) + to: default/loopback + sync: + ingresses: + enabled: true + - apiVersion: kappctrl.k14s.io/v1alpha1 + kind: App + metadata: + name: $(session_name)-admin-vcluster-package + namespace: $(workshop_namespace) + spec: + serviceAccountName: kapp-installer + syncPeriod: 720h + noopDelete: true + fetch: + - helmChart: + name: vcluster + repository: + url: https://charts.loft.sh + template: + - helmTemplate: + name: admin-vcluster + namespace: $(session_namespace) + valuesFrom: + - secretRef: + name: $(session_name)-admin-vcluster-values + - ytt: + inline: + paths: + overlays.yaml: | + #@ load("@ytt:data", "data") + #@ load("@ytt:overlay", "overlay") + #@overlay/match by=overlay.all, expects="1+" + --- + metadata: + #@overlay/match missing_ok=True + ownerReferences: + - apiVersion: training.educates.dev/v1beta1 + kind: WorkshopSession + blockOwnerDeletion: true + controller: true + name: $(session_name) + uid: $(workshop_session_uid) + deploy: + - kapp: + rawOptions: + - --app-changes-max-to-keep=5 + - apiVersion: secrets.educates.dev/v1beta1 + kind: SecretCopier + metadata: + name: $(session_name)-kubeconfig + spec: + rules: + - sourceSecret: + name: vc-admin-vcluster + namespace: $(session_namespace) + targetNamespaces: + nameSelector: + matchNames: + - $(workshop_namespace) + targetSecret: + name: $(session_name)-kubeconfig + - apiVersion: v1 + kind: Service + metadata: + name: registry-$(session_name) + namespace: $(workshop_namespace) + spec: + type: ClusterIP + selector: + deployment: $(session_name) + ports: + - name: registry + port: 80 + protocol: TCP + targetPort: 5001 + - apiVersion: v1 + kind: Service + metadata: + name: localhost-$(session_name) + namespace: $(workshop_namespace) + spec: + type: ClusterIP + selector: + deployment: $(session_name) + ports: + - name: renderer + port: 10081 + protocol: TCP + targetPort: 10081 + environment: + images: + registries: + - content: + - destination: /educates-client-programs + prefix: /vmware-tanzu-labs/educates-client-programs + stripPrefix: true + onDemand: true + urls: + - https://ghcr.io + objects: + - apiVersion: v1 + kind: ServiceAccount + metadata: + name: kapp-installer + - apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRoleBinding + metadata: + name: kapp-installer-$(workshop_namespace) + roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin + subjects: + - kind: ServiceAccount + name: kapp-installer + namespace: $(workshop_namespace) diff --git a/workshops/lab-authoring-environment/workshop/content/00-workshop-overview.md b/workshops/lab-authoring-environment/workshop/content/00-workshop-overview.md new file mode 100644 index 0000000..93f52f8 --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/00-workshop-overview.md @@ -0,0 +1,11 @@ +--- +title: Workshop Overview +--- + +Educates is a system for hosting interactive workshop environments in +Kubernetes, or a local docker environment. It can be used for self paced or +supervised workshops. It can also be useful where you need to package up demos +of applications hosted in Kubernetes. + +In this workshop you will learn the basics of how to install Educates, host +workshops with Educates, and create your own workshops. diff --git a/workshops/lab-authoring-environment/workshop/content/01-kubernetes-cluster.md b/workshops/lab-authoring-environment/workshop/content/01-kubernetes-cluster.md new file mode 100644 index 0000000..439b266 --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/01-kubernetes-cluster.md @@ -0,0 +1,21 @@ +--- +title: Kubernetes Cluster +--- + +The full Educates training platform requires a Kubernetes cluster in which to +run. It is possible to deploy single workshop instances in a local docker +container runtime, however in this workshop we will only be covering deploying +to Kubernetes. + +Any Kubernetes cluster should be able to be used to deploy Educates. This +includes being able to use a local Kind cluster running on your own computer, a +hosted Kubernetes cluster such as EKS (AWS), GKE (GCP) or AKS (Azure), or a +Kubernetes cluster you have installed yourself to an IaaS or your own compute +hardware. + +In this workshop we will be deploying to a Kubernetes virtual cluster created +for you for this workshop session. This virtual cluster is running inside of the +larger Kubernetes cluster that the Educates instance hosting this workshop, is +running. + +In other words, we are using Educates itself to teach you about Educates. diff --git a/workshops/lab-authoring-environment/workshop/content/02-packaging-mechanism.md b/workshops/lab-authoring-environment/workshop/content/02-packaging-mechanism.md new file mode 100644 index 0000000..7a01cac --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/02-packaging-mechanism.md @@ -0,0 +1,30 @@ +--- +title: Packaging Mechanism +--- + +Numerous packaging and installation mechanisms exist for applications to be +deployed to a Kubernetes cluster. Probably the most well known is Helm +templates. For Educates, we use an alternative packaging and installation +mechanism utilizing the [Carvel](https://carvel.dev/) tool set. + +The Carvel tool set consists of a number of different tools which perform tasks +such as vendoring (`vendir`), YAML templating (`ytt`), container image +resolution and pinning (`kbld`), and Kubernetes application deployment (`kapp`). + +Used together these tools provide a very powerful and flexible system for +distributing and installing packages for Kubernetes. + +To install Educates you can use the Carvel command line tools from your +computer, or using Carvel's in cluster `kapp-controller` operator. + +To make it much easier to install Educates to your local computer, but also in a +hosted Kubernetes cluster, Educates provides it's own CLI which bundles up the +functionality of the Carvel tools so you do not need to install them on your +computer to install Educates. + +In the case of installing Educates to your local computer, the CLI is even able +to create a local Kubernetes cluster for you using Kind into which Educates is +then installed. + +In this workshop we will use the CLI to install Educates into the Kubernetes +virtual cluster allocated to your workshop session. diff --git a/workshops/lab-authoring-environment/workshop/content/03-clickable-actions.md b/workshops/lab-authoring-environment/workshop/content/03-clickable-actions.md new file mode 100644 index 0000000..acbc954 --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/03-clickable-actions.md @@ -0,0 +1,36 @@ +--- +title: Clickable Actions +--- + +The name of the CLI for Educates is as one might expect, called `educates`. +Running the CLI with no arguments will yield help on the major top level +commands and command groups. Run the command in the terminal of the workshop +session. + +```terminal:execute +command: educates +``` + +If this is your first experience with Educates you may have typed in the command +manually, this however is not necessary and demonstrates the first bit of magic +that Educates provides to make your workshops simpler for your users to work +though. + +The highlighed section showing the command to be executed is what in Educates we +call a clickable action block. In this case of a command we want you to execute +in the terminal, rather than typing it yourself, you can click on it and it will +be run for your automatically in the appropriate terminal. + +Clickable actions like this in workshop instructions for a training system are +not unique to Educates, however other similar systems only apply them to the +execution of terminal commands or copying text from the instructions. In +Educates we use them for a much broader range of tasks, some of which you will +get to see in this workshop. So whenever you see a clickable action block, +rather than try and work out yourself how you should perform the required task, +just click on it. + +Note that for clickable actions for such things as commands, if you wanted to +copy the command shown rather than execute it, hold down the shift key while +clicking on it and the text shown will be copied to your system paste buffer +rather than executing the command. You can then paste it to the terminal or +into another application if you want to capture the text for later. diff --git a/workshops/lab-authoring-environment/workshop/content/04-package-configuration.md b/workshops/lab-authoring-environment/workshop/content/04-package-configuration.md new file mode 100644 index 0000000..02698ed --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/04-package-configuration.md @@ -0,0 +1,87 @@ +--- +title: Package Configuration +--- + +If you were wishing to install Educates from your own local computer and you did +not already have a Kubernetes cluster available, you could use the `educates +create-cluster` command to create a local Kubernetes cluster using Kind +(Kubernetes in docker). This requires you have the docker runtime installed and +configured appropriately. For this workshop session we will install into the +Kubernetes virtual cluster which as already mentioned has been created for you +for this workshop session. + +To install into an existing Kubernetes cluster the CLI command which needs to be +used is `educates admin cluster install`. Before running this command an +appropriate configuration file needs to be created. + +For installation of Educates into the virtual cluster created for this workshop +session we will use the following configuration. Clicking on the action block +this time should automatically open the editor and create the file for you. + +```editor:append-lines-to-file +file: ~/config.yaml +text: | + # Specify the infrastructure provider hosting the Kubernetes cluster. + + clusterInfrastructure: + provider: vcluster + + # Specify the ingress domain to be used to access the workshops hosted by + # the Educates installation. + + clusterIngress: + domain: {{< param session_name >}}.{{< param ingress_domain >}} + + # Disable the cluster and security policy engines, and skip installing + # Kyverno, as policies are enforced by the Educates installation running + # this workshop session. + + clusterPackages: + kyverno: + enabled: false + + clusterSecurity: + policyEngine: none + + workshopSecurity: + rulesEngine: none +``` + +The two key bits of information that we are supplying here are the type of +infrastructure provider and what domain name should be used to access workshops +hosted by the cluster after Educates has been installed. + +To make it easier to install Educates into a freshly created Kubernetes cluster +a number of opinionated configurations are provided for different infrastructure +providers, such as EKS (AWS), GKE (GCP) and AKS (Azure). In this case we have +set the provider as `vcluster` corresponding to what would be expected for a +virtual cluster created using the +[vCluster](https://github.com/loft-sh/vcluster) package from [Loft +Labs](https://loft.sh/). + +In the case of the opinionated virtual cluster configuration, it makes for +example the assumption that the virtual cluster was preconfigured to delegate +ingress handling to the underlying Kubernetes cluster, and thus the virtual +cluster doesn't itself require an ingress controller to be installed. In the +case of the opinionated configuration for major IaaS providers, they might +instead automatically install and configure the ingress controller as well, and +if appropriate credentials are provided, the DNS provider for that IaaS could +also be automatically configured to point at the ingress router for the cluster +which is installed. + +The aim of the opinionated cluster configurations is thus to take a fresh +Kubernetes cluster and install everything you need to run Educates, as well as +Educates itself. + +For this workshop session running in Educates, we set the ingress domain for +our Educates installation to correspond to the ingress domain allocated for +this workshop session. + +Other configuration we have included above isn't strictly necessary and +everything will work without supplying it, but since we are using Educates to +demonstrate installation of Educates, we don't need to enable the cluster and +workshop security policy engine, nor install Kyverno which is normally used to +implement such policies, as the underlying Educates installation this workshop +session is running in is already enforcing security policies for everything we +are doing. Disabling this will speed up our installation a bit, but for a real +Educates installation you should keep the security policy engines enabled. diff --git a/workshops/lab-authoring-environment/workshop/content/05-package-installation.md b/workshops/lab-authoring-environment/workshop/content/05-package-installation.md new file mode 100644 index 0000000..3d671b0 --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/05-package-installation.md @@ -0,0 +1,32 @@ +--- +title: Package Installation +--- + +With the configuration created we are ready to perform the installation by +running the CLI command: + +```terminal:execute +command: educates admin platform deploy --config config.yaml +``` + +Using the Carvel tools linked into the `educates` CLI binary, this will download +the Educates package files (using `vendir`), customize the package YAML files +using our configuration (using `ytt`), resolve the container images used and pin +the versions (using `kbld`), and finally deploy everything to Kubernetes (using +`kapp`). + +During the deployment phase you should see the log output as the various +different types of Kubernetes resources are created and everything is verified +as having been deployed successfully. + +If all went well, the CLI should respond with: + +``` +Educates has been installed succesfully +``` + +Note that this worked because we had effective admin access to the Kubernetes +cluster we were deploying to. If you only have restricted access to the +Kubernetes cluster you are using this would not have worked. This is because +Educates creates new custom resource types in the cluster, and installs a number +of operators to manage those custom resources. diff --git a/workshops/lab-authoring-environment/workshop/content/06-hosting-a-workshop.md b/workshops/lab-authoring-environment/workshop/content/06-hosting-a-workshop.md new file mode 100644 index 0000000..621f40b --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/06-hosting-a-workshop.md @@ -0,0 +1,36 @@ +--- +title: Hosting a Workshop +--- + +We are now ready to deploy our first workshop. + +For this we will use a previously published workshop by running the command: + +```terminal:execute +command: educates deploy-workshop -f https://github.com/educates/lab-k8s-fundamentals/releases/latest/download/workshop.yaml +``` + +We will dig into what is happening under the covers later in the workshop, but +the effect of this command is to load the definition of the workshop into the +Kubernetes cluster, with the workshop then being made available through the +Educates training portal service. + +To access the training portal service and browse the workshops hosted by it, +run the command: + +```terminal:execute +command: educates browse-workshops +``` + +When the training portal service is ready, this should automatically open a new +web browser window. If you find that your web browser blocks opening of the new +window, then you can instead click on the link display in the terminal. Again +depending on the browser, clicking on the action block a second time after a few +seconds may also work to open a new window with the workshop. If you still have +issues, you can cut and paste the URL displayed in the terminal into a new +browser window yourself. + +This is only an issue when trying to run Educates inside of Educates as we are +with this workshop. The underlying reason and a solution in this specific case +is still being investigated. If using these commands from your own local +computer with a separate Kubernetes cluster there should be no issue. diff --git a/workshops/lab-authoring-environment/workshop/content/07-accessing-workshops.md b/workshops/lab-authoring-environment/workshop/content/07-accessing-workshops.md new file mode 100644 index 0000000..26f10e5 --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/07-accessing-workshops.md @@ -0,0 +1,22 @@ +--- +title: Accessing Workshops +--- + +The training portal service in Educates provides a gateway for accessing one or +more workshops deployed to the Kubernetes cluster. If required, you can have +more than one training portal service, with each providing access to a different +set of workshops. + +{{< figure src="../images/training-portal-ui.png" >}} + +The training portal service can be configured to require simple authentication +or access can be anonymous. The user interface provided by the training portal +is designed to be basic and was originally intended to provide a quick way to +provide access to a set of workshops for ad-hoc training, or use in conference +booths for workshops or demos. + +If you need a more rich user interface the training portal can be used in a +headless mode, with access to creation of workshops being performed via a REST +API. In this way you can integrate hosting of workshops into your own custom +front end portal or even an existing web site, with user access controlled by +your own SSO system. diff --git a/workshops/lab-authoring-environment/workshop/content/08-starting-a-workshop.md b/workshops/lab-authoring-environment/workshop/content/08-starting-a-workshop.md new file mode 100644 index 0000000..e43cc0a --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/08-starting-a-workshop.md @@ -0,0 +1,28 @@ +--- +title: Starting a Workshop +--- + +From the training portal start up an instance of the workshop displayed. + +In this configuration the workshop session will be created on demand, however +the training portal can be configured to pre-create a pool of reserved workshop +sessions ready for immediate allocation to users when requested. + +Overall, even without reserved sessions, unless specific workshops have time +consuming setup steps, starting up a workshop session should be relatively quick +as only a container within the Kubernetes cluster needs to be created, in +comparison to a full virtual machine as is typical with other training systems. + +Since the purpose of this workshop is to learn about using Educates and not to +actually complete the workshop you deployed in this exercise, you can exit the +workshop by selecting "Terminate Session" from the drop down menu top right of +the workshop session dashboard of the separate web browser window which was +created. Don't terminate the workshop session here in this dashboard though as +otherwise you will need to start over. + +So that we have sufficient resources to complete later steps of this workshop, +also delete the workshop you just deployed by running: + +```terminal:execute +command: educates delete-workshop -f https://github.com/educates/lab-k8s-fundamentals/releases/latest/download/workshop.yaml +``` diff --git a/workshops/lab-authoring-environment/workshop/content/09-authoring-workshops.md b/workshops/lab-authoring-environment/workshop/content/09-authoring-workshops.md new file mode 100644 index 0000000..b102ac8 --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/09-authoring-workshops.md @@ -0,0 +1,22 @@ +--- +title: Authoring Workshops +--- + +You can use Educates to deploy workshops published by others, but to get the +most from Educates you are more likely going to want to create your own +workshops. You could also use it to create a simple mechanism to deploy +application demos or test environments. + +To create the skeleton for a new workshop using the CLI, run the command: + +```terminal:execute +command: educates new-workshop lab-demo-workshop --title "Demo Workshop" --description "Workshop to demo use of Educates." +``` + +To view the set of files created run: + +```terminal:execute +command: tree lab-demo-workshop +``` + +Before we change any files let's deploy the workshop. diff --git a/workshops/lab-authoring-environment/workshop/content/10-publishing-workshops.md b/workshops/lab-authoring-environment/workshop/content/10-publishing-workshops.md new file mode 100644 index 0000000..874c6a1 --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/10-publishing-workshops.md @@ -0,0 +1,54 @@ +--- +title: Publishing Workshops +--- + +To deploy the workshop we first need to publish it to a place where Educates +will be able to download the workshop files at runtime. + +Educates supports different mechanisms for hosting of the workshop files, +including: + +* Hosting workshop files as an OCI image on an image registry. +* Hosting workshop files as a tar/zip archive on a web server. +* Hosting workshop files on a hosted Git repository (eg., GitHub). + +In other words, unlike many other SaaS based training platforms, you are not +required to edit your workshop content in the platforms web interface. Instead, +you can work on your workshop content locally and host your workshop files +separately, with Educates downloading the workshop files when required. + +Of the mechanisms listed above, the recommended method is to publish workshop +files as an OCI image to an image registry. The standard workflow for authoring +workshops using the CLI and a local Educates cluster is tailored to using this +mechanism. + +To publish our workshop, first change to the directory containing the workshop +files: + +```terminal:execute +command: cd ~/lab-demo-workshop +``` + +and run the following command to publish the workshop files. + +```terminal:execute +command: educates publish-workshop +``` + +What is being done here is that the workshop files from the current directory +are being bundled up into an OCI image and pushed to a local image registry +hosted at `localhost:5001`. This image registry was automatically created for +you as part of this workshop session. If you used the CLI to create a local +Kubernetes cluster running Educates, a local image registry would similarly be +automatically deployed for you and integrated with the cluster. The process here +in this workshop session thus mimics what you can expect if using the Educates +CLI from your own computer using a local Kubernetes cluster. + +If not using a local Kubernetes cluster and you were instead using a hosted +Kubernetes cluster, instead of using a local image registry you would need to +specify a separate image registry to use which is visible to the hosted +Kubernetes cluster. + +If using GitHub to host workshops, you could use GitHub container registry, and +to make that process simpler Educates provides a pre-packaged GitHub action +which can be used to automate publishing of workshops. diff --git a/workshops/lab-authoring-environment/workshop/content/11-deploy-the-workshop.md b/workshops/lab-authoring-environment/workshop/content/11-deploy-the-workshop.md new file mode 100644 index 0000000..1026dba --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/11-deploy-the-workshop.md @@ -0,0 +1,23 @@ +--- +title: Deploy the Workshop +--- + +To deploy the workshop from the current directory we now need to run: + +```terminal:execute +command: educates deploy-workshop +``` + +This is similar to how we deployed a previously published workshop except that +since we are running it out of the directory for the workshop it will use the +version of the workshop we just published to the local image registry. + +Hop back over to the web browser window where the training portal was running +and refresh the page, or once again run: + +```terminal:execute +command: educates browse-workshops +``` + +Start the workshop for the newly created demo workshop to verify it is working +and to view the default workshop instructions. diff --git a/workshops/lab-authoring-environment/workshop/content/12-updating-instructions.md b/workshops/lab-authoring-environment/workshop/content/12-updating-instructions.md new file mode 100644 index 0000000..e0ad071 --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/12-updating-instructions.md @@ -0,0 +1,41 @@ +--- +title: Updating Instructions +--- + +To update the workshop instructions open up the editor on the workshop overview +page found in the `workshop/content` directory. + +```editor:open-file +file: ~/lab-demo-workshop/workshop/content/00-workshop-overview.md +``` + +Select the paragraph describing the workshop: + +```editor:select-matching-text +file: ~/lab-demo-workshop/workshop/content/00-workshop-overview.md +text: "^This is .*$" +isRegex: true +``` + +and replace it with a better description of this workshop. + +```editor:replace-text-selection +file: ~/lab-demo-workshop/workshop/content/00-workshop-overview.md +text: | + This demo workshop is intended to demonstrate how awesome Educates is. +``` + +After having made the change re-publish the workshop files so that they will be +picked up for any freshly created workshop sessions. + +```terminal:execute +command: educates publish-workshop +``` + +In the separate web browser window where the demo workshop is running, terminate +the workshop session and create a new workshop session from the training portal. +You should now see the modifications you made. + +Note that obviously we used the embedded editor provided by the workshop session +to update the workshop files. When working from your own local computer you can +use whatever editor you would normally use. diff --git a/workshops/lab-authoring-environment/workshop/content/13-manually-updating.md b/workshops/lab-authoring-environment/workshop/content/13-manually-updating.md new file mode 100644 index 0000000..d0d13c5 --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/13-manually-updating.md @@ -0,0 +1,44 @@ +--- +title: Manually Updating +--- + +As demonstrated, the basic lifecyle for updating workshop content is to make any +modifications, publish the workshop files as an OCI image to an image registry, +and then create a new workshop session to see any changes. + +When making lots of small changes it is possible to short circuit this process +and use one of two mechanisms for making updates in a running workshop session. + +The first of these still entails re-publishing the workshop files, but we can +avoid the need to create a new workshop session by manually pulling down the +changes into the current live workshop session. This is done by running the +`update-workshop` command inside of the workshop container. + +Make another change to the workshop overview page of the demo workshop. + +```editor:append-lines-to-file +file: ~/lab-demo-workshop/workshop/content/00-workshop-overview.md +text: | + Once you have finished the workshop, I am sure you will agree. +``` + +Publish the workshop files: + +```terminal:execute +command: educates publish-workshop +``` + +Now jump back to demo workshop in the other web browser window and in the +terminal run: + +```workshop:copy +text: update-workshop +``` + +Reload the workshop instructions pane on the left hand side by holding down the +shift key at the same time as clicking on the reload icon to the right hand side +of the countdown clock in the workshop dashboard. Alternatively right click on +the workshop instructions pane and use the browser menu option to reload the +frame. + +Once the workshop instructions have been reloaded, you should see the changes. diff --git a/workshops/lab-authoring-environment/workshop/content/14-realtime-updates.md b/workshops/lab-authoring-environment/workshop/content/14-realtime-updates.md new file mode 100644 index 0000000..da9bf4c --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/14-realtime-updates.md @@ -0,0 +1,40 @@ +--- +title: Realtime Updates +--- + +The second option for updating workshop content within the running workshop +session involves a bit more magic. + +To demonstrate this mechanism run the command: + +```terminal:execute +command: educates serve-workshop --patch-workshop +``` + +Exit the running instance of the demo workshop you have running in your other +web browser window and start a new workshop session. Confirm you can see the +same workshop instructions you had previously. + +Make some more changes to the workshop instructions. + +```editor:append-lines-to-file +file: ~/lab-demo-workshop/workshop/content/00-workshop-overview.md +text: | + Especially when you see the live update feature in action. +``` + +This time we will not re-publish the workshop content. Instead, immediately swap +back to the other web browser window running the demo workshop. You should see +that it has already been updated with the changes. + +The manner by which this works was that the existing deployed workshop was +patched on the fly to get the workshop instructions from the local process +created when you ran the `educates serve-workshop` command. + +More specifically, since the rendering of workshop instructions is done using +the [Hugo](https://gohugo.io/) static site renderer, we ran the Hugo live +renderer, with the workshop session dashboard displaying the live view from the +local Hugo process. When changes are made to the local workshop files, Hugo will +automatically detect this and the view displayed in the workshop session +dashboard would be updated. You are thus able to quickly make changes without +needing to re-publish the workshop, or create a new workshop session. diff --git a/workshops/lab-authoring-environment/workshop/content/15-workshop-definition.md b/workshops/lab-authoring-environment/workshop/content/15-workshop-definition.md new file mode 100644 index 0000000..f9781f7 --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/15-workshop-definition.md @@ -0,0 +1,63 @@ +--- +title: Workshop Definition +--- + +The publishing lifecycle as described pertains to the workshop files used for +workshop instructions as well as any other files, scripts or applications used +within the workshop session. These will be downloaded for each distinct workshop +session. + +When the workshop was deployed using the `educates deploy-workshop` command, the +configuration of the workshop environment was dictated by the workshop +definition. This is a Kubernetes resource which describes where the workshop +files can be found, as well as what capabilities are required for a workshop. + +When using the standard workshop directory structure, the workshop definition +can be found in the `resources/workshop.yaml` file. + +```editor:open-file +file: ~/lab-demo-workshop/resources/workshop.yaml +``` + +Actual deployment of a workshop environment based on the workshop definition +only occurs when the workshop is registered with a training portal. + +When publishing a workshop, no update is made to the workshop definition +of any workshop environment that has already been created. + +When a training portal is configured to monitor for changes to the workshop +definition, updating the workshop definition will trigger the creation of a new +workshop environment based on the new workshop definition and the old workshop +environment will be shutdown, being deleted when all active workshop sessions +against it have completed. Any new requests for the workshop will be directed +towards the new workshop environment. + +This is done by first making the required changes to the workshop definition: + +```editor:select-matching-text +file: ~/lab-demo-workshop/resources/workshop.yaml +text: 'description: "(.*)"' +isRegex: true +group: 1 +``` + +```editor:replace-text-selection +file: ~/lab-demo-workshop/resources/workshop.yaml +text: "An awesome workshop to demo use of Educates." +``` + +Because you have a live preview running for the existing version of the +workshop, you will need to exit it. + +```terminal:interrupt +``` + +Next update the workshop definition in the cluster using the command: + +```terminal:execute +command: educates update-workshop +``` + +In your other web browser window terminate the running instance of the workshop +session for the demo workshop. Upon returning to the training portal you should +see that the description of the workshop has now changed. diff --git a/workshops/lab-authoring-environment/workshop/content/99-workshop-summary.md b/workshops/lab-authoring-environment/workshop/content/99-workshop-summary.md new file mode 100644 index 0000000..bc13733 --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/content/99-workshop-summary.md @@ -0,0 +1,14 @@ +--- +title: Workshop Summary +--- + +You have reached the end of this workshop. For more information about Educates +see: + +* [Educates Documentation](https://docs.educates.dev) +* [Educates GitHub Repository](https://github.com/vmware-tanzu-labs/educates-training-platform) + +If you have questions about Educates or need help installing or using it, you +can reach out to the developers of Educates and other Educates users in the +`#educates` Slack channel hosted under the [Kubernetes Slack +Community](https://kubernetes.slack.com/). diff --git a/workshops/lab-authoring-environment/workshop/setup.d/setup-educates-cli.sh b/workshops/lab-authoring-environment/workshop/setup.d/setup-educates-cli.sh new file mode 100755 index 0000000..86cb922 --- /dev/null +++ b/workshops/lab-authoring-environment/workshop/setup.d/setup-educates-cli.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +mkdir -p $HOME/bin + +ln -s /opt/packages/educates/bin/educates-linux-$PLATFORM_ARCH $HOME/bin/educates + +if [[ ! -f $HOME/.bash_profile || ! $(grep -q "__start_educates" $HOME/.bash_profile) ]]; then + /opt/packages/educates/bin/educates-linux-$PLATFORM_ARCH completion bash >> $HOME/.bash_profile +fi diff --git a/workshops/lab-authoring-environment/workshop/static/images/training-portal-ui.png b/workshops/lab-authoring-environment/workshop/static/images/training-portal-ui.png new file mode 100644 index 0000000..2bfbc56 Binary files /dev/null and b/workshops/lab-authoring-environment/workshop/static/images/training-portal-ui.png differ