appfuel-service 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91ad1af85e2c4df47201aa7f47652e6318395bd7
4
- data.tar.gz: 11aa99fce5a2764eb0abdffd34d9fd10e2102f92
3
+ metadata.gz: 7d89625ae0ff9e49ecd85a326aec3467a84d91bb
4
+ data.tar.gz: 910682f71f8d186de81227cd6a77026ef9793732
5
5
  SHA512:
6
- metadata.gz: 51af031db94a891c2627433dcc47ad3dc4fcc3f6f6405c386a81d8c6e4bc9911b4c1a777f8342fa6b743dbde5561c21eb78133c819c63ddb64dfa2dc1249c425
7
- data.tar.gz: c4d7bb8d3fce5c51044d0ea5cb653eb0faf8d6bb0d08c0e0d8af013eaf593a7928ab1047139134f808aaddb77c961544d72a3aaf8e5815aa27576b55a72f12a7
6
+ metadata.gz: 358fa56770a955568a92c697233f5e5c899eb6f2acabee45569940a12d97c1a2e981986dddf9e4780e6072a51e9ead2d85df3a30b6702a5268830d540d51e85d
7
+ data.tar.gz: 2189021627302cab3ed90a64cd2ddcddf40204fd03384e5c7ad6ecb6a59a09bfb43ac4fc3d87b30a8e6401f1b861eced2e3713977c8c838d52399c7771402baf
data/CHANGELOG.md CHANGED
@@ -2,3 +2,9 @@
2
2
  All notable changes to this project will be documented in this file. (Pending approval) This project adheres to [Semantic Versioning](http://semver.org/). You can read more on this at [keep a change log](http://keepachangelog.com/)
3
3
 
4
4
  # [Unreleased]
5
+
6
+ # Releases
7
+
8
+ ## [[0.1.3]](https://github.com/rsb/appfuel/releases/tag/0.1.3) 2017-06-07
9
+ ### Added
10
+ - Configuration definitions for database, aws, worker, sentry and new relic
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_dependency "appfuel", "~> 0.2.6"
23
+ spec.add_dependency "appfuel", "~> 0.2.7"
24
24
  spec.add_dependency "sneakers", "~> 2.5"
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.15"
@@ -0,0 +1,29 @@
1
+ module Appfuel
2
+ module Service
3
+ module Config
4
+ #
5
+ # Defines how to parse and validate configuration data for aws
6
+ #
7
+ # Configuration Overview:
8
+ # access_key_id: access credentials for aws
9
+ # secret_access_key: access credentials for aws
10
+ # assets_bucket: name of bucket to hold assets
11
+ # documents_buckets name of bucket to hold documents
12
+ #
13
+ # @returns Config::Definition
14
+ def self.aws_definition
15
+ Appfuel::Configuration.define :aws do
16
+ defaults region: 'us-west-2'
17
+
18
+ validator {
19
+ required(:region).filled(:str?)
20
+ optional(:access_key_id).filled(:str?)
21
+ optional(:secret_access_key).filled(:str?)
22
+ optional(:kms_master_key_id).filled(:str?)
23
+ optional(:kms_data_key_cipher).filled(:str?)
24
+ }
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,57 @@
1
+ module Appfuel
2
+ module Service
3
+ module Config
4
+ # Defines database configuration. This is designed to hold more than one
5
+ # database connection which is why they are named invidually. We are using
6
+ # active record so the config is taylored to that style connection.
7
+ #
8
+ # Configuration Overview
9
+ #
10
+ # pool: Managed connection which controls the amount of thread access to
11
+ # a limited number of database connections
12
+ # adapter: We always use postgres, rarely changes
13
+ # encoding: We always use unicode, rarely changes
14
+ # database Name of the database
15
+ # username Name of the database user
16
+ # password Database password
17
+ # host Location of the database server
18
+ #
19
+ # @return Defintion
20
+ def self.db_definition
21
+ Appfuel::Configuration.define :db do
22
+ validator {
23
+ required(:main).filled(:hash?)
24
+ required(:path).filled(:str?)
25
+ required(:seed_path).filled(:str?)
26
+ required(:migrations_path).filled(:str?)
27
+ }
28
+
29
+ db_path = 'db'
30
+ defaults path: db_path,
31
+ migrations_path: "#{db_path}/migrations",
32
+ seed_path: 'db/seed'
33
+
34
+ define :main do
35
+ defaults pool: 5,
36
+ adapter: 'postgresql',
37
+ encoding: 'unicode',
38
+ schema_format: 'sql'
39
+
40
+ validator do
41
+ required(:schema_search_path).filled(:str?)
42
+ required(:schema_format).filled(:str?)
43
+ required(:database).filled(:str?)
44
+ required(:username).filled(:str?)
45
+ required(:password).filled(:str?)
46
+ required(:host).filled(:str?)
47
+ required(:adapter).filled(:str?)
48
+ optional(:pool).filled(:int?)
49
+ optional(:encoding).filled(:str?)
50
+ optional(:port).filled(:int?)
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,22 @@
1
+ module Appfuel
2
+ module Service
3
+ module Config
4
+ def self.newrelic_definition
5
+ Appfuel::Configuration.define :newrelic do
6
+ defaults license_key: '',
7
+ app_name: '',
8
+ log_level: 'info',
9
+ monitor_mode: 'true',
10
+ agent_enabled:'true'
11
+ validator {
12
+ required(:new_relic_license_key).filled(:str?)
13
+ required(:new_relic_app_name).filled(:str?)
14
+ required(:new_relic_log_level).filled(:str?)
15
+ required(:new_relic_monitor_mode).filled(:str?)
16
+ required(:new_relic_agent_enabled).filled(:str?)
17
+ }
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ module Appfuel
2
+ module Service
3
+ module Config
4
+ def self.sentry_definition
5
+ Appfuel::Configuration.define :sentry do
6
+ validator {
7
+ required(:dsn).filled(:str?)
8
+ }
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,58 @@
1
+ module Appfuel
2
+ module Service
3
+ module Config
4
+ #
5
+ # Defines how to parse and validate configuration data for sneakers
6
+ # for more information of the configuration please go to the wiki for
7
+ # the sneakers project https://github.com/jondot/sneakers/wiki/Configuration
8
+ #
9
+ # Configuration Overview:
10
+ # heartbeat: RabbitMQ heartbeat delay in seconds
11
+ # ack: RabbitMQ the worker must acknowledge work is done
12
+ # daemonize: Sneakers deameonize the worker
13
+ # log Sneakers log file location
14
+ # pid_path Sneakers daemon's pidfile location
15
+ # workers Sneakers the number of worker processes
16
+ # threads Sneakers number of threads per worker
17
+ # prefetch RabbitMQ how many messages to send to a worker
18
+ # timeout_job_after Sneakers Maximal seconds to wait for job
19
+ # start_worker_delay Sneakers Delay between thread startup
20
+ # durable RabbitMQ Queue should persist
21
+ # exchange RabbitMQ name of the exchange
22
+ # exchange_type RabbitMQ type of exchange (direct, topic, fanout)
23
+ # vhost RabbitMQ name of the vhost
24
+ # amqp RabbitMQ connection string used to communicate
25
+ #
26
+ # @returns Config::Definition
27
+ def self.sneakers_definition
28
+ Appfuel::Configuration.define :sneakers do
29
+ defaults heartbeat: 60,
30
+ ack: true,
31
+ daemonize: true,
32
+ workers: 1,
33
+ threads: 1,
34
+ prefetch: 1,
35
+ timeout_job_after: 5,
36
+ durable: true
37
+
38
+ validator {
39
+ required(:amqp).filled(:str?)
40
+ required(:vhost).filled(:str?)
41
+ required(:exchange).filled(:str?)
42
+ required(:exchange_type).filled(:str?)
43
+ required(:durable).filled(:bool?)
44
+ required(:ack).filled(:bool?)
45
+ required(:daemonize).filled(:bool?)
46
+ required(:heartbeat).filled(:int?)
47
+ required(:log).filled(:str?)
48
+ required(:pid_path).filled(:str?)
49
+ required(:threads).filled(:int?)
50
+ required(:workers).filled(:int?)
51
+ required(:timeout_job_after).filled(:int?)
52
+ required(:prefetch).filled(:int?)
53
+ }
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,49 @@
1
+ module Appfuel
2
+ module Service
3
+ module Config
4
+ # Defines the configuration for the whole worker. It basically has two
5
+ # child definitions :db and :sneakers
6
+ #
7
+ # Configuration Overview
8
+ #
9
+ # env: The environement this worker is deployed as dev, qa, stg, prod
10
+ # logfile: The location of the application log file if the value is
11
+ # stdout or stderr it will use that instead
12
+ # dispatchers List of workers that dispatch messages to actions. The reason
13
+ # why you would want more than one is to use different exchange
14
+ # types
15
+ #
16
+ # db Database configuration please see sp_offers/config/database
17
+ # sneakers RabbitMQ configuration please see sp_offers/config/sneakers
18
+ # aws Configuration S3 where we store our documents
19
+ # @return Definition
20
+ def self.worker_definition
21
+ Appfuel::Configuration.define :worker do
22
+ file 'config/app.yaml'
23
+ defaults logfile: 'stdout',
24
+ audit_logfile: 'stdout'
25
+
26
+ validator {
27
+ required(:env).filled(:str?)
28
+ required(:logfile).filled(:str?)
29
+ required(:audit_logfile).filled(:str?)
30
+ # Children will be validated on there own
31
+ # we are just ensuring they exist
32
+ required(:db).filled(:hash?)
33
+ optional(:sneakers).filled(:hash?)
34
+ optional(:aws).filled(:hash?)
35
+ optional(:sentry).filled(:hash?)
36
+ optional(:newrelic).filled(:hash?)
37
+ }
38
+ self << [
39
+ Config.db_definition,
40
+ Config.sneakers_definition,
41
+ Config.aws_definition,
42
+ Config.sentry_definition,
43
+ Config.newrelic_definition
44
+ ]
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,7 @@
1
+ require 'yaml'
2
+ require_relative 'config/database'
3
+ require_relative 'config/sneakers'
4
+ require_relative 'config/aws'
5
+ require_relative 'config/worker'
6
+ require_relative 'config/sentry'
7
+ require_relative 'config/newrelic'
@@ -1,5 +1,5 @@
1
1
  module Appfuel
2
2
  module Service
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -3,3 +3,4 @@ require "sneakers"
3
3
  require "appfuel/service/version"
4
4
  require "appfuel/service/msg_request"
5
5
  require "appfuel/service/worker"
6
+ require "appfuel/service/config"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appfuel-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Scott-Buccleuch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-06 00:00:00.000000000 Z
11
+ date: 2017-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appfuel
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.6
19
+ version: 0.2.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.6
26
+ version: 0.2.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sneakers
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +100,13 @@ files:
100
100
  - bin/console
101
101
  - bin/setup
102
102
  - lib/appfuel/service.rb
103
+ - lib/appfuel/service/config.rb
104
+ - lib/appfuel/service/config/aws.rb
105
+ - lib/appfuel/service/config/database.rb
106
+ - lib/appfuel/service/config/newrelic.rb
107
+ - lib/appfuel/service/config/sentry.rb
108
+ - lib/appfuel/service/config/sneakers.rb
109
+ - lib/appfuel/service/config/worker.rb
103
110
  - lib/appfuel/service/msg_request.rb
104
111
  - lib/appfuel/service/version.rb
105
112
  - lib/appfuel/service/worker.rb