AwsCron

Gem Version CircleCI Code Climate codecov Gitter chat

Table of Contents

Features

AwsCron does all the housekeeping related to handling AWS Elastic Beanstalk Periodic Tasks.

  • Handles HTTP responses, even in case of exceptions
  • Reliable error logging, using your preferred logger
  • Timezone-aware cron scheduling
    • AWS only allows UTC scheduling. AwsCron helps you use your desired timezone instead.

Examples

class MyAwsControllerResponsibleForCronCalls
  include AwsCron::Controller

  def foo_endpoint
    run { GenericTask.run }
  end

  def timezoned_9am_endpoint
    run_in_tz '0 9 * * *' do
      TimezoneSpecific9AMTask.run
    end
  end

  protected

  def time_provider # This is the default timezone for all `run_in_tz` calls
    ActiveSupport::TimeZone.new('America/New_York')
  end

  def return_object # AWS Scheduler always expects ok, even in case of errors
    render :json => {message: 'ok'}
  end
end

Requirements

  1. Ruby 2.3.0

Setup

For a secure install, type the following (recommended):

gem cert --add <(curl --location --silent /gem-public.pem)
gem install aws_cron --trust-policy MediumSecurity

NOTE: A HighSecurity trust policy would be best but MediumSecurity enables signed gem verification while allowing the installation of unsigned dependencies since they are beyond the scope of this gem.

For an insecure install, type the following (not recommended):

gem install aws_cron

Add the following to your Gemfile:

gem "aws_cron"

Tests

To test, run:

bundle exec rake

Versioning

Read Semantic Versioning for details. Briefly, it means:

  • Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
  • Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
  • Major (X.y.z) - Incremented for any backwards incompatible public API changes.

Code of Conduct

Please note that this project is released with a CODE OF CONDUCT. By participating in this project you agree to abide by its terms.

Contributions

Read CONTRIBUTING for details.

License

MIT License

Copyright (c) 2016 Wealthsimple.

History

Read CHANGES for details. Built with Gemsmith.

Credits

Developed by Marco Costa at Wealthsimple.