funktor 0.7.5 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/funktor-testapp/Dockerfile +63 -0
  4. data/funktor-testapp/app/services/job_flood.rb +1 -1
  5. data/funktor-testapp/funktor_config/boot.rb +3 -0
  6. data/funktor-testapp/funktor_config/environment.yml +10 -1
  7. data/funktor-testapp/funktor_config/function_definitions/default_queue_handler.yml +5 -1
  8. data/funktor-testapp/funktor_config/function_definitions/incoming_job_handler.yml +5 -1
  9. data/funktor-testapp/funktor_config/function_definitions/job_activator.yml +5 -1
  10. data/funktor-testapp/funktor_config/function_definitions/low_concurrency_queue_handler.yml +5 -1
  11. data/funktor-testapp/funktor_config/package.yml +6 -6
  12. data/funktor-testapp/funktor_config/resources/cloudwatch_dashboard.yml +645 -37
  13. data/funktor-testapp/funktor_config/ruby_layer.yml +1 -1
  14. data/funktor-testapp/serverless.yml +13 -3
  15. data/lib/funktor/activity_tracker.rb +1 -2
  16. data/lib/funktor/cli/init.rb +4 -0
  17. data/lib/funktor/cli/templates/Dockerfile +63 -0
  18. data/lib/funktor/cli/templates/funktor_config/environment.yml +10 -1
  19. data/lib/funktor/cli/templates/funktor_config/function_definitions/incoming_job_handler.yml +5 -1
  20. data/lib/funktor/cli/templates/funktor_config/function_definitions/job_activator.yml +5 -1
  21. data/lib/funktor/cli/templates/funktor_config/function_definitions/work_queue_handler.yml +5 -1
  22. data/lib/funktor/cli/templates/funktor_config/package.yml +6 -6
  23. data/lib/funktor/cli/templates/funktor_config/resources/cloudwatch_dashboard.yml +161 -0
  24. data/lib/funktor/cli/templates/funktor_config/ruby_layer.yml +1 -1
  25. data/lib/funktor/cli/templates/serverless.yml +13 -3
  26. data/lib/funktor/incoming_job_handler.rb +9 -7
  27. data/lib/funktor/job_activator.rb +33 -17
  28. data/lib/funktor/job_pusher.rb +1 -1
  29. data/lib/funktor/version.rb +1 -1
  30. data/lib/funktor/web/application.rb +1 -1
  31. data/lib/funktor/work_queue_handler.rb +21 -6
  32. data/lib/funktor.rb +20 -1
  33. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b78b0dfad4344af7ceaeef40b2871f68e1305deaa0218f87737b05b4d2e36578
4
- data.tar.gz: 3405468ffbcf7c826ff25dce2a4a991df9c6ebe1076cfbcb357ce1b94174355d
3
+ metadata.gz: 55a26178c2cc3afd27da38d8322aba99cb8b05b707a0c69651531ec44471bf79
4
+ data.tar.gz: 8d96412765a0711319b73137b295fdf2c2e90da61e6c2f38caa11aa0c91774f6
5
5
  SHA512:
6
- metadata.gz: 556517fc7fe7ee77c5cb38b4a97c64333cc929aa7524cd4263ae5f9087e847ba5958def975a4b7401f95aa77bd9b276cc700440e591db769da49e41c22bb9e3f
7
- data.tar.gz: 524a7ce3720d0f6d3f368ebc1bec6035568942e2eaaec44c001e3b4acfc7397797b08c6a8c528cd7730ea42007e9b7e1c0b2e55a6c83460a52d75a4a991faf53
6
+ metadata.gz: 6e31ed84ec9c743a74c7f77db2859dfbadcbb6d1553c5e945185e60afaf2b0657274d4e18502bb1f7794ea9585fa5f90d91a550da29524ae5e9cd92a8f4c4533
7
+ data.tar.gz: 9b61c9c412003860d61c22f4626f9c91c6193e95aaa3e6fe45951905da80b90699f3c08e9dbb6ae3e84c1b32fa77b9850ca19c499905cbd6cd0e42b8287d2f70
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- funktor (0.7.4)
4
+ funktor (0.7.8)
5
5
  activesupport
6
6
  aws-sdk-dynamodb (~> 1.62)
7
7
  aws-sdk-sqs (~> 1.37)
@@ -22,8 +22,8 @@ GEM
22
22
  addressable (2.8.0)
23
23
  public_suffix (>= 2.0.2, < 5.0)
24
24
  aws-eventstream (1.2.0)
25
- aws-partitions (1.584.0)
26
- aws-sdk-core (3.130.2)
25
+ aws-partitions (1.587.0)
26
+ aws-sdk-core (3.131.0)
27
27
  aws-eventstream (~> 1, >= 1.0.2)
28
28
  aws-partitions (~> 1, >= 1.525.0)
29
29
  aws-sigv4 (~> 1.1)
@@ -0,0 +1,63 @@
1
+ FROM public.ecr.aws/lambda/ruby:2.7 AS build_image
2
+
3
+ # Uncomment this as a cache buster
4
+ #RUN echo date
5
+
6
+ # If you supplied buildArgs to the ecr image you can access them here using ARG & ENV
7
+ #ARG BUNDLE_GEM__FURY__IO
8
+ #ENV BUNDLE_GEM__FURY__IO=${BUNDLE_GEM__FURY__IO}
9
+
10
+ # First we install some stuff that we need for gems that have to compile native extensions
11
+ #RUN yum groupinstall "Development Tools" -y
12
+ #RUN yum install -y amazon-linux-extras
13
+ #RUN amazon-linux-extras enable postgresql11
14
+ #RUN yum install -y postgresql-devel
15
+
16
+ # Now we copy the Gemfile and Gemfile.lock into the build image so we can install our gems
17
+ COPY Gemfile Gemfile.lock .
18
+
19
+ # Set a few bundle configuration options
20
+ RUN bundle lock --add-platform x86_64-linux
21
+ #RUN bundle config --local deployment true
22
+ #RUN bundle config --local plugins false
23
+ #RUN bundle config --local frozen true
24
+ #RUN bundle config --local without 'development test'
25
+ RUN bundle config --local path './vendor/bundle'
26
+
27
+ # Now install our gems
28
+ RUN bundle install --quiet --jobs 4
29
+
30
+ # Now we start a second stage in the build that is a clean image without build tools
31
+ FROM public.ecr.aws/lambda/ruby:2.7 AS deploy_image
32
+
33
+ #ENV RAILS_ENV=production
34
+ #ENV RACK_ENV=production
35
+
36
+ # Install node so that asset related gems have a JS runtime.
37
+ # We ship the node executeable to production to make it easier to get an app deployed.
38
+ # TODO: Document steps that could be taken to remove this dependency.
39
+ #RUN curl --silent --location https://rpm.nodesource.com/setup_14.x | bash -
40
+ #RUN yum install -y nodejs
41
+
42
+ # Then copy some postgres related files
43
+ #COPY --from=build_image /usr/lib64/libpq.so.5 /usr/lib64/
44
+ #COPY --from=build_image /usr/lib64/libldap_r-2.4.so.2 /usr/lib64/
45
+ #COPY --from=build_image /usr/lib64/liblber-2.4.so.2 /usr/lib64/
46
+ #COPY --from=build_image /usr/lib64/libsasl2.so.3 /usr/lib64/
47
+ #COPY --from=build_image /usr/lib64/libssl3.so /usr/lib64/
48
+ #COPY --from=build_image /usr/lib64/libsmime3.so /usr/lib64/
49
+ #COPY --from=build_image /usr/lib64/libnss3.so /usr/lib64/
50
+
51
+
52
+ # Next we copy the app from our local directory and we copy
53
+ # the bundled gems from the build image.
54
+ # We do this after copying dependencies becuase the app will
55
+ # change more frequently, and we can used caching up to here.
56
+
57
+ COPY --from=build_image /var/task .
58
+ COPY . .
59
+
60
+ # And finally we have the CMD for the deployed container
61
+ # You can overwrite command in `serverless.yml` template
62
+ CMD [ "app.LambdaFunction::Handler.process" ]
63
+
@@ -23,7 +23,7 @@ class JobFlood
23
23
  job_target_time = Time.now + (minute * 60) + rand(60)
24
24
  job_sleep = rand(0.0..max_job_length_in_seconds.to_f)
25
25
  puts job_target_time
26
- [AuditWorker, AuditWorker, SingleThreadAuditWorker].sample.perform_at(job_target_time, {
26
+ [AuditWorker, AuditWorker, SingleThreadAuditWorker, HelloWorker, GreetingsWorker].sample.perform_at(job_target_time, {
27
27
  mode: 'later',
28
28
  message: 'msg: from random JobFlood - ' + SecureRandom.hex,
29
29
  target_time: job_target_time,
@@ -12,6 +12,9 @@ Bundler.require(:default, :production)
12
12
  $LOAD_PATH.unshift 'funktor/lib'
13
13
  require 'funktor'
14
14
 
15
+
16
+ Funktor.enable_work_queue_visibility = false
17
+
15
18
  # Load all ruby files in the app directory
16
19
  require_rel File.join('..', 'app')
17
20
 
@@ -1,7 +1,16 @@
1
- BUNDLE_WITHOUT: development:test:assets
1
+ BUNDLE_WITHOUT: development:test
2
2
  BUNDLE_PLUGINS: false
3
3
  BUNDLE_FROZEN: true
4
+ BUNDLE_DEPLOYMENT: true
4
5
  SERVERLESS_STAGE: ${self:custom.stage}
6
+
7
+ FUNKTOR_LOG_LEVEL: INFO
8
+
9
+ RAILS_LOG_TO_STDOUT: true
10
+ RAILS_ENV: production
11
+ RACK_ENV: production
12
+ RAILS_MAX_THREADS: 1
13
+
5
14
  FUNKTOR_APP_NAME: funktor-testapp
6
15
  FUNKTOR_INCOMING_JOB_QUEUE:
7
16
  Ref: IncomingJobQueue
@@ -1,8 +1,12 @@
1
- handler: lambda_event_handlers/default_queue_handler.call
1
+ #handler: lambda_event_handlers/default_queue_handler.call
2
2
  timeout: ${self:custom.funktor.DefaultQueueHandler.functionTimeout, 900}
3
3
  reservedConcurrency: ${self:custom.funktor.DefaultQueueHandler.reservedConcurrency, null}
4
4
  provisionedConcurrency: ${self:custom.funktor.DefaultQueueHandler.provisionedConcurrency, null}
5
5
  memorySize: ${self:custom.funktor.DefaultQueueHandler.memorySize, 256}
6
+ image:
7
+ name: funktorimage
8
+ command:
9
+ - lambda_event_handlers/default_queue_handler.call
6
10
  events:
7
11
  - sqs:
8
12
  batchSize: ${self:custom.funktor.DefaultQueueHandler.batchSize, 1}
@@ -1,8 +1,12 @@
1
- handler: lambda_event_handlers/incoming_job_handler.call
1
+ #handler: lambda_event_handlers/incoming_job_handler.call
2
2
  timeout: ${self:custom.funktor.IncomingJobHandler.functionTimeout, 30}
3
3
  reservedConcurrency: ${self:custom.funktor.IncomingJobHandler.reservedConcurrency, null}
4
4
  provisionedConcurrency: ${self:custom.funktor.IncomingJobHandler.provisionedConcurrency, null}
5
5
  memorySize: ${self:custom.funktor.IncomingJobHandler.memorySize, 256}
6
+ image:
7
+ name: funktorimage
8
+ command:
9
+ - lambda_event_handlers/incoming_job_handler.call
6
10
  events:
7
11
  - sqs:
8
12
  batchSize: ${self:custom.funktor.IncomingJobHandler.batchSize, 1}
@@ -1,7 +1,11 @@
1
- handler: lambda_event_handlers/job_activator.call
1
+ #handler: lambda_event_handlers/job_activator.call
2
2
  timeout: ${self:custom.funktor.JobActivator.functionTimeout, 30}
3
3
  reservedConcurrency: ${self:custom.funktor.JobActivator.reservedConcurrency, null}
4
4
  provisionedConcurrency: ${self:custom.funktor.JobActivator.provisionedConcurrency, null}
5
5
  memorySize: ${self:custom.funktor.JobActivator.memorySize, 256}
6
+ image:
7
+ name: funktorimage
8
+ command:
9
+ - lambda_event_handlers/job_activator.call
6
10
  events:
7
11
  - schedule: rate(1 minute)
@@ -1,8 +1,12 @@
1
- handler: lambda_event_handlers/low_concurrency_queue_handler.call
1
+ #handler: lambda_event_handlers/low_concurrency_queue_handler.call
2
2
  timeout: ${self:custom.funktor.LowConcurrencyQueueHandler.functionTimeout, 900}
3
3
  reservedConcurrency: ${self:custom.funktor.LowConcurrencyQueueHandler.reservedConcurrency, null}
4
4
  provisionedConcurrency: ${self:custom.funktor.LowConcurrencyQueueHandler.provisionedConcurrency, null}
5
5
  memorySize: ${self:custom.funktor.LowConcurrencyQueueHandler.memorySize, 256}
6
+ image:
7
+ name: funktorimage
8
+ command:
9
+ - lambda_event_handlers/low_concurrency_queue_handler.call
6
10
  events:
7
11
  - sqs:
8
12
  batchSize: ${self:custom.funktor.LowConcurrencyQueueHandler.batchSize, 1}
@@ -1,10 +1,10 @@
1
1
  # TODO - Figure out how to allow individual packaging to work out of the box.
2
- individually: false
3
- include:
4
- - Gemfile
5
- - Gemfile.lock
6
- - funktor_config/boot.rb
7
- - app/**
2
+ #individually: false
3
+ #include:
4
+ #- Gemfile
5
+ #- Gemfile.lock
6
+ #- funktor_config/boot.rb
7
+ #- app/**
8
8
  # Evertyting is excluded by default with serverless-ruby-layer, but you could use
9
9
  # the lines below to exlude files that are inside an include path.
10
10
  #exclude: