Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Initialize documentation #210

Merged
merged 1 commit into from
Jul 5, 2024
Merged

doc: Initialize documentation #210

merged 1 commit into from
Jul 5, 2024

Conversation

oxzi
Copy link
Member

@oxzi oxzi commented Jun 3, 2024

Both structure and huge parts are copied from Icinga DB and were altered afterwards. The already existing Channel Plugin documentation was extended.

@oxzi oxzi requested review from julianbrost and yhabteab June 3, 2024 07:56
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Jun 3, 2024
@oxzi
Copy link
Member Author

oxzi commented Jun 14, 2024

To build the docs, please refer to this PR: Icinga/icinga-docs-tools#9

Copy link
Collaborator

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where will be documented how to connect the daemon to Icinga 2? Do you see this as part of the Notifications Web documentation as that provides the config form? Even if that will be the case, a hint on this somewhere might be nice.

doc/02-Installation.md.d/From-Source.md Outdated Show resolved Hide resolved
config.example.yml Outdated Show resolved Hide resolved
doc/02-Installation.md Outdated Show resolved Hide resolved
doc/02-Installation.md Outdated Show resolved Hide resolved
doc/02-Installation.md Outdated Show resolved Hide resolved
doc/03-Configuration.md Outdated Show resolved Hide resolved
doc/03-Configuration.md Outdated Show resolved Hide resolved
@julianbrost julianbrost mentioned this pull request Jun 19, 2024
@oxzi oxzi force-pushed the docs-init branch 5 times, most recently from d0aaedc to 46a017d Compare June 25, 2024 14:06
@oxzi oxzi requested a review from julianbrost June 25, 2024 14:07
doc/01-About.md Outdated Show resolved Hide resolved
@oxzi
Copy link
Member Author

oxzi commented Jun 26, 2024

I have made some changes inspired by @ncosta-ic's similar PR over there in web world, Icinga/icinga-notifications-web#218.

doc/02-Installation.md.d/From-Source.md Outdated Show resolved Hide resolved
doc/01-About.md Outdated Show resolved Hide resolved
doc/02-Installation.md Outdated Show resolved Hide resolved
doc/03-Configuration.md Outdated Show resolved Hide resolved
doc/03-Configuration.md Outdated Show resolved Hide resolved
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This note is not related to this file in particular, I just wanted to create a thread and don't know another way to do this here.)

I am a bit unhappy with the numbering of the markdown files by their filename. This layout was copied from the other Icinga documentations and I would expect a certain degree of similarity between the projects.

However, this layout enforces a ordering by the names from the beginning, which is hard to change later, as it will break links, resulting in dead URLs. For example, in Icinga DB I once wanted to add a new section between two already existing ones, but there is no real possibility to add something in between1.

It would be possible to leave greater gaps, but this would also look weird. I would like to hear your comment on this, @julianbrost. Thanks :)

Footnotes

  1. Except of hacks like naming something 03-01-Foo.md if it should go between 03-Configuration.md and 04-Upgrading.md.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This layout was copied from the other Icinga documentations and I would expect a certain degree of similarity between the projects.

If we would consider breaking our own conventions, we could manually populate MKDocs' nav and don't prefix files with numbers. This, however, would also require patching the build-docs.rb script.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I never thought about this. But indeed, it doesn't really make sense to me that the URL for example is https://icinga.com/docs/icinga-2/latest/doc/14-features/ instead of just https://icinga.com/docs/icinga-2/latest/doc/features/.

we could manually populate MKDocs' nav and don't prefix files with numbers. This, however, would also require patching the build-docs.rb script.

I'm not familiar with MKDocs either, so I don't know what its nav is, but it doesn't sound wrong to me.

By the way, leaving gaps wouldn't be unheard of, see https://github.com/Icinga/icingaweb2-module-director/tree/master/doc and https://github.com/Icinga/icinga-powershell-framework/tree/master/doc for example.

Copy link
Member

@ncosta-ic ncosta-ic Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, proper permalinks regardless of the given file name, would be really handy. There's a whole discussion about it over at squidfunk/mkdocs-material#3758

The whole build-docs.rb wrapper is pretty hacky alltogether and even destroyed my local git repository because of the wonderful rm -rf instruction contained in it...
A better solution would be to rewrite our existing build-docs.rb functionality into a Python hook1.
We could also include our own solution to the url problem by doing so.
I would be up for that task as I have a lot of experience with Python - if we were to decide to go for such a change.

Footnotes

  1. https://www.mkdocs.org/user-guide/configuration/#hooks

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for improving things there if you've looked into it already and have ideas how to do it better. But sounds something to better track in central place rather than here. If we change something, that would affect most projects anyways. Also, this shouldn't block anything here, the only question is whether you want to add gaps in the numbers for the moment.

By the way, keeping URLs working with a change in that direction should be simple by redirecting NNN-foobar to foobar.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the moment, I added some gaps between the numbering of the later sections as one might expect something to pop up there.

After some potential future change, a simple RewriteRule ^/doc/([a-z0-9-]+)/[0-9]+-(.*) /doc/$1/$2 [R]1 should do, as @julianbrost also suggested.

Footnotes

  1. Untested, of course 🙃

@oxzi oxzi force-pushed the docs-init branch 2 times, most recently from 75e028b to e738788 Compare June 27, 2024 07:04
'http://localhost:5680/process-event'
```

## Debugging Endpoints
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#223 would change the following URLs. However, this isn't a blocker as a subsequent PR can update this.

doc/30-Development.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
doc/10-Channels.md Outdated Show resolved Hide resolved
doc/20-HTTP-API.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
doc/02-Installation.md Outdated Show resolved Hide resolved
doc/20-HTTP-API.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, fine for me now. (To be fair, I didn't cross check with the web documentation for possible duplicates, but I wouldn't expect any of what's in here to be duplicated apart from the about page where it's to be expected.)

Just that one obvious thing, but better have it as an unresolved conversation than accepting and forgetting it:

doc/01-About.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
doc/01-About.md Outdated Show resolved Hide resolved
doc/03-Configuration.md Outdated Show resolved Hide resolved
doc/03-Configuration.md Outdated Show resolved Hide resolved
julianbrost
julianbrost previously approved these changes Jul 5, 2024
@oxzi
Copy link
Member Author

oxzi commented Jul 5, 2024

Sorry, while testing the packages together with the docs, I found this faulty username.

doc/01-About.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
Both structure and huge parts are copied from Icinga DB and were altered
afterwards. The already existing Channel Plugin documentation was
extended.
@oxzi
Copy link
Member Author

oxzi commented Jul 5, 2024

Next to @nilmerg's comments, I have added a sentence to the Big Picture section mentioning other possible sources, as otherwise the text mismatched the image. Furthermore, I have changed the default PostgreSQL credentials in the example configuration to those of the documentation.

@oxzi oxzi requested a review from nilmerg July 5, 2024 07:28
Copy link
Member

@yhabteab yhabteab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks perfect TM.

@julianbrost julianbrost merged commit d3001e8 into main Jul 5, 2024
12 checks passed
@julianbrost julianbrost deleted the docs-init branch July 5, 2024 13:27
@ncosta-ic
Copy link
Member

This PR got merged while containing a faulty link.

While a relative link to the LICENSE file works fine for the README.md, it doesn't work for MKDocs (in this case 01-About.md) as it references a file outside of its directory and that file does not get included into the HTML output.
This results in a broken link when building it through our Docker image and will thus also fail once added to icinga.com/docs.

icinga-notifications-docs-bug.webm

@oxzi
Copy link
Member Author

oxzi commented Jul 8, 2024

This PR got merged while containing a faulty link.

While a relative link to the LICENSE file works fine for the README.md, it doesn't work for MKDocs (in this case 01-About.md) as it references a file outside of its directory and that file does not get included into the HTML output. This results in a broken link when building it through our Docker image and will thus also fail once added to icinga.com/docs.

Are you sure? The same happens in other documentations as well, e.g., for Icinga DB:

https://github.com/Icinga/icingadb/blob/6102d9cb2e30a628ceaf79cc4ba01db1ab50aa8f/doc/03-Configuration.md?plain=1#L4

On the rendered web documentation, the resulting page links to ../../config.example.yml. With its URL being https://icinga.com/docs/icinga-db/latest/doc/03-Configuration/, the destination1 still lies within the project's subdirectory.

However, I guess your point is still valid for the documentation's main page, as it might be accessed directly under https://icinga.com/docs/icinga-notifications/ and not …/icinga-notifications/doc/01-About/. Good catch though.

Footnotes

  1. https://icinga.com/docs/icinga-db/latest/doc/03-Configuration/../../config.example.yml = https://icinga.com/docs/icinga-db/latest/config.example.yml

oxzi added a commit that referenced this pull request Jul 8, 2024
First, relative links outside the `doc` directory are possible and work.
However, the main page can be accessed via `…/` or `…/doc/01-About.md`.
While a relative link works for the second, it breaks for the first.

For the docs, this link now points to the LICENSE file on GitHub.

Reported-by: Noé Costa <#210 (comment)>
@ncosta-ic
Copy link
Member

Are you sure? The same happens in other documentations as well, e.g., for Icinga DB
...
However, I guess your point is still valid for the documentation's main page, as it might be accessed directly under https://icinga.com/docs/icinga-notifications/ and not …/icinga-notifications/doc/01-About/. Good catch though.

That's correct. And yes, I was wrong about the includes.
I blindly checked my Nginx logs instead of just going through the generated html folder.
It actually ships the whole git repository and any relative links should work.

The second problem where a user could access the 01-About.md directly under .../latest and not through .../doc/01-About still results in a broken link.
But you noticed that as well. Just wanted to clarify my thought process.

julianbrost pushed a commit that referenced this pull request Jul 10, 2024
First, relative links outside the `doc` directory are possible and work.
However, the main page can be accessed via `…/` or `…/doc/01-About.md`.
While a relative link works for the second, it breaks for the first.

For the docs, this link now points to the LICENSE file on GitHub.

Reported-by: Noé Costa <#210 (comment)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants