Skip to content

Commit

Permalink
update: EventBridge + StateMachine でストレージサイズが適用されるように
Browse files Browse the repository at this point in the history
  • Loading branch information
morikiyo committed Oct 4, 2024
1 parent b9f0f1f commit ffe5f80
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/sg_fargate_rails/event_bridge_schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ class EventBridgeSchedule
'2xlarge' => { cpu: '8192', memory: '16384' },
}.freeze

DEFAULT_STORAGE_SIZE_GB = 20

attr_reader :name

def initialize(name:, cron:, command:, container_type: 'small', storage_size_gb: nil, use_bundler: true)
def initialize(name:, cron:, command:, container_type: 'small', storage_size_gb: DEFAULT_STORAGE_SIZE_GB, use_bundler: true)
@name = name
@cron = cron
@command = command
Expand Down Expand Up @@ -59,7 +61,7 @@ def create_start_execution_state_machine(group_name:, cluster_arn:)
schedule_expression_timezone: timezone,
target: {
arn: state_machine_arn(group_name, cluster_arn),
input: container_overrides_json,
input: state_machine_input_json,
retry_policy: {
maximum_event_age_in_seconds: 120,
maximum_retry_attempts: 2,
Expand All @@ -86,10 +88,11 @@ def input_overrides_json
}.to_json
end

def container_overrides_json
def state_machine_input_json
type = convert_container_type
{
**type,
"storage_size_gb": @storage_size_gb,
"command": container_command,
}.to_json
end
Expand Down

0 comments on commit ffe5f80

Please sign in to comment.