Skip to content

Allow for custom stacks#75

Open
hazzuk wants to merge 27 commits into
devfrom
custom-stacks
Open

Allow for custom stacks#75
hazzuk wants to merge 27 commits into
devfrom
custom-stacks

Conversation

@hazzuk

@hazzuk hazzuk commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Description

This PR allows anyone the ability to create their own custom stacks, and to distribute them freely. Creating a fully modular system.

Changes

  • Existing stacks have been moved to a new repository.
  • Added a new justfile recipe just custom, to add or remove karo-custom repos.
  • Large refactor of the karo-compose role tasks, allowing for custom stacks.
  • New karo-compose asserts, for better error handling.

Notes

  • Stacks now use a dictionary data structure.

    • Greatly helps structure data for stacks with multiple services.
    • Visually much cleaner for large stacks.
    • Allows for the new compose variable, used in stack templates.
  • Note, while this PR implements the use of dictionary variables. In general, this should likely be avoided for future features (unless there is a good reason to use this type of data structure). What a user declares in their inventory, and the defaults it overwrites can quickly become problematic when using dictionaries. Karo-compose has new functionality that specifically merges the two together for stack variables.

  • Users have to order their 'stack groups'. And each stack group will provide defaults for their internal ordering of stacks. This approach was implement as it's the ideal middle ground for control, versus the trade off of complexity (say if you were to require users to list and order every individual stack).

  • While there have been a large number of code changes to the karo-compose role's tasks. The general sequence for managing stacks has remained mostly the same.

Checklist

  • Written documentation
  • [n/a] Linked relevant issues

hazzuk added 27 commits June 22, 2026 17:19
Stack templates will now move to a custom stacks repo.
Required by Ansible to use multiple defaults files.
Stack groups and stack names are now defined separately, allowing for custom stacks.
This setup keeps tracking the karo-compose role's defaults and templates directories.
Not all stacks will have their configuration present. This will now only set secrets 'when' the stack is 'enabled'. It's then safe to assume the user has defined the required secrets.
Using the combine filter is Ansible's recommended approach for merging multiple dictionaries.
This reverts commit d597a56.

The use of dictionary data structures should be avoided.
The loop syntax is recommended over with_<lookup> by Ansible.
Used when editing the Ansible vault file.
Allows for adding and removing karo-custom repos.
Clearing symlinks also becomes easier, as it doesn't need to be recursive.
@hazzuk hazzuk added Kind/Feature New functionality Compat/Breaking Breaking change that won't be backward compatible labels Jul 8, 2026
@hazzuk

hazzuk commented Jul 8, 2026

Copy link
Copy Markdown
Owner Author

Tested with my existing server and the new hazzuk/karo-custom repo.

  • Was able to deploy, up, down all/individual stacks successfully.
  • Running diff between old and new compose/config files. There where no unintended changes between how stack templates where deployed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Compat/Breaking Breaking change that won't be backward compatible Kind/Feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant