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

add ZFS snapshot feature to minimze risks and downtime #157

Open
maxadamo opened this issue Jan 4, 2020 · 3 comments · May be fixed by #159
Open

add ZFS snapshot feature to minimze risks and downtime #157

maxadamo opened this issue Jan 4, 2020 · 3 comments · May be fixed by #159

Comments

@maxadamo
Copy link

maxadamo commented Jan 4, 2020

I have created this tool: https://github.com/maxadamo/g10k-zfs
The tool does the following:
- creates ZFS snapshots on an existing ZFS pool
- rotates in a loop two snapshots, called Even and Odd
- mounts either Even or Odd depending on the rotation position

  • creates a new ZFS r/o snapshot whose name contains a timestamp (i.e.: code/g10k@Date-06-Jan-2020_Time-16.28.42)
  • unmount the currently mounted snapshot
  • mount the new snapshot
  • deletes the old snapshot

This prevents leaving the code in a bad status and helps minimizing the downtime (replacing the snapshot takes few millisecond and happens only if the code was checked out successfully).

I am not sure about the question that I need to ask you, because there are actually few different options available:

  1. fully integrate g10k-zfs into g10k with PR (it is version 0.1... it needs a break-in period first). I can remove docopt (which you are not using) and try to harmonize my code with g10k code.
  2. we may think that the snapshot feature is not in scope with g10k. Thus, I saw initially in your code the following function: checkForAndExecutePostrunCommand(). Not clear how this works, and if it works, but g10k-zfs can be run indeed as Postrun command.
  3. of course, I can run g10k first, and if g10k is successful I run g10k-zfs which will replace the snapshot
@xorpaul
Copy link
Owner

xorpaul commented Jan 8, 2020

Starting the New Year with guns blazing 😏

Cool idea, I'm also looking for a way to check the whole g10k run first before shipping or using the populated Puppet environment code elsewhere.

My approach would have been a staging directory somewhere else and the simply link or rsync it to the final destination.

I'll also have a look into integrating your ZFS code into g10k directly, but you're also welcome to provide a PR of course 😅

@maxadamo
Copy link
Author

maxadamo commented Jan 8, 2020

I think if I remove docopt the code left is tiny.... I should be able to provide a file zfs.go, which can be added to this package.
Then. it will be matter of adding few command switches for it.

I'll think about the symlink... it's easier for people who don't want to setup ZFS on their servers... and it would have been easier for me 😢

@maxadamo
Copy link
Author

maxadamo commented Jan 8, 2020

I had time to think a little bit. Symlink is also good, but you'll have one copy at time, and you need to clone again from scratch, because the other copy is in use already.
With ZFS you have a staging copy (read/write) which is never mounted and can be changed.
I'll try to work for the ZFS PR .... and anyway, it will be optional for the users.

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 a pull request may close this issue.

2 participants