Skip to content

Major overhaul - #26

Open
zhimsel wants to merge 76 commits into
evannuil:masterfrom
zhimsel:master
Open

Major overhaul#26
zhimsel wants to merge 76 commits into
evannuil:masterfrom
zhimsel:master

Conversation

@zhimsel

@zhimsel zhimsel commented May 5, 2015

Copy link
Copy Markdown

Feel free to merge this PR if you'd like. It's a major overhaul of the script with lots of improvements, but also includes some architectual changes as well as a new name.

Changes (might not be exhaustive):

  • New name (this can be changed, though you might want to also rename the tags it uses)
  • Uses instance tags instead of volume tags to select volumes to snapshot
    • It will select all volumes attached to an instance and snapshot each one
  • Removes the concept of "daily/weekly/monthly" snapshots. Instead, it's a flat "keep X amount of snapshots" system now. (see the README for how that works)
  • Allows user to ignore specifc volumes by tagging them.
  • SNS hasn't really been touched yet, but I might come back later and update that
  • Improves handling of "autosnap owned" snapshots by looking for a specific tag on the snapshots instead of just searching for a string in all of the values (which could lead to unexpected deletions).
  • Fixes reading IAM user keys from environment variables
  • Improves code readability and moves actual tasks to functions
  • Improves log readability (and logs to both stdout and a logfile)
  • Adds pip-style requirements file
  • Adds some useful tags to the snapshots it creates (instance id, mount point, etc)
  • Adds support for doing dry-runs

aman88 and others added 30 commits August 21, 2014 01:32
Selects volumes to snapshot from tags on instances instead of volumes.
Fixed errors reported by flake8 (except the complexity of the for-loop
on line 151)
It's more descriptive in the config file
Makes it a little more readable and removes redundant information
Reflects structural changes to script (e.g. it uses instance tags instead of volume tags).
Includes changes in dd585a8 to README
TAGS: Autosnap will now tag the snapshots it makes with the same
user-configured tag specified in the config file. It will also use that
tag to filter out which snapshots to delete and not delete.

DELETION: Autosnap now bases its deletion decisions based on the NUMBER
of snapshots, not the AGE of the snapshots.  This allows two things to happen:
    1. This can be run in an on-demand basis instead of having to be run
      on a schedule.
    2. This prevents autosnap from deleting all of the snapshots for a volume
      if it hasn't backed up in more than X number of days. For instance, if
      the script fails to run over a weekend and you only want to keep the
      last 3 days, it would previously have deleted all the snapshots if
      you came back on Monday and manually ran the script (or fixed the
      issue).

INTERVAL: This commit also removes the concept of 'daily', 'weekly' or
'monthly' snapshots. The new setting only configures how many snapshots
you want to keep, period. No more having different sets of snapshots to
keep track of.
If the tag 'autosnap_limit' exists on any instance it's snapshotting,
autosnap will use that value instead of the global setting in the
config file.
zhimsel added 27 commits May 4, 2015 13:50
Very useful for testing.
Any volume that is part of an instance that we snapshot will be ignored
if the tag 'autosnap_ignore' is present (doesn't matter what the value
is).
Major design change, but I feel it simplifies dealing with instance
tags.

Instead of setting two tags, autosnap:true and autosnap_frequency:X, you
just set one tag, autosnap:X.

Also changes what autosnap tags the new snapshots as to the custom
'tag_name' setting, instead of the hardcoded 'autosnap'. This allows
users to run multiple copies of this script with different tags.
If there are no current snapshots, it would give an error and not take
one (therefore "new" instances would never be snapshotted). This commit
fixes that. If the snapshot list is empty, it forces a snapshot
(skipping the date compare).
Fixes error with new instances having no snapshots, among other things
Use the config.get() function instead of reading directly. This
necessitates a change in how a dry-run is checked for ('if' instead of
'try').
It's basically a whole new script, anyway...
@fungusakafungus

Copy link
Copy Markdown

That's a different tool now and less useful for me. I wouldn't merge it here.

@cjw296

cjw296 commented Jun 14, 2016

Copy link
Copy Markdown

Yeah, this feels like a fork that you should release separately.

@sethdandridge sethdandridge left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lgtm

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.

5 participants