Author: mck
Date: Sat Mar  9 07:10:27 2019
New Revision: 1855094

URL: http://svn.apache.org/viewvc?rev=1855094&view=rev
Log:
Dockerise generation of the entire website

 patch by Anthony Grasso; reviewed by Mick Semb Wever for CASSANDRA-14972

Added:
    cassandra/site/Dockerfile
    cassandra/site/README
    cassandra/site/docker-compose.yml
    cassandra/site/docker-entrypoint-jekyll-serve.sh   (with props)
    cassandra/site/docker-entrypoint.sh   (with props)

Added: cassandra/site/Dockerfile
URL: 
http://svn.apache.org/viewvc/cassandra/site/Dockerfile?rev=1855094&view=auto
==============================================================================
--- cassandra/site/Dockerfile (added)
+++ cassandra/site/Dockerfile Sat Mar  9 07:10:27 2019
@@ -0,0 +1,51 @@
+FROM debian:latest
+
+# Install Java
+RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select 
true | debconf-set-selections && \
+    apt-get update && \
+    apt-get install -y \
+        software-properties-common \
+        gpg && \
+    add-apt-repository -y ppa:webupd8team/java && \
+    apt-get update && \
+    apt-get install -y --allow-unauthenticated oracle-java8-installer && \
+    rm -rf /var/lib/apt/lists/* && \
+    rm -rf /var/cache/oracle-jdk8-installer
+
+# Install other tools
+RUN apt-get update && \
+    apt-get install -y \
+        git \
+        python2.7 \
+        python-pip \
+        ruby-full \
+        make \
+        ant \
+        ant-optional \
+        maven
+
+# Install Sphinx for generating Cassandra docs
+RUN pip install --no-cache-dir \
+        sphinx \
+        sphinx_rtd_theme
+
+COPY ./src/Gemfile /
+COPY ./src/Gemfile.lock /
+
+RUN gem install bundler && \
+    bundle install && \
+    rm /Gemfile /Gemfile.lock
+
+ENV CASSANDRA_DIR="/usr/src/cassandra"
+
+# Setup repositories to building the docs
+RUN mkdir -p /usr/src/cassandra-site && \
+    git clone https://gitbox.apache.org/repos/asf/cassandra.git 
${CASSANDRA_DIR}
+
+EXPOSE 4000/tcp
+
+COPY docker-entrypoint.sh /
+RUN chmod +x /docker-entrypoint.sh
+ENTRYPOINT ["/docker-entrypoint.sh"]
+
+CMD [""]

Added: cassandra/site/README
URL: http://svn.apache.org/viewvc/cassandra/site/README?rev=1855094&view=auto
==============================================================================
--- cassandra/site/README (added)
+++ cassandra/site/README Sat Mar  9 07:10:27 2019
@@ -0,0 +1,45 @@
+Apache Cassandra website builder
+================================
+
+Building the Apache Cassandra website takes a number of steps. To make things 
easier we have provided a Docker container which can build the full website in 
two simple commands and have it ready to commit via SVN. If you are interested 
in the process head over to the [README](./src/README) in _src_ directory.
+
+Prerequisite
+------------
+
+To build and run the Docker container you will need `Docker` version 2.0.0.0 
or greater. If you need a copy of the site code you will need `SVN` as well.
+
+
+Building the site
+-----------------
+
+If you need a copy of the site code run this command:
+
+```bash
+$ svn co http://svn.apache.org/repos/asf/cassandra/site/ ./cassandra-site
+$ cd ./cassandra-site
+
+```
+
+To build the website run the following commands from within the 
_./cassandra-site_ directory (assuming you used the above checkout commands):
+
+```bash
+$ docker-compose build cassandra-website
+$ docker-compose run cassandra-website
+```
+
+Go make yourself a cup of coffee, this will take a while...
+
+Once building has completed, the site content will be in the 
_./cassandra-site/publish_ directory ready to be committed.
+
+
+Previewing the site
+-------------------
+
+If you want to preview the site as you are editing it run this command:
+
+```bash
+$ docker-compose build cassandra-website
+$ docker-compose up cassandra-website-serve
+```
+
+For information about the site layout see the **Layout** section of 
[README](src/README#layout) in the _src_ directory.
\ No newline at end of file

Added: cassandra/site/docker-compose.yml
URL: 
http://svn.apache.org/viewvc/cassandra/site/docker-compose.yml?rev=1855094&view=auto
==============================================================================
--- cassandra/site/docker-compose.yml (added)
+++ cassandra/site/docker-compose.yml Sat Mar  9 07:10:27 2019
@@ -0,0 +1,20 @@
+version: '2.4'
+
+services:
+  cassandra-website:
+    build: .
+    image: cassandra-website:latest
+    volumes:
+      - ./src:/usr/src/cassandra-site/src
+      - ./publish:/usr/src/cassandra-site/publish
+
+  cassandra-website-serve:
+    build: .
+    image: cassandra-website:latest
+    entrypoint: /docker-entrypoint-jekyll-serve.sh
+    ports:
+      - 4000:4000
+    volumes:
+      - ./src:/usr/src/cassandra-site/src
+      - ./publish:/usr/src/cassandra-site/publish
+      - ./docker-entrypoint-jekyll-serve.sh:/docker-entrypoint-jekyll-serve.sh
\ No newline at end of file

Added: cassandra/site/docker-entrypoint-jekyll-serve.sh
URL: 
http://svn.apache.org/viewvc/cassandra/site/docker-entrypoint-jekyll-serve.sh?rev=1855094&view=auto
==============================================================================
--- cassandra/site/docker-entrypoint-jekyll-serve.sh (added)
+++ cassandra/site/docker-entrypoint-jekyll-serve.sh Sat Mar  9 07:10:27 2019
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+set -e
+
+GREEN='\033[1;32m'
+YELLOW='\033[0;33m'
+NC='\033[0m' # No Color
+
+# Run a process in the background to correct the resource paths for the 
landing pages of each
+# version in the publish directory
+while [ 1 ]
+do
+    sed -i 's/\.\/\.\.\//\.\/\.\.\/\.\.\//g' 
/usr/src/cassandra-site/publish/doc/*/index.html
+    sleep 5
+done &
+
+cd /usr/src/cassandra-site/src
+
+JEKYLL_COMMAND="jekyll serve --host 0.0.0.0"
+
+echo
+echo "   Starting Jekyll: ${JEKYLL_COMMAND}"
+echo "------------------------------------------------"
+echo -e "${GREEN}      Site Address: http://127.0.0.1:4000/${NC}";
+echo "------------------------------------------------"
+
+${JEKYLL_COMMAND}
\ No newline at end of file

Propchange: cassandra/site/docker-entrypoint-jekyll-serve.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: cassandra/site/docker-entrypoint.sh
URL: 
http://svn.apache.org/viewvc/cassandra/site/docker-entrypoint.sh?rev=1855094&view=auto
==============================================================================
--- cassandra/site/docker-entrypoint.sh (added)
+++ cassandra/site/docker-entrypoint.sh Sat Mar  9 07:10:27 2019
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+
+set -xe
+
+export CASSANDRA_SITE_DIR="/usr/src/cassandra-site"
+
+jekyll --version
+
+# Make sure we have the latest commit of Cassandra trunk
+cd ${CASSANDRA_DIR}
+git checkout trunk
+git pull --rebase --prune
+
+# Now make the docs for the latest version
+cd ${CASSANDRA_SITE_DIR}/src
+make add-latest-doc
+
+
+# Make sure we have the latest commit of Cassandra 3.11
+pushd ${CASSANDRA_DIR}
+ant realclean
+git checkout cassandra-3.11
+git pull --rebase --prune
+popd
+
+# Now make the docs for 3.11
+make .build-doc
+
+# Relink the 3.11 version
+LATEST_VERSION=$(basename $(find ./doc -iname 3.11* -type d | head -n 1))
+rm -f doc/3.11
+ln -s -f ${LATEST_VERSION} doc/3.11
+
+make build
+
+
+# Generate the rest of the site
+make
+
+# Fix the links in the resource paths for the landing pages of each version in 
the publish directory
+cd ${CASSANDRA_SITE_DIR}
+sed -i 's/\.\/\.\.\//\.\/\.\.\/\.\.\//g' ./publish/doc/*/index.html
\ No newline at end of file

Propchange: cassandra/site/docker-entrypoint.sh
------------------------------------------------------------------------------
    svn:executable = *



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to