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

Aquilon documentation improvements #244

Merged
merged 21 commits into from
Jun 6, 2018
Merged

Conversation

jouvin
Copy link
Contributor

@jouvin jouvin commented May 24, 2018

  • Configuration: add a section on how to do the actual configuration of a host with the template library
    • Includes typical content for the main site templates needed
  • Configuration tutorial reviewed and fixed after an actual execution!
  • Spelling mistakes fixed

Final content must be adjusted after #87 has been finalized


### Enabling the Template Library

A template library version is enabled in the context of an archetype, using `archetype/loadpath.pan`
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't currently work in any released version of aq code. I think it would be better to document one of the workarounds I describe, e.g. creating a plenary/pan/units.pan or template-king/pan/units.pan that does include archetype/loadpath rather than documenting something that cannot work without applying a patch we are not keen on merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ned21 I discussed this issue with @urbonegi. There is no workaround possible without hacking things... The easiest is to merge the PR solving this properly (quattor/aquilon#87 (comment)). This PR is currently under review and I really hope that MS will agree the last version as it doesn't change anything for MS... The idea is that this doc will be announced once all the pending PRs are merged... In the meantime it is not worst than what existed before (and was basically unusable without the help of experts!).

Copy link
Contributor

@ned21 ned21 May 26, 2018

Choose a reason for hiding this comment

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

You could describe using pan/units.pan from either template-king or plenary as a hack but it's a simple and straight-forward one that's easy to follow and can be explained with a one line comment. So I think it's a workaround rather than a hack. The complexity of the broker changes you propose is much much higher and will carry a considerable code maintenance cost.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ned21 honnestly, I cannot buy that. This is not more complex that what MS implemented with the include_pan option as an attempt to solve the template library problem. Just a few additional lines and one option that could be used for everything specific needed by the template library. I don't want to describe a hack, I want the broker to do as many things as possible for me!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we managed to converge... see quattor/aquilon#86


### Defining the site global variables

It is a good practice to declare the main site variables in one template so that it is easy
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not put these directly into archetype/base.pan rather than a separate file? That gives archetype/base more purpose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because these variable are typically things that you want to share between archetypes! I think this is explained, I'll check.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, I see - site is a top level directory. That makes sense, thanks for clarifying.

(the example is for the a repository called `el7x_x86_64`:

```pan
structure template site/repository/snapshot/el7x_x86_64;
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, we keep these inside os/$osname/$osversion rather than using a site/ directory as it keeps them with the other OS config. Not sure if its helpful for us to try and converge practices or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the template library, we tend to use a separate namespace for all the repositories, OS or not... At some point, this is a detail, just need to be consistent. I think this way is more inline with the template library/SCDB way and may be more familiar....

include 'config/core/base';
```

This template is calling a template independant of the particular OS name and version to
Copy link
Contributor

Choose a reason for hiding this comment

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

independant => independent

@jouvin jouvin force-pushed the aquilon_doc branch 2 times, most recently from c72ba1d to 623abd6 Compare May 26, 2018 20:00
@jouvin jouvin changed the title [WIP] Aquilon documentation improvements Aquilon documentation improvements May 26, 2018
@jouvin
Copy link
Contributor Author

jouvin commented May 26, 2018

I think I'm done with this PR and that it is ready for review. I tried to address most of the spellchecker remarks but there are a few ones where I don't know if I need to add the word or if the word I use is inappropriate... And please, review my additions to the dictionary!

@jouvin jouvin force-pushed the aquilon_doc branch 6 times, most recently from 035d8a6 to 4eeb7ad Compare May 27, 2018 14:57
@jouvin
Copy link
Contributor Author

jouvin commented May 27, 2018

Now really fully tested 😄

- Rework the hardware-related sections of the configuration doc to rely
on the template library as much as possible
- Add a section on configuring the base OS
- Fix spelling mistakes in previous mods
- Include a dictionary update
- Makes easier to copy/paste suggested contents
* Create the `/var/quattor/cfg/plenary/web_servers/archetype/loadpath.pan` template with the following content:

```pan
# It is VERY IMPORTANT not to use this template for anything else than the initial
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be good to say why here so people actually understand the consequences of breaking the directive. e.g. I wrote in the example arch:

# First template loaded by an object, before / is populated. This must be a 
# declaration template because any change to / will be removed by a subsequent
# line in the object template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

they can be reviewed by others and then deploy them into a domain.

To publish the changes so that it is possible to deploy them later:

```bash
aq publish --sandbox site-init
aq publish --sandbox tutorial
Copy link
Contributor

Choose a reason for hiding this comment

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

This goes against what you said at line 506. It's better to s/--sandbox/--branch/ to minimise confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ned21 in fact, reading the help, I was wondering what is the difference between --sandbox and --branch. I had the feeling there was none... in which case you are right that it would be more consistent to use --sandbox when the value is of the form user/sandbox. Did I understand properly your point? Do you confirm that --sandbox and --branch are synonym for aq publish as the sandbox branch is not prefixed by the user (something I found surprising as I see a risk of conflict)?

- Installation: remove mention of PR now merged
- Advanced configuration: remove mention about features bound to
  archetypes (implementation not really tested, use discouraged)
@jouvin
Copy link
Contributor Author

jouvin commented Jun 2, 2018

As for me, this PR is ready for merging once quattor/aquilon#87 is merged (should happen soon!). I still have plenty of ideas for useful additions but probably better to do in future PRs as this one is already quite big and good enough to allow somebody to start playing with Aquilon in a useful way...
Review welcome !

@jouvin
Copy link
Contributor Author

jouvin commented Jun 3, 2018

@ned21 please, could you update your review which is currently blocking the PR but based on an earlier version....

@ned21
Copy link
Contributor

ned21 commented Jun 4, 2018

Sorry very busy until Thursday, will look then.

Copy link
Contributor

@ned21 ned21 left a comment

Choose a reason for hiding this comment

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

I found a couple of typos.

Aquilon requires for each archetype, in addition to its `base.pan` template created when the template library
was imported, a `final.pan` template which will be the very last executed in the host profile. It will be
created empty at this stage, in the `archetype` directory like `base.pan`:
Aquilon requires 2 templates for each archetype, located in the `archetype`
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually we need 3 now we have added declarations.pan so this should be:
"In addition to the declarations.pan template described above, each archetype requires 2 further templates located in a directory called <<name-of-archetype>>/archetype"

The `pakiti` feature is easily added to the Aquilon database with:

```bash
aq add feature --feature pakiti --type host --actation dispatch --deactivation reboot --grn test
Copy link
Contributor

Choose a reason for hiding this comment

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

actation => activation. You might want to consider adding a --comments "This feature deploys the pakiti software" to show how you can annotate your features with a helpful description

Once added it must be bound to the `web-servers` personality:

```bash
aq bind_feature --feature pakity --personality test --archetype web_servers
Copy link
Contributor

Choose a reason for hiding this comment

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

pakity => pakiti

This feature requires one variable to be added to our site configuration to define the name of the
Pakiti server. Based on whether the current host is the pakiti server or not, the server or the client will
be configured. Presently, we will configure the Pakiti client as part of the `test` personality. To achieve
this, add the following variable definition to `site/config/global_variables.pan`:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why wouldn't you define this server in the feature template itself? Otherwise you have two files managing a feature which is harder to use.

[Optional/future improvement] You could also use this as an example of how to use service bindings. Instead of binding a feature to a personality, you could define a service called pakiti and then use aq bind_server to set the desired PAKITI_SERVER.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ned21 thanks for the advice. I have not played with services yet but I will and add a section on them in a future revision. The server cannot be defined in the template because this feature is coming from the template library so is site-agnostic...

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, OK sorry I missed that bit. But it's still not really the right way to do it: you should have a file called features/pakiti/confg.pan that does:

variable PAKITI_SERVER = 'pakiti.dailyplanet.com';
include "template-library-standard/features/pakiti/config";

so the config is self-contained and not dependent on a single huge file where it's easy to get merge conflicts.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking a bit deeper, I see the way the standard library is included means you can't do this. There can be only one file called features/pakiti/config and that's in the TL; if you define another one in template-king it will take precedence and you won't be able to include the TL one.

You can do this with a service template though:

template service/pakiti/client/config;
# included automatically by broker when a client is bound to a service
variable PAKITI_SERVER = value("/system/services/pakiti/servers/0");
# load feature config from template-library-standard
include "features/pakiti/config";

The new host configuration can now be compiled, published an deployed with the usual commands:

```bash
aq promote --personality test --archetype web_servers
Copy link
Contributor

Choose a reason for hiding this comment

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

The change was already promoted at line 934

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! In fact I was not seeing it a couple of days ago thus I added in line 934!

use the following command:

```bash
aq promote --personality test --archetype web_servers
Copy link
Contributor

Choose a reason for hiding this comment

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

Do an aq show_diff --archetype web_servers --personality test --personality_stage current --other_stage next first to demonstrate how to see what changes are about to be promoted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have still a lot to learn about Aquilon advanced features! Adding it!


A template library version is enabled in the context of an archetype, using `archetype/declarations.pan`
This template is typically placed in the archetype directory for which you want to enable this version
of the template library. Currently, we'll add it to the plenary templates area, under
Copy link
Contributor

Choose a reason for hiding this comment

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

s/Currently/Temporarily, for the purposes of this tutorial,/


In our example, we will add the feature `pakiti` to the personality `test` used with the host
`testsrv.dailyplanet.com`. [Pakiti](https://github.com/CESNET/pakiti-server) is a service to collect and
display the patch status of hosts against known CVEs. Its configuration is part of the template library,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we link to the right bit of the template library here? i.e. https://github.com/quattor/template-library-standard/tree/master/features/pakiti

This feature requires one variable to be added to our site configuration to define the name of the
Pakiti server. Based on whether the current host is the pakiti server or not, the server or the client will
be configured. Presently, we will configure the Pakiti client as part of the `test` personality. To achieve
this, add the following variable definition to `site/config/global_variables.pan`:
Copy link
Contributor

Choose a reason for hiding this comment

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

ah, OK sorry I missed that bit. But it's still not really the right way to do it: you should have a file called features/pakiti/confg.pan that does:

variable PAKITI_SERVER = 'pakiti.dailyplanet.com';
include "template-library-standard/features/pakiti/config";

so the config is self-contained and not dependent on a single huge file where it's easy to get merge conflicts.

This feature requires one variable to be added to our site configuration to define the name of the
Pakiti server. Based on whether the current host is the pakiti server or not, the server or the client will
be configured. Presently, we will configure the Pakiti client as part of the `test` personality. To achieve
this, add the following variable definition to `site/config/global_variables.pan`:
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking a bit deeper, I see the way the standard library is included means you can't do this. There can be only one file called features/pakiti/config and that's in the TL; if you define another one in template-king it will take precedence and you won't be able to include the TL one.

You can do this with a service template though:

template service/pakiti/client/config;
# included automatically by broker when a client is bound to a service
variable PAKITI_SERVER = value("/system/services/pakiti/servers/0");
# load feature config from template-library-standard
include "features/pakiti/config";

@ned21
Copy link
Contributor

ned21 commented Jun 6, 2018

Test failure is not relevant - shall we merge this?

@jouvin
Copy link
Contributor Author

jouvin commented Jun 6, 2018

As for me this is ok! Once I progress with the configuration of real production nodes, I'll improve it but will probably not happen before mid-June...

@ned21 ned21 merged commit 35fa44b into quattor:master Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants