diff --git a/assemblies/assembly-customizing-the-learning-paths.adoc b/assemblies/assembly-customizing-the-learning-paths.adoc new file mode 100644 index 0000000000..b70fc33aac --- /dev/null +++ b/assemblies/assembly-customizing-the-learning-paths.adoc @@ -0,0 +1,15 @@ +[id='proc-customize-rhdh-learning-paths_{context}'] += Customizing the Learning Paths in {product} + +In {product}, you can configure Learning Paths by hosting the required data externally, +and using the built-in proxy to deliver this data rather than the default. + +You can provide Learning Paths data from the following sources: + +* A JSON file hosted on a web server, such as GitHub or GitLab. +* A dedicated service that provides the Learning Paths data in JSON format using an API. + +include::modules/customizing-the-learning-paths/proc-customizing-the-learning-paths-by-using-hosted-json-files.adoc[leveloffset=+1] + + +include::modules/customizing-the-learning-paths/proc-customizing-the-learning-paths-by-using-a-dedicated-service.adoc[leveloffset=+1] diff --git a/modules/customizing-the-learning-paths/proc-customize-rhdh-learning-paths.adoc b/modules/customizing-the-learning-paths/proc-customize-rhdh-learning-paths.adoc deleted file mode 100644 index 2ae0faf956..0000000000 --- a/modules/customizing-the-learning-paths/proc-customize-rhdh-learning-paths.adoc +++ /dev/null @@ -1,82 +0,0 @@ -[id='proc-customize-rhdh-learning-paths_{context}'] -= Customizing the Learning Paths in {product} - -In {product}, you can configure Learning Paths by passing the data into the `{my-app-config-file}` file as a proxy. The base URL must include the `/developer-hub/learning-paths` proxy. - -[NOTE] -==== -Due to the use of overlapping `pathRewrites` for both the `learning-path` and `homepage` quick access proxies, you must create the `learning-paths` configuration (`^api/proxy/developer-hub/learning-paths`) before you create the `homepage` configuration (`^/api/proxy/developer-hub`). - -For more information about customizing the Home page in {product}, see xref:customizing-the-home-page[Customizing the Home page in {product}]. -==== - -You can provide data to the Learning Path from the following sources: - -* JSON files hosted on GitHub or GitLab. -* A dedicated service that provides the Learning Path data in JSON format using an API. - -== Using hosted JSON files to provide data to the Learning Paths - -.Prerequisites - -You have installed {product} by using either the Operator or Helm chart. -For more information, see xref:{installing-on-ocp-book-url}#assembly-install-rhdh-ocp[{installing-on-ocp-book-title}]. - -.Procedure - -To access the data from the JSON files, complete the following step: - -* Add the following code to the `{my-app-config-file}` file: -+ -[source,yaml] ----- -proxy: - endpoints: - '/developer-hub': - target: https://raw.githubusercontent.com/ - pathRewrite: - '^/api/proxy/developer-hub/learning-paths': '/redhat-developer/rhdh/main/packages/app/public/learning-paths/data.json' - '^/api/proxy/developer-hub/tech-radar': '/redhat-developer/rhdh/main/packages/app/public/tech-radar/data-default.json' - '^/api/proxy/developer-hub': '/redhat-developer/rhdh/main/packages/app/public/homepage/data.json' - changeOrigin: true - secure: true ----- - -== Using a dedicated service to provide data to the Learning Paths - -When using a dedicated service, you can do the following: - -* Use the same service to provide the data to all configurable {product-short} pages or use a different service for each page. -* Use the https://github.com/redhat-developer/red-hat-developer-hub-customization-provider[`red-hat-developer-hub-customization-provider`] as an example service, which provides data for both the Home and Tech Radar pages. The `red-hat-developer-hub-customization-provider` service provides the same data as default {product-short} data. You can fork the `red-hat-developer-hub-customization-provider` service repository from GitHub and modify it with your own data, if required. -* Deploy the `red-hat-developer-hub-customization-provider` service and the {product-short} Helm chart on the same cluster. - -.Prerequisites - -* You have installed the {product} using Helm chart. -For more information, see xref:{installing-on-ocp-book-url}#assembly-install-rhdh-ocp[{installing-on-ocp-book-title}]. - -.Procedure - -To use a dedicated service to provide the Learning Path data, complete the following steps: - -. Add the following code to the link:{configuring-book-url}[`{my-app-config-file}` file]: -+ -[source,yaml] ----- - proxy: - endpoints: - # Other Proxies - '/developer-hub/learning-paths': - target: ${LEARNING_PATH_DATA_URL} - changeOrigin: true - # Change to "false" in case of using self hosted cluster with a self-signed certificate - secure: true ----- -where the `LEARNING_PATH_DATA_URL` is defined as `pass:c[http:///learning-paths]`, for example, `pass:c[http://rhdh-customization-provider/learning-paths]`. -+ -[NOTE] -==== -You can define the `LEARNING_PATH_DATA_URL` by adding it to `rhdh-secrets` or by directly replacing it with its value in your custom ConfigMap. -==== -+ -. Delete the {product-short} pod to ensure that the new configurations are loaded correctly. diff --git a/modules/customizing-the-learning-paths/proc-customizing-the-learning-paths-by-using-a-dedicated-service.adoc b/modules/customizing-the-learning-paths/proc-customizing-the-learning-paths-by-using-a-dedicated-service.adoc new file mode 100644 index 0000000000..7e07c05fe7 --- /dev/null +++ b/modules/customizing-the-learning-paths/proc-customizing-the-learning-paths-by-using-a-dedicated-service.adoc @@ -0,0 +1,23 @@ +[id='proc-customizing-the-learning-paths-by-using-a-customization-service_{context}'] += Customizing the Learning Paths by using a customization service + +For advanced scenarios, you can host your {product} customization service to provide data to all configurable {product-short} pages, such as the Learning Paths. +You can even use a different service for each page. + +.Procedure +. Deploy your {product-short} customization service on the same {ocp-short} cluster as your {product-short} instance. +You can find an example at link:https://github.com/redhat-developer/red-hat-developer-hub-customization-provider[`red-hat-developer-hub-customization-provider`], that provides the same data as default {product-short} data. +The customization service provides a Learning Paths data URL such as: `pass:c,a,q[http://__/learning-paths]`. + +. Configure the {product-short} proxy to use your dedicated service to provide the Learning Path data, add the following to the link:{configuring-book-url}[`{my-app-config-file}` file]: ++ +[source,yaml,subs='+quotes'] +---- +proxy: + endpoints: + '/developer-hub/learning-paths': + target: __ + changeOrigin: true + qsecure: true # <1> +---- +<1> Change to "false" in case of using self hosted cluster with a self-signed certificate diff --git a/modules/customizing-the-learning-paths/proc-customizing-the-learning-paths-by-using-hosted-json-files.adoc b/modules/customizing-the-learning-paths/proc-customizing-the-learning-paths-by-using-hosted-json-files.adoc new file mode 100644 index 0000000000..8fdc190bdb --- /dev/null +++ b/modules/customizing-the-learning-paths/proc-customizing-the-learning-paths-by-using-hosted-json-files.adoc @@ -0,0 +1,49 @@ +[id='proc-customizing-the-learning-paths-by-using-a-hosted-json-file_{context}'] += Customizing the Learning Paths by using a hosted JSON file + +For ease of use and simplicity, you can configure the Learning Paths by using a hosted JSON file. + +.Procedure +. Publish the JSON file containing your Learning Paths data to a web server, such as GitHub or Gitlab. You can find an example at link:https://raw.githubusercontent.com/redhat-developer/rhdh/release-{product-version}/packages/app/public/learning-paths/data.json[]. + +. Configure the {product-short} proxy to access the Learning Paths data from the hosted JSON file, by adding the following to the `{my-app-config-file}` file: ++ +[source,yaml,subs='+quotes'] +---- +proxy: + endpoints: + '/developer-hub': + target: __ + pathRewrite: + '^/api/proxy/developer-hub/learning-paths': '__' + changeOrigin: true + secure: true +---- + +`__`:: Enter the hosted JSON file base URL, such as `https://raw.githubusercontent.com`. + +`__`:: Enter the hosted JSON file path without the base URL, such as +`'/redhat-developer/rhdh/main/packages/app/public/learning-paths/data.json'` ++ +[TIP] +==== +When also configuring the home page, due to the use of overlapping `pathRewrites` for both the `learning-path` and `homepage` quick access proxies, create the `learning-paths` configuration (`^api/proxy/developer-hub/learning-paths`) before you create the `homepage` configuration (`^/api/proxy/developer-hub`). +For example: + +[source,yaml] +---- +proxy: + endpoints: + '/developer-hub': + target: https://raw.githubusercontent.com/ + pathRewrite: + '^/api/proxy/developer-hub/learning-paths': '/redhat-developer/rhdh/main/packages/app/public/learning-paths/data.json' + '^/api/proxy/developer-hub/tech-radar': '/redhat-developer/rhdh/main/packages/app/public/tech-radar/data-default.json' + '^/api/proxy/developer-hub': '/redhat-developer/rhdh/main/packages/app/public/homepage/data.json' + changeOrigin: true + secure: true +---- +==== + +.Additional resources +* xref:customizing-the-home-page[Customizing the Home page in {product}]. diff --git a/titles/customizing/master.adoc b/titles/customizing/master.adoc index 3b54976696..ec64fabc59 100644 --- a/titles/customizing/master.adoc +++ b/titles/customizing/master.adoc @@ -20,7 +20,7 @@ include::modules/customizing/proc-customizing-the-backend-secret.adoc[leveloffse include::assemblies/assembly-configuring-templates.adoc[leveloffset=+1] -include::modules/customizing-the-learning-paths/proc-customize-rhdh-learning-paths.adoc[leveloffset=+1] +include::assemblies/assembly-customizing-the-learning-paths.adoc[leveloffset=+1] include::assemblies/assembly-configuring-the-global-header.adoc[leveloffset=+1]