From 599f3aee80b9101e487b61c967c748effe2380c9 Mon Sep 17 00:00:00 2001 From: Emmanuel Bernard Date: Wed, 2 Sep 2015 19:23:48 +0200 Subject: [PATCH 1/3] Fix Teiid typo --- references.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/references.html.haml b/references.html.haml index c9696e3f86..3e0479c0ce 100644 --- a/references.html.haml +++ b/references.html.haml @@ -21,7 +21,7 @@ title: References Hibernate ORM has a second-level cache provider built on top of Infinispan %a(name="teiid") -%h3 Teeid +%h3 Teiid %p %a(href="http://teiid.org") http://teiid.org %p From 94e8ad3f3c8a08448758bd307b9c321f8fbc6658 Mon Sep 17 00:00:00 2001 From: Emmanuel Bernard Date: Wed, 2 Sep 2015 19:25:09 +0200 Subject: [PATCH 2/3] Add to .gitignore directories generated by rake setup[local] --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index f26e7c7132..01aaf1e546 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,8 @@ _site ## Ruby tools .rvmrc +.bundle +_bin ## Infinispan sources and docs infinispan_srcs From b1bcae21bca50e41cc4d768255fd855d506b3e4e Mon Sep 17 00:00:00 2001 From: Emmanuel Bernard Date: Thu, 3 Sep 2015 14:50:40 +0200 Subject: [PATCH 3/3] Add a Dockerfile and instruction to run the website build via docker --- bin/docker/Dockerfile | 37 ++++++++++++ bin/docker/README.adoc | 134 +++++++++++++++++++++++++++++++++++++++++ bin/run_docker.sh | 16 +++++ 3 files changed, 187 insertions(+) create mode 100644 bin/docker/Dockerfile create mode 100644 bin/docker/README.adoc create mode 100755 bin/run_docker.sh diff --git a/bin/docker/Dockerfile b/bin/docker/Dockerfile new file mode 100644 index 0000000000..761514a442 --- /dev/null +++ b/bin/docker/Dockerfile @@ -0,0 +1,37 @@ +FROM fedora:22 + +# install the required dependencies to compile native extensions +# and needed by the website to fetch resources +RUN dnf -y install gcc-c++ make ruby-devel libxml2-devel libxslt-devel findutils git ruby wget + +RUN groupadd -r dev && useradd -g dev -u 1000 dev && mkdir -p /home/dev && chown dev:dev /home/dev + +# From here we run everything as dev user +USER dev + +# Setup all the env variables needed for ruby +ENV HOME /home/dev +ENV GEM_HOME $HOME/.gems +ENV GEM_PATH $HOME/.gems +ENV PATH $PATH:$GEM_HOME/bin +ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +RUN mkdir $HOME/.gems + +# Install Rake and Bundler for driving the Awestruct build & site +RUN gem install -N rake bundler + +# Clone infinispan.github.io in order to run the setup task +RUN git clone https://github.com/infinispan/infinispan.github.io.git $HOME/infinispan.github.io +RUN cd $HOME/infinispan.github.io && git checkout develop && rake setup + +# We need to patch awestruct to make auto generation work. On mounted volumes file +# change montoring will only work with polling +RUN gem contents awestruct | grep auto.rb | xargs sed -i "s/^\(.*force_polling =\).*/\1 true/" + +EXPOSE 4242 +VOLUME $HOME/infinispan.github.io +WORKDIR $HOME/infinispan.github.io + +CMD [ "/bin/bash" ] + diff --git a/bin/docker/README.adoc b/bin/docker/README.adoc new file mode 100644 index 0000000000..d13e46d233 --- /dev/null +++ b/bin/docker/README.adoc @@ -0,0 +1,134 @@ += Running infinispan.github.io within Docker + +The following instructions allow you to run infinispan.github.io within +a docker container while still being able to edit your sources locally. +This is not a Docker introduction. At least you will need a running +Docker daemon. If you want an intro into Docker - link:http://docs.docker.com/[start here]. + +== The short version + +The short version. If you are lucky all you need is: + +[source] +---- +# from the repository root +> cd bin/docker +> docker build -t infinispan/infinispan.github.io . +> cd ../.. +> ./bin/run_docker.sh +---- + +Once you have a bash into the running container you can use the various Rake task to +drive awestruct and in particular `rake clean preview` + +[TIP] +==== +The first time you use the Docker approach make sure that you don't have any changes +in your local checkout of infinispan.github.io, in particular temp files generated by +Bundler. You can for example run `git clean -fxd`, but make sure you have no +outstanding changes. +==== + +[TIP] +==== +On Linux you might need to use _sudo_ to execute docker commands. If you want to +avoid that have a look at link:https://docs.docker.com/installation/ubuntulinux/#create-a-docker-group[create a docker group]. +==== + +[NOTE] +==== +`run_docker.sh` tries to determine the full path to the root directory of your +infinispan.github.io checkout. It assumes you are either at the root of the repo +or in the bin directory when you execute it. +You can look at the script to run this command from anywhere. +==== + +== The long version + +=== Building the Docker image + +First step is to build the Docker image containing your awestruct setup. +This step could eventually be replaced by a automatically build image made +available via a Docker repository. For now, however, we build this image locally. + +[source] +---- +> docker build --no-cache=true -t infinispan/infinispan.github.io +---- + +Whenever the gem dependencies change, you will need to rebuild the image to make sure +you get a working environment out of the box. + +Below you see the used Dockerfile with some comments: + +[source] +.Dockerfile for Awestruct setup based on Fedora 22 +---- +FROM fedora:22 + +# install the required dependencies to compile native extensions +# and needed by the website to fetch resources +RUN dnf -y install gcc-c++ make ruby-devel libxml2-devel libxslt-devel findutils git ruby wget // <1> + +RUN groupadd -r dev && useradd -g dev -u 1000 dev && mkdir -p /home/dev && chown dev:dev /home/dev // <2> + +# From here we run everything as dev user +USER dev + +# Setup all the env variables needed for ruby +ENV HOME /home/dev +ENV GEM_HOME $HOME/.gems +ENV GEM_PATH $HOME/.gems +ENV PATH $PATH:$GEM_HOME/bin +ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +RUN mkdir $HOME/.gems + +# Install Rake and Bundler for driving the Awestruct build & site +RUN gem install -N rake bundler + +# Clone infinispan.github.io in order to run the setup task +RUN git clone https://github.com/infinispan/infinispan.github.io.git // <3> +RUN cd $HOME/infinispan.github.io && git checkout develop && rake setup + +# We need to patch awestruct to make auto generation work. On mounted volumes file +# change montoring will only work with polling +RUN gem contents awestruct | grep auto.rb | xargs sed -i "s/^\(.*force_polling =\).*/\1 true/" // <4> + +EXPOSE 4242 +VOLUME $HOME/infinispan.github.io +WORKDIR $HOME/infinispan.github.io + +CMD [ "/bin/bash" ] +---- +<1> Install all dependencies, especially the ones needed to compile native +extensions. After changes to the gem dependencies this might need to be updated. +Otherwise we rely on the default ruby version available via _dnf_. +<2> In order for the container to be able to modify files in your mounted volume, +we need to make sure that the created _dev_ user gets the same user id as the files +have on the host machine. In many cases 1000 is a good guess, but in case you are +getting file permission errors when running `rake preview` you want to check which +user id the files have when mounted into the container. Use this user id as part of +the `useradd` command and re-build the image. +<3> We need the checkout to setup the awestruct environment. At runtime the checkout +will be overridden by the mounted volume +<4> An awestruct hack. Awestruct uses live-reload to determine file changes in order +to trigger re-generation of pages. live-reload allows to configure how changes are +detected, but awestruct does not expose this option. When mounting your checkout as +a volume, the default detection fails (at least on Mac using docker-machine) and polling +needs to be used. This sed command will patch the awestruct version we use. Obviously +this is very fragile to changes in awestruct version + +=== Running the container + +Once you have your image you can run the docker container and use it to drive your +awestruct site. The site can be previewed under http://localhost:4242 on Linux or +http://:4242 with docker-machine, where _docker-ip_ can be retrieved via +`boot2docker ls`. + +[source] +---- +> ./bin/run_docker.sh +---- + + diff --git a/bin/run_docker.sh b/bin/run_docker.sh new file mode 100755 index 0000000000..0668752d8d --- /dev/null +++ b/bin/run_docker.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# can be run form the Git repo root dir or from the repo_dir/bin directory +# author Emmanuel Bernard + +# Little dance to guess if we are in the root of the repo or not +PWD="`pwd`" +DIRNAME="`dirname $PWD`" +if [[ "$DIRNAME/bin" == "$PWD" ]]; +then + ROOT_DIR="`pwd | xargs dirname`" +else + ROOT_DIR="`pwd`" +fi +echo $ROOT_DIR + +docker run -t -i -p 4242:4242 -v $ROOT_DIR:/home/dev/infinispan.github.io infinispan/infinispan.github.io