Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update for start-preview.sh

We are providing This page provides a step-by-step guidance to setup the Kafka site as your local apache serverguide to set up the contents of the Kafka website (https://kafka.apache.org/) as your local Apache HTTP Server's homepage. This could be is useful when you are contributing doc documentation changes, and would like to have a easy way of displaying and debugging your modified website. The guidance itself is based on OSXfor which you need verify that any modified pages of yours still display and render correctly. Note that the start-preview.sh script does what is described here within a Docker container: Most people will find start-preview.sh easier and more convenient than following this guide. This guide is based on macOS, but should be easily adopted for other operating systems like Linux/Unix OS as well. 

...

Table of Contents

Table of Contents

...

1.

...

 Start the Apache HTTPD service

On macOS, the Apache HTTP

 

In OSX, Apache Http Service should be installed but disabled by default. To validate it, you can check if command "apachectl" exists or not:You can start the webserver with the command:

Code Block
languagebash
titleStart the webserver
$ 
Code Block
sudo apachectl start

 

(If Apache Web HTTP Service is not installed, follow this page to download and install it.

 

And then on your browser, see if

Code Block
localhost

 

renders successfully or not. For example, by default it will load the page defined in

...

)

Now, verify your local HTTPD installation by accessing its default web page: In your browser, visit http://localhost to verify that the homepage renders successfully. By default, you should see the text "It Works!" from /Library/WebServer/Documents/index.html.en

...

 

And you should see "It Worked!" text. 

2. Make

...

sure you have a local fork of the kafka-site git repository

Make sure you have cloned your forked kafka-site git repo (e.g. https://github.com/guozhang/kafka-site) from the apache official Apache git repo (https://github.com/apache/kafka-site) in your local directory, and then . Then add the apache git repot as an additional remote repo.

For example, after these steps your local repo should look likesimilar to:

Code Block
languagebash
titleVerify your local fork
$ pwdguozhang @kafka-site: pwd

/Users/guozhang/Workspacegit/github/guozhangwang/kafka-site 


guozhang @kafka-site:$ git remote -v

apache	https://github.com/apache/kafka-site.git (fetch)

apache	https://github.com/apache/kafka-site.git (push)

origin	https://github.com/guozhangwang/kafka-site.git (fetch)

origin	https://github.com/guozhangwang/kafka-site.git (push)


guozhang @kafka-site:$ git checkout asf-site
 
guozhang$ @kafka-site: git branch

* asf-site


3. Modify the Apache

...

HTTPD configuration to point to your local fork

Now you need to find edit the Apache Http Service HTTPD config file and start editing on it. The config file could be found as (depending on your OS type and version)make the following changes.

Code Block
languagebash
titleEdit the webserver configuration
# The location of the configuration file may vary depending on the OS.
$ 
Code Block
sudo vim /etc/apache2/httpd.conf

...

And make the following changes on this file:

 


Step 1. Uncomment : Uncomment the following two lines . This is to enable loading so the "mod_include" and "mod_rewrite" modules are loaded on server startup.

Code Block
LoadModule include_module libexec/apache2/mod_include.so
...
LoadModule rewrite_module libexec/apache2/mod_rewrite.so

...


Step 2.: Change "DocumentRoot" and "Directory" to your  and Directory to point to the local clone of your forked kafka-site repo directory ; and (e.g., "/Users/guozhang/git/kafka-site"). Also, change AllowOverride from "None" to "All". The three changed lines are marked below.

Code Block
# File: /etc/apache2/httpd.conf
#
# DocumentRoot: The directory out of which you will serve your

# documents. By default, all requests are taken from this directory, but

# symbolic links and aliases may be used to point to other locations.

#

DocumentRoot "/Users/guozhang/Workspace/github/guozhangwanggit/kafka-site"

             # <<< THIS LINE IS CHANGED
<Directory "/Users/guozhang/Workspace/github/guozhangwanggit/kafka-site">

              # <<< THIS LINE IS CHANGED

    # Possible values for the Options directive are "None", "All",

    # or any combination of:

    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #

    # Note that "MultiViews" must be named *explicitly* --- "Options All"

    # doesn't give it to you.

    #

    # The Options directive is both complicated and important.  Please see

    # http://httpd.apache.org/docs/2.4/mod/core.html#options

    # for more information.

    #

    Options FollowSymLinks Multiviews

    MultiviewsMatch Any




    #

    # AllowOverride controls what directives may be placed in .htaccess files.

    # It can be "All", "None", or any combination of the keywords:

    #   AllowOverride FileInfo AuthConfig Limit

    #

    AllowOverride All




                                     # <<< THIS LINE IS CHANGED

    # Controls who can get stuff from this server.

    #

    Require all granted

</Directory>

...

 

 


4. Reload the Apache

...

 

HTTPD configuration

Restart the webserver to make the config changes take effectNow simply restarting the Http web service:

Code Block
languagebash
titleRestart the webserver
$ sudo apachectl restart

# If the command above does not work (and you still see the default "It works!" page), try the following variant.
$ sudo apachectl -k restart

 

And refreshing on your browser should then show up the complete Kafka site.

Code Block
localhost

 In your browser, visit http://localhost/ again and refresh the page (Cmd+R on macOS). You should then see the complete Apache Kafka website, rendered from your local fork.

From now on, when editing on whenever you edited files in your local kafka-site git repofork, you should normally only need to refresh our browser (Cmd+R).  If this is not sufficient, you can simply repeat this step and see how the changes will be displayed now. NOTE that your doc the step above to restart the webserver.

Info

Important Note: Your documentation changes should most likely be made in the

...

main Apache Kafka code repository (https://github.com/apache/kafka) instead of the kafka-site

...

repository, and in order to

...

publish these changes to the Apache Kafka website (https://kafka.apache.org/) you should copy the modified

...

documentation to the kafka-site

...

repository into the

...

respective release folders.

5. Shutdown the Apache HTTPD service

If you want to shutdown the web server, run the command:

Code Block
languagebash
titleStop the webserver
$ sudo apachectl stop

# If the command above does not work (and the webserver is still running), try the following variant.
$ sudo apachectl -k stop