World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#492] feat(doc): Document website framework (#512)
Xun Liu98631f26f465
diff --git a/.gitignore b/.gitignoreindex 9eb2d6567a..7d98520a8d 100644--- a/.gitignore+++ b/.gitignore@@ -36,4 +36,5 @@ out/**distributionserver/src/main/resources/project.properties-dev/docker/hive/packages\ No newline at end of file+dev/docker/hive/packages+docs/build\ No newline at end of filediff --git a/docs/README.md b/docs/README.mdnew file mode 100644index 0000000000..a8305ea890--- /dev/null+++ b/docs/README.md@@ -0,0 +1,40 @@+---+title: "Gravitino Document"+date: 2023-10-03T09:03:20-08:00+license: "Copyright 2023 Datastrato.+This software is licensed under the Apache License version 2."+---+# Gravitino Document++## Launch Gravitino document website++Execute `./launch-docs-website.sh` scripts, it will create the Gravitino document website locally, it follows these steps:++1. Create a `build` directory within the `docs` directory.+2. Automatically download the [Hugo](https://github.com/gohugoio/hugo) binary executable file into the `build` directory.+3. Use the `hugo new site web` command to create the website project within the `build` directory.+4. Copy all markdown files into `web/content/docs` to generate the HTML for the document website using Hugo.+5. Copy the entire assets directory into `web/static` to include the images referenced in the document website HTML.+6. Automatically replace the Markdown embedded image addresses with Hugo website absolute paths.+ > This is necessary because Markdown embedded images use relative paths, whereas Hugo website images require absolute paths.+ > Replace `"+bin="$(cd "${bin}">/dev/null; pwd)"++USAGE="Usage: launch-docs-website.sh [update]"++OS=$(uname -s)+if [ "$OS" == "Darwin" ]; then+ HUGO_OS_NAME="darwin-universal"+elif [[ "$OS" == "Linux" ]]; then+ HUGO_OS_NAME="linux-amd64"+else+ echo "Currently only support macOS or Linux."+ exit 1+fi++# Download Hugo+HUGO_VERSION="0.119.0"+HUGO_PACKAGE_NAME="hugo_${HUGO_VERSION}_${HUGO_OS_NAME}.tar.gz"+HUGO_DOWNLOAD_URL="https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_PACKAGE_NAME}"++# Because Markdown embedded images are relative paths,+# Hugo website images are absolute paths.+function hugo_image_path_process() {+ for file in ${1}/*; do+ if [[ -d ${file} ]]; then+ hugo_image_path_process "${file}"+ elif [[ -f ${file} ]]; then+ # Replace ` {+ # Create a new Hugo website docs directory+ if [[ ! -d ${bin}/build/web/content/docs ]]; then+ mkdir -p ${bin}/build/web/content/docs+ fi++ # Copy all markdown files to the Hugo website docs directory+ # 1. Copy all root directory markdown files+ rsync -av --exclude='README.md' ${bin}/*.md ${bin}/build/web/content/docs++ # 2. Copy all subdirectory markdown files+ subDirs=$(find "${bin}" -type d -mindepth 1 -maxdepth 1)+ for subDir in ${subDirs}; do+ if [[ ${subDir} != ${bin}/build && ${subDir} != ${bin}/assets ]]; then+ cp -r ${subDir} ${bin}/build/web/content/docs+ fi+ done++ # 3. Copy all assets to the Hugo website static directory+ cp -r "${bin}/assets" "${bin}/build/web/static"++ # Replace the Markdown embedded images with Hugo website absolute paths+ hugo_image_path_process "${bin}/build/web/content/docs"+}++# Launch the Hugo website+function launch_website() {+ # Prepare download packages+ if [[ ! -d "${bin}/build" ]]; then+ mkdir -p "${bin}/build"+ fi++ if [ ! -f "${bin}/build/hugo" ]; then+ wget -q -P "${bin}/build" ${HUGO_DOWNLOAD_URL}+ tar -xzf "${bin}/build/${HUGO_PACKAGE_NAME}" -C "${bin}/build"+ rm -rf "${bin}/build/${HUGO_PACKAGE_NAME}"+ fi++ # Remove the old Hugo website+ cd ${bin}/build+ rm -rf ${bin}/build/web++ # Create a new Hugo website+ ${bin}/build/hugo new site web++ # Setting the Hugo theme+ cd ${bin}/build/web+ git clone https://github.com/datastratolabs/gohugo-theme-ananke.git themes/ananke++ # Set the Hugo website configuration+ echo "languageCode = 'en-us'+ title = 'Gravitino Docs'+ theme = 'ananke'" > hugo.toml++ copy_docs++ # Start the Hugo server+ ${bin}/build/hugo server --buildDrafts+}++if [[ "$1" == "update" ]]; then+ copy_docs+elif [[ "$1" != "" ]]; then+ echo ${USAGE}+else+ launch_website+fi\ No newline at end of filediff --git a/docs/publish-docker-images.md b/docs/publish-docker-images.mdindex 1416b26441..9903040fdf 100644--- a/docs/publish-docker-images.md+++ b/docs/publish-docker-images.md@@ -1,7 +1,9 @@-<!--- Copyright 2023 Datastrato.- This software is licensed under the Apache License version 2.--->+---+title: "How to Publish Docker images"+date: 2023-10-01T09:03:20-08:00+license: "Copyright 2023 Datastrato.+This software is licensed under the Apache License version 2."+---# How to Publish Docker images## Introduction@@ -27,7 +29,7 @@ We use Github Actions to publish the docker images to the DockerHub repository.5. You must enter the correct `publish docker token` before you can execute run `Publish Docker Image` workflow.6. Wait for the workflow to complete. You can see a new docker image shown in the [datastrato](https://hub.docker.com/u/datastrato) DockerHub repository.-[<img src="assets/publish-docker-image.png" width="400"/>](assets/publish-docker-image.png)+## The version of the Data source in the Docker image- [gravitino-ci-hive](../dev/docker/hive/README.md)\ No newline at end of file