-
Notifications
You must be signed in to change notification settings - Fork 1
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 scheduled rule to kick off the refresh weekly #3
Conversation
MaxMind say "Weekly updates are available every Tuesday." - so I guess we should grab a fresh copy every Wednesday. https://support.maxmind.com/geoip-faq/databases-and-database-updates/how-often-are-the-geoip2-and-geoip-legacy-databases-updated/ https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-schedule-expressions.html
ScheduledRule: | ||
Type: AWS::Events::Rule | ||
Properties: | ||
ScheduleExpression: cron(20 11 ? * WED *) # MaxMind: "Weekly updates are available every Tuesday" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Truth be told, there is quite a lot of variation in implementations of cron expressions in general!
AWS have slightly unusual cron expressions, which we see here in that they have a 6th field which is the year of execution, and they can use ?
in day-of-month
& day-of-week
to indicate you don't care what value that should be (rather than *
, which means every value it could be)
If you get rid of those two idiosyncrasies, you can check this cron with https://crontab.guru/#20_11_*_*_WED :
So, the expression will execute at 11:20am on Wednesdays, the day after MaxMind release the weekly database update.
@lmath asks this good question: "How would you get the slab to know about updated geoIP data in the s3 bucket? Redeploy?" - that's right, a redeploy is necessary as the Slab only reads GeoIP data on startup. We have a RiffRaff scheduled deploy for the Slab, and I've just updated it to occur 20 minutes after the Note that the |
The lambda executed successfully at the anticipated time of 11:20am UTC (12:20pm london time): The scheduled deploy should occur in a minute or so... |
Scheduled deploy of the Slab has completed, finishing at 12:42pm: The country breakdown graph still looks good! |
MaxMind say "Weekly updates are available every Tuesday" - so I guess we should grab a fresh copy of the GeoIP database once a week, on Wednesday!
This change adds a cloud-formed AWS Event Rule to trigger the lambda on a weekly basis.