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

Collection migration support between database backends #3569

Open
SchoolGuy opened this issue Jan 30, 2024 · 1 comment
Open

Collection migration support between database backends #3569

SchoolGuy opened this issue Jan 30, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@SchoolGuy
Copy link
Member

SchoolGuy commented Jan 30, 2024

Is your feature request related to a problem?

As a Cobbler admin
I want to be able to change the database backend
so that I can adjust the database to my needs.

Provide a detailed description of the proposed feature

Currently, we provide three backends for the storage of our database on disk:

  • JSON files
  • a MongoDB database
  • a SQLite database

All three backends can be configured through settings.yaml. This works great however this doesn't take care of migrating data between those backends.

To achieve this I propose that we introduce a command in cobblerd that handles migrations. For this command to operate the server must not be running. Depending on the implementation the command may be realized similarly as cobbler-settings (so as a separate scriptlet).

The command - independent of the exact implementation - shall take four parameters.

  1. --from <serializer>
  2. --to <serializer>
  3. --adjust-settings <path>
  4. --cleanup

The --from parameter is optional as it can be auto-discovered by the current state of the settings.yaml file. The choices for both serializer parameters should be displayed in the help section and the command shall adjust the value for the serializer of settings.yaml in case the third parameter --adjust-settings is given (default is that settings.yaml is not touched).

The last parameter --cleanup will take care of deleting the old database. The help string should clearly state that the admin is responsible for performing a backup of the old database.

Alternatives you've considered

Extending the cobbler <item> copy syntax was proposed by @tpw56j. This I don't like since it implements that Cobbler needs to be running during this operation. A running server may lead to data corruption since data in memory and on disk may be out of sync.

Additional information

This surfaced during the work on #3554

@SchoolGuy SchoolGuy added the enhancement New feature or request label Jan 30, 2024
@tpw56j
Copy link
Contributor

tpw56j commented Jan 31, 2024

I still thought about this problem and think that although the task of transferring collection items is somewhat broader than migrating the entire database from one storage type to another, there is no need to implement all such capabilities in Cobbler. Some can be done with database tools, and some with other third-party tools.

  1. Your option of offline migration is much preferable to online copying of the entire database via:
cobbler copy --from/--to <serializer>
  1. I have not found any practical use for copying all items of individual collections:
cobbler profile copy --from/--to <serializer>
  1. I don’t yet have a definite opinion about the possibility of copying single items. Perhaps due to its flexibility in use and ease of implementation, this feature may come in handy:
cobbler profile copy --name item_name --from/--to <serializer> [--newname new_item_name ..]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants