Repository: mesos
Updated Branches:
  refs/heads/master cdb90b91c -> 8734511fd


Updated local development workflow of mesos website.

Made the layout and scripts consistent with CI based automatic
publishing of the website.

Review: https://reviews.apache.org/r/60440


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8734511f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8734511f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8734511f

Branch: refs/heads/master
Commit: 8734511fd4e21d6c50d6bb11832c86451322da7d
Parents: 23541ef
Author: Vinod Kone <vinodk...@gmail.com>
Authored: Thu Jun 22 11:05:51 2017 +0800
Committer: Vinod Kone <vinodk...@gmail.com>
Committed: Fri Aug 4 12:01:35 2017 -0700

----------------------------------------------------------------------
 site/Dockerfile           |  2 +-
 site/README.md            | 52 ++++++++----------------------------------
 site/build.sh             |  2 +-
 site/entrypoint.sh        | 33 +++++++++++++++++++++++++++
 site/mesos-website-dev.sh | 45 ++++++++++++++++++++++++++++++++++++
 5 files changed, 90 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8734511f/site/Dockerfile
----------------------------------------------------------------------
diff --git a/site/Dockerfile b/site/Dockerfile
index 230cfc7..2dd9e28 100644
--- a/site/Dockerfile
+++ b/site/Dockerfile
@@ -13,4 +13,4 @@ EXPOSE 4567
 EXPOSE 35729
 
 WORKDIR /mesos/site
-CMD bash build.sh
+CMD bash entrypoint.sh

http://git-wip-us.apache.org/repos/asf/mesos/blob/8734511f/site/README.md
----------------------------------------------------------------------
diff --git a/site/README.md b/site/README.md
index ebd3e6a..0a5cd61 100644
--- a/site/README.md
+++ b/site/README.md
@@ -1,51 +1,22 @@
 # Apache Mesos website generator
-This will generate the site available at http://mesos.apache.org. We use docker
+This will generate the Mesos website locally. We use docker
 to simplify our generation and development workflows.
 
-
-## Build the docker image
-
-Under the root of your local Mesos git repository, run the following command
-to build the docker image.
-
-```
-docker build -t mesos/website site
-```
-
 ## Generating the site
 
-Before we start the docker container, we need to generate the help endpoint
-documentation. Running `make` is needed to generate the latest version of
-the master and agent binaries.
+Before we generate the website, please make sure to generate the help endpoint
+documentation. The endpoint generation script expects Mesos master and agent
+binaries to be available; so please run `make` if necessary.
 
 ```
 make -jN
 ../support/generate-endpoint-help.py
 ```
 
-To build and run the website inside a docker container please substitute
-*<path-to-mesos-source>* with the actual location of Mesos source code tree
-and *<path-to-mesos-website-svn-source>* with the actual location of Mesos
-website svn source code tree in the command below and run it.
+To generate the website:
 
 ```
-sudo docker run -it --rm \
-    -p 4567:4567 \
-    -p 35729:35729 \
-    -v <path-to-mesos-source>:/mesos \
-    -v <path-to-mesos-website-svn-source>/publish:/mesos/site/publish \
-    mesos/website
-```
-
-If you don't intend to update the svn source code of the Mesos website, you
-could run the command below under the root of Mesos source code instead.
-
-```
-sudo docker run -it --rm \
-    -p 4567:4567 \
-    -p 35729:35729 \
-    -v `pwd`:/mesos \
-    mesos/website
+./site/mesos-websiste-dev.sh
 ```
 
 This will start a container, generate the website from your local Mesos git
@@ -75,10 +46,7 @@ destroy/remove the container.
 
 ## Publishing the Site
 
-Because we mount the `publish` folder under Mesos website svn source code into
-the docker container we launched above, all website contents would be ready
-under the `publish` folder when the generation finishes.
-
-The website uses svnpubsub. The `publish` folder contains the websites content
-and when committed to the svn repository it will be automatically deployed to
-the live site.
+Developers are not expected to publish the website. There is a CI job on ASF
+Jenkins (Mesos-Websitebot) that automatically publishes the website when there
+are changes detected in the Mesos repository. See
+`support/jenkins/websitebot.sh` for details.

http://git-wip-us.apache.org/repos/asf/mesos/blob/8734511f/site/build.sh
----------------------------------------------------------------------
diff --git a/site/build.sh b/site/build.sh
index 06b1b32..bfb9274 100755
--- a/site/build.sh
+++ b/site/build.sh
@@ -25,4 +25,4 @@ function exit_hook {
 
 trap exit_hook EXIT
 
-bundle install && bundle exec rake && bundle exec rake dev
+bundle exec rake && bundle exec rake dev

http://git-wip-us.apache.org/repos/asf/mesos/blob/8734511f/site/entrypoint.sh
----------------------------------------------------------------------
diff --git a/site/entrypoint.sh b/site/entrypoint.sh
new file mode 100755
index 0000000..f30c911
--- /dev/null
+++ b/site/entrypoint.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env 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.
+
+# This is a wrapper script for building Mesos website as a non-root user.
+set -e
+set -o pipefail
+
+# This needs to be run under `root` user for `bundle exec rake` to
+# work properly. See MESOS-7859.
+bundle install
+
+# We do not create a temp user for MacOS because the host volumes are always
+# mapped to UID 1000 and GID 1000 inside the container. And any writes by the
+# root user inside the container to the mounted host volume will end up with
+# the original UID and GID of the host user.
+# TODO(vinod): On Linux, create a temp user and run the below script as that
+# user to avoid doing any writes as root user on host volumes.
+/mesos/site/build.sh

http://git-wip-us.apache.org/repos/asf/mesos/blob/8734511f/site/mesos-website-dev.sh
----------------------------------------------------------------------
diff --git a/site/mesos-website-dev.sh b/site/mesos-website-dev.sh
new file mode 100755
index 0000000..2be99db
--- /dev/null
+++ b/site/mesos-website-dev.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env 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.
+
+# This is a wrapper for building Mesos website locally.
+# TODO(vinod): Simplify the development workflow by getting rid of `docker`
+# or consolidating with the publish workflow in `support/mesos-website.sh`.
+# See MESOS-7860 for details.
+
+set -e
+set -o pipefail
+
+MESOS_DIR=$(git rev-parse --show-toplevel)
+
+pushd "$MESOS_DIR"
+
+TAG=mesos/website-`date +%s`-$RANDOM
+
+docker build -t $TAG site
+
+trap 'docker rmi $TAG' EXIT
+
+docker run \
+  -it \
+  --rm \
+  -p 4567:4567 \
+  -p 35729:35729 \
+  -v $MESOS_DIR:/mesos:Z \
+  $TAG
+
+popd # $MESOS_DIR

Reply via email to