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

docs: Add small how/why and user tutorial #102

Merged
merged 1 commit into from
May 21, 2024
Merged

docs: Add small how/why and user tutorial #102

merged 1 commit into from
May 21, 2024

Conversation

Melkor333
Copy link
Contributor

I thought writing some user docs is the best way to repeat what I just learned and analyzed :)

Some features are still ignored and publish is not even properly started, but we'll get there.

@Melkor333 Melkor333 marked this pull request as draft March 29, 2024 15:10
@Melkor333 Melkor333 changed the title DRAFT: docs: Add small how/why and user tutorial docs: Add small how/why and user tutorial Mar 29, 2024
@Melkor333 Melkor333 requested a review from rhizoome April 4, 2024 13:43
@Melkor333
Copy link
Contributor Author

@ganwell I've tried to get the reasoning for certain design decisions here. But I struggle to see how to go forward. There are a few untouched topics (ie snapshot merging, publish from publish) and the publish section is generally very short (is there more to it? 🤔 ). I think it's OK to not have all use cases here but e.g. in an additional howto's documentation providing snippets similar to the test cases. Or just mention them in a configuration file reference. What do you think?

Copy link

@rhizoome rhizoome left a comment

Choose a reason for hiding this comment

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

This looks great! Thank you very much. I added some ideas to extend the documentation.

It's also important to understand that `pyaptly snapshot config.toml update` will do nothing, as these snapshots with retention are considered "readonly".

If we were to patch our systems only once a week, then what we want is to uncomment the line `repeat-weekly: "mon"`. This way, our snapshot would be backdated a full day to `aptly-20240102T0000Z`.
This means that pyaptly would only create a new snapshot once a week, no matter how often the command has run.
Copy link

@rhizoome rhizoome Apr 5, 2024

Choose a reason for hiding this comment

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

background

What I am saying here adds nothing new to your text. It is just the view from the application instead the user. Feel free to incorporate anything you think helps:

  • pyaptly reads the current-state of aptly
  • it will create all commands needed to create the should-state based on the current time
    • commands that create something that already exists in the current-state will be discarded (example)
  • it will resolve the dependencies into a command-tree
    • while resolving it will again check the state to see if the thing already exists
  • it will then execute the commands
    • if one command in the tree fails dependant commands will not and cannot be executed

this also ties into an issue where we are currently using pyaptly wrong (I do not know the details of how we are using it, I am inferring from questions I got). also take this with a grain of salt, I haven't been using pyaptly for a long time, maybe something slipped my memory.

  • there should only be one pyaptly cronjob: Calling a script doing all operations. Since it won't redo anything this is safe and efficient
    • the job has to be called in the smallest interval needed (week if there is only a weekly policy, daily if there is a daily policy)
    • this prevents snapshots from not being available when publish is called (I assume we currently have a snapshot-cronjob and a publish-cronjob)
  • if there is overlap in the cronjobs, the second job should probably not run (this is a feature we could add to pyaptly: some kind of "lock"-ckeck), currently this has to be scripted
  • if there chronic overload of pyaptly (because of the missing cleanup-features), pyaptly should run in a loop with a sleep-statement (to prevent overheating if pyaptly fails fast)

Of course on the point about create one script is interesting of this documentation. I just added the other points, because it came to my mind.

Sources:
main: aptly [snapshot]
$
```
Copy link

@rhizoome rhizoome Apr 5, 2024

Choose a reason for hiding this comment

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

  • maybe you could cover %T for referring to snapshots and archive-on-update. See
  • or do the same comparison to the aptly commands as you did above. (you could make use --info to see what commands are generated, if you use dry-run, you could change to config, without having to revert stuff all the time)
  • there is also the merge and the timestamp feature. See

digging into these features

  • the timestamp basically means n-th oldest timestamp. it is called back_ref in the code
  • merge is a snapshot feature, but a user might think of it in publishing, because only there it makes sense. See
  • archive-on-update seems to be meant to document when exactly a publish was changed, as it might have implications on policy or bugs discovered (before/after a change in publish). See

@rhizoome
Copy link

@Melkor333 I'd like to push this. Maybe you can do another iteration with my inputs later.

@rhizoome rhizoome marked this pull request as ready for review May 21, 2024 14:23
@rhizoome rhizoome merged commit 308674e into main May 21, 2024
1 check passed
@rhizoome rhizoome mentioned this pull request May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants