You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by db...@apache.org on 2021/06/29 17:22:45 UTC
[geode] branch support/1.12 updated: GEODE-9042: Update
docker-based scripts to build UG (#6528)
This is an automated email from the ASF dual-hosted git repository.
dbarnes pushed a commit to branch support/1.12
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/support/1.12 by this push:
new ad52878 GEODE-9042: Update docker-based scripts to build UG (#6528)
ad52878 is described below
commit ad528780b55f834623e583b70ed19c8106f35925
Author: Dave Barnes <db...@apache.org>
AuthorDate: Tue Jun 29 10:12:53 2021 -0700
GEODE-9042: Update docker-based scripts to build UG (#6528)
---
dev-tools/docker/docs/Dockerfile | 29 ++++++-
dev-tools/docker/docs/README.md | 26 ------
dev-tools/docker/docs/build-docs.sh | 52 ------------
dev-tools/docker/docs/build-image-common.sh | 63 --------------
.../docs/{Dockerfile => preview-user-guide.sh} | 26 ++++--
dev-tools/docker/docs/view-docs.sh | 36 --------
geode-book/Gemfile | 2 +-
geode-book/Gemfile.lock | 97 ++++++++++++----------
geode-book/README.md | 51 ++++--------
9 files changed, 115 insertions(+), 267 deletions(-)
diff --git a/dev-tools/docker/docs/Dockerfile b/dev-tools/docker/docs/Dockerfile
index dceadd9..a1e8dcb 100644
--- a/dev-tools/docker/docs/Dockerfile
+++ b/dev-tools/docker/docs/Dockerfile
@@ -14,12 +14,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM ruby:2.3.1
+FROM ruby:2.5
LABEL Vendor="Apache Geode"
LABEL version=unstable
LABEL maintainer=dev@geode.apache.org
-ADD Gemfile Gemfile
-ADD Gemfile.lock Gemfile.lock
+# Nodejs & gems needed for 'rackup'
+RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - ; \
+ apt-get install -y nodejs
+RUN gem install bundler:1.17.3 \
+ rake multi_json:1.13.1 \
+ elasticsearch:2.0.2 \
+ multipart-post:2.0.0 \
+ faraday:0.15.4 \
+ libv8:3.16.14.15 \
+ mini_portile2:2.5.0 \
+ racc:1.5.2 \
+ nokogiri:1.11.2 \
+ mimemagic:0.3.9 \
+ puma:4.3.8 \
+ rack:2.1.4 \
+ smtpapi:0.1.0 \
+ sendgrid-ruby:1.1.6 \
+ therubyracer:0.12.2
+
+# Install Bookbinder
+COPY Gemfile Gemfile
+COPY Gemfile.lock Gemfile.lock
RUN bundle install
+
+COPY geode-book .
+COPY geode-docs .
diff --git a/dev-tools/docker/docs/README.md b/dev-tools/docker/docs/README.md
deleted file mode 100644
index b108509..0000000
--- a/dev-tools/docker/docs/README.md
+++ /dev/null
@@ -1,26 +0,0 @@
-# Using Docker to Build the Apache Geode User's Guide
-
-This document contains instructions for building and viewing the Apache Geode User Guide locally.
-
-Apache Geode provides the full source for the Apache Geode User Guide in markdown format (see `{geode-project-dir}/geode-docs/CONTRIBUTE.md`). For every Apache Geode release the user guide is built and published to http://geode.apache.org/docs/. Users can build the markdown into an HTML user guide using the provided Docker image, [Bookbinder](https://github.com/pivotal-cf/bookbinder), and the instructions below.
-
-The User Guide built in this way reflects any local updates you have made to the documentation source files in your local Apache Geode repository.
-
-## Building the User Guide
-
-The `build-docs.sh` script invokes Bookbinder to transform the markdown files to HTML using Docker, which has been provisioned with Bookbinder and Ruby. To build the guide, run the script from a shell prompt:
-
-```bash
-$ ./build-docs.sh
-```
-
-## Viewing the User Guide
-
-After the HTML files are generated, `view-docs.sh` can be used to start a webserver and review the documentation.
-
-```bash
-$ ./view-docs.sh
-```
-In a browser, navigate to `http://localhost:9292` to view the user guide.
-
-The other files in this folder (`build-image-common.sh` and `Dockerfile`) are utilities used by `build-docs.sh` and `view-docs.sh`.
diff --git a/dev-tools/docker/docs/build-docs.sh b/dev-tools/docker/docs/build-docs.sh
deleted file mode 100755
index 101ef67..0000000
--- a/dev-tools/docker/docs/build-docs.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -u
-
-SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-
-. $SCRIPT_DIR/build-image-common.sh
-
-REPO_PATH=${SCRIPT_DIR}/../../../
-
-echo "Running Bookbinder inside Docker container to generate documentation..."
-echo " Complete log can be found in ${SCRIPT_DIR}/build-docs-output.txt"
-
-docker run -i -t \
- --rm=true \
- -w "${REPO_PATH}/geode-book" \
- -v "$PWD:${REPO_PATH}" \
- ${IMAGE_NAME}-${USER_NAME} \
- /bin/bash -c "bundle exec bookbinder bind local &> ${SCRIPT_DIR}/build-docs-output.txt"
-
-SUCCESS=$(grep "Bookbinder bound your book into" ${SCRIPT_DIR}/build-docs-output.txt)
-
-if [[ "${SUCCESS}" == "" ]];then
- echo "Something went wrong while generating documentation, check log."
-else
- echo ${SUCCESS}
-fi
-
-docker run -i -t \
- --rm=true \
- -w "${REPO_PATH}/geode-book" \
- -v "$PWD:${REPO_PATH}" \
- ${IMAGE_NAME}-${USER_NAME} \
- /bin/bash -c "chown -R ${USER_ID}:${GROUP_ID} ${REPO_PATH}/geode-book/output ${REPO_PATH}/geode-book/final_app"
-
-popd 1> /dev/null
-
diff --git a/dev-tools/docker/docs/build-image-common.sh b/dev-tools/docker/docs/build-image-common.sh
deleted file mode 100644
index 8b6edbb..0000000
--- a/dev-tools/docker/docs/build-image-common.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -u
-
-export DOCKER_ENV_VERSION="0.1"
-
-SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-
-#Stupid OSX has a different mktemp command
-TMP_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'geodedocs'`
-
-function cleanup() {
- rm -rf $TMP_DIR
-}
-
-trap cleanup EXIT
-
-IMAGE_NAME="geode/docsbuild:${DOCKER_ENV_VERSION}"
-
-pushd ${TMP_DIR} 1> /dev/null
-cp $SCRIPT_DIR/Dockerfile .
-cp $SCRIPT_DIR/../../../geode-book/Gemfile* .
-
-echo "Building ${IMAGE_NAME} image..."
-docker build -q -t ${IMAGE_NAME} .
-
-popd 1> /dev/null
-
-if [ "$(uname -s)" == "Linux" ]; then
- USER_NAME=${SUDO_USER:=$USER}
- USER_ID=$(id -u "${USER_NAME}")
- GROUP_ID=$(id -g "${USER_NAME}")
-else # boot2docker uid and gid
- USER_NAME=$USER
- USER_ID=1000
- GROUP_ID=50
-fi
-
-echo "Building ${IMAGE_NAME}-${USER_NAME} image..."
-docker build -q -t "${IMAGE_NAME}-${USER_NAME}" - <<UserSpecificDocker
-FROM ${IMAGE_NAME}
-RUN groupadd --non-unique -g ${GROUP_ID} ${USER_NAME}
-RUN useradd -g ${GROUP_ID} -u ${USER_ID} -k /root -m ${USER_NAME}
-ENV HOME /home/${USER_NAME}
-UserSpecificDocker
-
-# Go to root
-pushd ${SCRIPT_DIR}/../../../ 1> /dev/null
diff --git a/dev-tools/docker/docs/Dockerfile b/dev-tools/docker/docs/preview-user-guide.sh
old mode 100644
new mode 100755
similarity index 62%
copy from dev-tools/docker/docs/Dockerfile
copy to dev-tools/docker/docs/preview-user-guide.sh
index dceadd9..062ee77
--- a/dev-tools/docker/docs/Dockerfile
+++ b/dev-tools/docker/docs/preview-user-guide.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -14,12 +16,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM ruby:2.3.1
+function cleanup {
+ rm Gemfile Gemfile.lock
+ rm -r geode-book geode-docs
+}
+
+trap cleanup EXIT
+
+set -x -e
+
+mkdir -p geode-book
+mkdir -p geode-docs
+
+cp ../../../geode-book/Gemfile* .
+cp -r ../../../geode-book geode-book
+cp -r ../../../geode-docs geode-docs
-LABEL Vendor="Apache Geode"
-LABEL version=unstable
-LABEL maintainer=dev@geode.apache.org
+docker build -t geodedocs/temp:1.0 .
-ADD Gemfile Gemfile
-ADD Gemfile.lock Gemfile.lock
-RUN bundle install
+docker run -it -p 9292:9292 geodedocs/temp:1.0 /bin/bash -c "cd geode-book && bundle exec bookbinder bind local && cd final_app && bundle exec rackup --host=0.0.0.0"
diff --git a/dev-tools/docker/docs/view-docs.sh b/dev-tools/docker/docs/view-docs.sh
deleted file mode 100755
index ece8d8e..0000000
--- a/dev-tools/docker/docs/view-docs.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -e -u
-
-SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-
-. $SCRIPT_DIR/build-image-common.sh
-
-REPO_PATH=${SCRIPT_DIR}/../../../
-
-echo "Starting up web server..."
-docker run -i -t \
- --rm=true \
- -w "${REPO_PATH}/geode-book/final_app/" \
- -v "$PWD:${REPO_PATH}" \
- -p 127.0.0.1:9292:9292 \
- ${IMAGE_NAME}-${USER_NAME} \
- /bin/bash -c "bundle install; rackup --host 0.0.0.0"
-
-popd 1> /dev/null
-
diff --git a/geode-book/Gemfile b/geode-book/Gemfile
index ea05ef5..a418990 100644
--- a/geode-book/Gemfile
+++ b/geode-book/Gemfile
@@ -17,6 +17,6 @@
source "https://rubygems.org"
-gem 'bookbindery', '10.1.14'
+gem 'bookbindery'
gem 'libv8'
diff --git a/geode-book/Gemfile.lock b/geode-book/Gemfile.lock
index 9b60758..922f6d2 100644
--- a/geode-book/Gemfile.lock
+++ b/geode-book/Gemfile.lock
@@ -1,16 +1,16 @@
GEM
remote: https://rubygems.org/
specs:
- activesupport (4.2.11.1)
+ activesupport (4.2.11.3)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
- addressable (2.6.0)
- public_suffix (>= 2.0.2, < 4.0)
+ addressable (2.7.0)
+ public_suffix (>= 2.0.2, < 5.0)
ansi (1.5.0)
- backports (3.15.0)
- bookbindery (10.1.14)
+ backports (3.21.0)
+ bookbindery (10.1.17)
ansi (~> 1.4)
css_parser
elasticsearch
@@ -22,15 +22,16 @@ GEM
middleman-livereload
middleman-sprockets
middleman-syntax (= 2.1.0)
- nokogiri (= 1.8.2)
+ nokogiri (= 1.10.1)
puma
rack-rewrite
redcarpet (~> 3.2.3)
rouge (!= 1.9.1)
+ sprockets (= 3.7.2)
therubyracer
thor (= 0.19.1)
- builder (3.2.3)
- chunky_png (1.3.11)
+ builder (3.2.4)
+ chunky_png (1.4.0)
coffee-script (2.4.1)
coffee-script-source
execjs
@@ -47,31 +48,42 @@ GEM
sass (>= 3.3.0, < 3.5)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
- concurrent-ruby (1.1.5)
+ concurrent-ruby (1.1.9)
contracts (0.13.0)
- css_parser (1.7.0)
+ css_parser (1.9.0)
addressable
- dotenv (2.7.5)
- elasticsearch (7.3.0)
- elasticsearch-api (= 7.3.0)
- elasticsearch-transport (= 7.3.0)
- elasticsearch-api (7.3.0)
+ dotenv (2.7.6)
+ elasticsearch (7.13.1)
+ elasticsearch-api (= 7.13.1)
+ elasticsearch-transport (= 7.13.1)
+ elasticsearch-api (7.13.1)
multi_json
- elasticsearch-transport (7.3.0)
- faraday
+ elasticsearch-transport (7.13.1)
+ faraday (~> 1)
multi_json
- em-websocket (0.5.1)
+ em-websocket (0.5.2)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubis (2.7.0)
eventmachine (1.2.7)
- excon (0.71.0)
- execjs (2.7.0)
- faraday (0.15.4)
+ excon (0.82.0)
+ execjs (2.8.1)
+ faraday (1.4.2)
+ faraday-em_http (~> 1.0)
+ faraday-em_synchrony (~> 1.0)
+ faraday-excon (~> 1.1)
+ faraday-net_http (~> 1.0)
+ faraday-net_http_persistent (~> 1.1)
multipart-post (>= 1.2, < 3)
+ ruby2_keywords (>= 0.0.4)
+ faraday-em_http (1.0.0)
+ faraday-em_synchrony (1.0.0)
+ faraday-excon (1.1.0)
+ faraday-net_http (1.0.1)
+ faraday-net_http_persistent (1.1.0)
fast_blank (1.0.0)
- fastimage (2.1.5)
- ffi (1.11.1)
+ fastimage (2.2.4)
+ ffi (1.15.3)
fog-aws (0.7.6)
fog-core (~> 1.27)
fog-json (~> 1.0)
@@ -89,9 +101,9 @@ GEM
nokogiri (>= 1.5.11, < 2.0.0)
font-awesome-sass (4.7.0)
sass (>= 3.2)
- formatador (0.2.5)
+ formatador (0.3.0)
git (1.2.9.1)
- haml (5.1.1)
+ haml (5.2.1)
temple (>= 0.8.0)
tilt
hamster (3.0.0)
@@ -105,7 +117,7 @@ GEM
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
- memoist (0.16.0)
+ memoist (0.16.2)
middleman (4.1.10)
coffee-script (~> 2.2)
compass-import-once (= 1.0.5)
@@ -142,7 +154,7 @@ GEM
servolux
tilt (~> 1.4.1)
uglifier (~> 3.0)
- middleman-livereload (3.4.6)
+ middleman-livereload (3.4.7)
em-websocket (~> 0.5.1)
middleman-core (>= 3.3)
rack-livereload (~> 0.3.15)
@@ -152,46 +164,47 @@ GEM
middleman-syntax (2.1.0)
middleman-core (>= 3.2)
rouge (~> 1.0)
- mini_portile2 (2.3.0)
- minitest (5.11.3)
- multi_json (1.13.1)
+ mini_portile2 (2.4.0)
+ minitest (5.14.4)
+ multi_json (1.15.0)
multipart-post (2.1.1)
- nio4r (2.4.0)
- nokogiri (1.8.2)
- mini_portile2 (~> 2.3.0)
+ nio4r (2.5.7)
+ nokogiri (1.10.1)
+ mini_portile2 (~> 2.4.0)
padrino-helpers (0.13.3.4)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.13.3.4)
tilt (>= 1.4.1, < 3)
padrino-support (0.13.3.4)
activesupport (>= 3.1)
- parallel (1.17.0)
- public_suffix (3.1.1)
- puma (4.0.1)
+ parallel (1.20.1)
+ public_suffix (4.0.6)
+ puma (5.3.2)
nio4r (~> 2.0)
- rack (1.6.11)
+ rack (1.6.13)
rack-livereload (0.3.17)
rack
rack-rewrite (1.5.1)
- rb-fsevent (0.10.3)
- rb-inotify (0.10.0)
+ rb-fsevent (0.11.0)
+ rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.2.3)
ref (2.0.0)
rouge (1.11.1)
+ ruby2_keywords (0.0.4)
sass (3.4.25)
servolux (0.13.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
- temple (0.8.1)
+ temple (0.8.2)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
thor (0.19.1)
thread_safe (0.3.6)
tilt (1.4.1)
- tzinfo (1.2.5)
+ tzinfo (1.2.9)
thread_safe (~> 0.1)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
@@ -200,7 +213,7 @@ PLATFORMS
ruby
DEPENDENCIES
- bookbindery (= 10.1.14)
+ bookbindery
libv8
BUNDLED WITH
diff --git a/geode-book/README.md b/geode-book/README.md
index c9d4dce..a321cf9 100644
--- a/geode-book/README.md
+++ b/geode-book/README.md
@@ -16,11 +16,17 @@ Apache Geode provides the full source for the Apache Geode User Guide in markdow
Bookbinder is a Ruby gem that binds a unified documentation web application from markdown, html, and/or DITA source material. The source material for bookbinder must be stored either in local directories or in GitHub repositories. Bookbinder runs [Middleman](http://middlemanapp.com/) to produce a Rackup app that can be deployed locally or as a web application.
-## Automatic build
+## Preview the User Guide
-Documentation can be built and previewed using the utility scripts at [dev-tools/docker/docs](https://github.com/apache/geode/tree/develop/dev-tools/docker/docs). These scripts use Docker, removing the requirement of installing Ruby and Bookbinder. They are based on the instructions described in the [Manual build](#manual-build) chapter.
+Documentation can be built and previewed using the utility script at `{geode-project-dir}/dev-tools/docker/docs`. This script uses a Docker image that provides the tools to build and view the guide, including Ruby, Bookbinder, and Rackup.
-## Manual build
+```bash
+$ cd {geode-project-dir}/dev-tools/docker/docs
+$ ./preview-user-guide.sh
+```
+In a browser, navigate to `http://localhost:9292` to view the user guide.
+
+## Build the User Guide
### Prerequisites
@@ -42,6 +48,7 @@ For Geode, a preconfigured **book** is provided in the directory `{geode-project
1. The GemFile in the `geode-book` directory already defines the `gem "bookbindery"` dependency. Make sure you are in the `{geode-project-dir}/geode-book` directory and enter:
```
+ $ cd {geode-project-dir}/geode-book
$ bundle install
```
@@ -69,10 +76,11 @@ For Geode, a preconfigured **book** is provided in the directory `{geode-project
an operating system where you do not have access to a system install of libv8 this may not be possible or necessary.
-4. To start a local website of the Apache Geode User Guide, enter:
+3. To start a local website of the Apache Geode User Guide, you have to execute Rackup from the `final_app` directory:
```
- $ rackup
+ $ cd {geode-project-dir}/geode-book/final_app
+ $ bundle exec rackup
```
You can now view the local documentation at <http://localhost:9292>.
@@ -81,35 +89,4 @@ For Geode, a preconfigured **book** is provided in the directory `{geode-project
Once you have reviewed your local build of the User Guide, you can publish it by copying it to the Apache Geode website. The target directory should contain a Geode version number.
-To copy the User Guide to the website repo:
-
-1. Create the destination directory by navigating to the geode-site repo. Check out the *master* branch and create a destination directory for the User Guide. The naming convention is:
-
- ```
-{geode-site}/website/content/docs/guide/XY
- ```
-where `XY` is the product version of your documentation (e.g., `{geode-site}/website/content/docs/guide/12` if you are publishing the documentation for Apache Geode 1.2).
-
-2. Navigate to the User Guide you have built in the Geode repository: `{geode-project-dir}/geode-book/final_app/public/docs/guide/XY`.
-
-3. Use `tar` to copy the directory in order to preserve links and other filesystem niceties.
-
- a. Create the tarfile in your Desktop for easy access on the retrieval side.
-
- ```
- $ tar cvf ~/Desktop/new-guide-content.tar .
- ```
- b. Create the destination directory in the `geode-site` repo:
-
- ```
- $ mkdir -p {geode-site}/website/content/docs/guide/XY
- ```
-
- c. Navigate to the target directory and un-tar the userguide archive:
-
- ```
- $ cd {geode-site}/website/content/docs/guide/XY
- $ tar xvf ~/Desktop/new-guide-content.tar
- ```
-
-4. Follow the instructions in the README.md file on the *master* branch of the geode-site repo (`{geode-site}/README.md`) to build, review, and publish the Apache Geode website. You can also view the geode-site README.md file on [github: https://github.com/apache/geode-site](https://github.com/apache/geode-site).
+To copy the User Guide to the website repo, follow the instructions in the `README.md` file on the *master* branch of the geode-site repo ([github: https://github.com/apache/geode-site](https://github.com/apache/geode-site)) under the topic **Add a new user guide**.