kafka-site icon indicating copy to clipboard operation
kafka-site copied to clipboard

KAFKA-13882 Docker to preview docs locally

Open qingwei91 opened this issue 2 years ago • 5 comments

I've added a Dockerfile and handy script to run documentation locally with 1 command.

It should reduce friction for docs contribution.

qingwei91 avatar May 12 '22 11:05 qingwei91

I dont think we can do the same on https://github.com/apache/kafka/ itself, please correct me if I'm wrong

qingwei91 avatar May 12 '22 11:05 qingwei91

When I run this locally, I can only access pages under Docs, for anything else I get 404.

Is it expected? I would be nice to preview the complete website.

mimaison avatar May 13 '22 14:05 mimaison

Woops, might be a regression, sorry, let me check, I will move this into draft in the mean time

I agree, it is better to make it work for the whole site

qingwei91 avatar May 13 '22 15:05 qingwei91

Hi @mimaison sorry for the back and forth, after some fiddling, I realize the problem is that when requesting localhost:8080/path, httpd tries to find a file namedpath, which does not exists, and what we really want is to resolve path to path.html in project root.

I solved this by adding a rewrite rule in .htaccess file, but I don't know how is it solved in the real website deployment, is .htaccess actually used in production?

qingwei91 avatar May 13 '22 16:05 qingwei91

Hi @mimaison , if you get a chance, can you review this again? I've addressed the issue you pointed out, thanks!

qingwei91 avatar May 18 '22 07:05 qingwei91

@mimaison -- seems this slipped. Can you help finishing it?

mjsax avatar Jan 24 '23 03:01 mjsax

@mjsax The reason I did not merge is because I don't understand why when testing locally we need changes to the .htaccess file that don't seem necessary on the website. See the few comments starting from https://github.com/apache/kafka-site/pull/410#issuecomment-1126118797. Do you have an idea why this may be the case?

mimaison avatar Jan 26 '23 17:01 mimaison

I just checkout the PR locally and it worked for me -- did you update your local copy after the latest changes?

mjsax avatar Mar 03 '23 21:03 mjsax

Hi @mjsax and @mimaison

After merging with master, I think the change in htaccess is no longer needed, I just tested it. I've removed them

qingwei91 avatar Mar 04 '23 13:03 qingwei91

In the meanwhile I redid the same exact same thing here :P https://github.com/lucasbru/kafka-site-docker

lucasbru avatar Mar 04 '23 15:03 lucasbru

@mjsax My point is that when testing locally without the .htaccess changes, all pages other than localhost:8080/documentation/ fail to load. For example http://localhost:8080/quickstart returns a 404.

I see that @qingwei91 removed the .htaccess changes in the last commit and I confirmed the issue happens again. I'm a bit scared of touching the .htaccess file as I don't want to break the real website.

mimaison avatar Mar 06 '23 17:03 mimaison

@mimaison , really sorry, I forgotten to check quick start. I've added it back now, guess I need to figure out why that's required here but not in the actual deployment ...

qingwei91 avatar Mar 06 '23 18:03 qingwei91

Hi @mimaison , another way I can think of is to avoid using .htaccess in the docker, and inject all config required in httpd.conf instead.

https://github.com/apache/kafka-site/pull/410/commits/4d7397f17d10e64d3fadf4e8722e492bdf131fba

I am not sure if this is better since we now have duplicated config

I also wonder if .htaccess is actually used in the actual deployment, as it requires modifying httpd.conf

qingwei91 avatar Mar 06 '23 22:03 qingwei91

Ah sorry. Seems I miss-understood your comment @mimaison. -- I am not an expert in this domain and don't know why we need the change to htaccess nor what the actually impact is... :(

mjsax avatar Mar 06 '23 23:03 mjsax

@mimaison are you happy with the latest changes which don't touch the .htaccess? While I think the duplication is not ideal, this change would make it easier docs contributors.

tombentley avatar Sep 26 '23 03:09 tombentley

Dropped by to request an update to https://cwiki.apache.org/confluence/display/KAFKA/Setup+Kafka+Website+on+Local+Apache+Server and https://cwiki.apache.org/confluence/display/KAFKA/Contributing+Website+Documentation+Changes (the latter is linked from https://kafka.apache.org/contributing.html ) after this PR is merged.

divijvaidya avatar Sep 26 '23 12:09 divijvaidya

@tombentley It would have been nice to understand the .htaccess inconsistency but the duplication is minor and this PR really simplifies testing the website so I'm happy to merge it.

@qingwei91 Can you integrate the change Tom suggested?

mimaison avatar Sep 27 '23 08:09 mimaison

Hi @mimaison , sure, I've incorporated the change. Would be nice to merge this if everything is ok

qingwei91 avatar Sep 27 '23 18:09 qingwei91

Thanks for the contribution @qingwei91!

@divijvaidya thanks, updated.

tombentley avatar Sep 27 '23 20:09 tombentley