service_skeleton 1.0.5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 020137b90b172033166a44e4e8f94094a2cb35f8886a185dbfaa8a47a29cff71
4
- data.tar.gz: 85da8294b7d0c158404ef42ffb4969a7f02560ad35b4a5b9713bacbfb50ab9f4
3
+ metadata.gz: e244f5193b33614d8466ccb26d2d2d10f8d8d7917c94af1d8a2ddbd492c96cab
4
+ data.tar.gz: 1a80f5e1ed63a03bc4eb9920bc83a4f175fcd383f7aab1c5e732da2e764416ed
5
5
  SHA512:
6
- metadata.gz: 39d9073b15a24f9b13ffc6bcaa7c60756e425301749fdf6b90e08b132bd7eadeb1ac90c75e0398e2704d57e1bc849edb9ecdfd78270d98b033a51dd7277addc0
7
- data.tar.gz: 7cc439b11c6f36df6b2b0282e6f7661ef3c78caa496396ce1260a7d6ab66ccc7aef9a7d5debdd5e38ae2ff74d9833c7bf465f0167d74e7e649b952e882c73858
6
+ metadata.gz: 7f06bfeab8ad7401e2cdfde6ca9b2d89bf2946a65cc319b2861608a3b23a71cab91b9c438f7d212ed8326413a939dbc885d9bbd59871a78172c33e51c8b467a6
7
+ data.tar.gz: 3b3f6caf8be8d1cb07505b1a84f8212621faddf890c89f21988bc611d5e795e023eacb99ea31ab64de0afbf8c919fcfb1da64269494d3e3a9891ba8aa54b6039
@@ -1,46 +1,52 @@
1
- name: CI
1
+ name: Service Skeleton Tests
2
2
 
3
3
  on:
4
4
  pull_request:
5
5
  push:
6
6
  branches:
7
- - "v1_0"
7
+ - master
8
+ tags:
9
+ - v*
8
10
 
9
11
  jobs:
10
12
  build:
11
13
  runs-on: ubuntu-latest
12
-
14
+ name: Ruby ${{ matrix.ruby }}
13
15
  strategy:
14
16
  matrix:
15
- ruby:
16
- - 2.5
17
-
17
+ ruby: ["2.5", "2.6", "2.7"]
18
18
  steps:
19
19
  - uses: actions/checkout@v2
20
-
21
- - name: Setup ruby
22
- uses: ruby/setup-ruby@v1
20
+ with:
21
+ fetch-depth: 0 # Fetch all history. Needed for `git describe`
22
+ - uses: actions/setup-ruby@v1
23
23
  with:
24
24
  ruby-version: ${{ matrix.ruby }}
25
- bundler-cache: true
26
-
27
- - name: Lint
25
+ - name: Bundler cache
26
+ uses: actions/cache@v2
27
+ with:
28
+ path: vendor/bundle
29
+ key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
30
+ restore-keys: |
31
+ ${{ runner.os }}-${{ matrix.ruby }}-gems-
32
+ - name: Setup gems
33
+ run: |
34
+ gem install bundler
35
+ bundle config path vendor/bundle
36
+ bundle install --jobs 4
37
+ - name: Rubocop
28
38
  run: bundle exec rubocop
29
-
30
39
  - name: Tests
31
- run: bundle exec rake test
32
-
40
+ run: bundle exec rspec
41
+ - name: Ultravisor Tests
42
+ run: bundle exec rspec ultravisor/spec
33
43
  publish:
34
- if: github.event_name == 'push' && (github.ref == 'refs/heads/v1_0')
44
+ if: contains(github.ref, 'refs/tags/v')
35
45
  needs: build
36
46
  runs-on: ubuntu-latest
37
-
38
47
  steps:
39
48
  - uses: actions/checkout@v2
40
-
41
49
  - name: Release Gem
42
- uses: discourse/publish-rubygems-action@v2-beta
50
+ uses: discourse/publish-rubygems-action@v1
43
51
  env:
44
- RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
45
- GIT_EMAIL: team@discourse.org
46
- GIT_NAME: discoursebot
52
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
data/.gitignore CHANGED
@@ -1,2 +1,9 @@
1
1
  Gemfile.lock
2
+ /pkg
3
+ /doc
4
+ /.yardoc
2
5
  /coverage
6
+ /.bundle
7
+ /tmp
8
+
9
+ .rubocop-https---raw-githubusercontent-com-discourse-discourse-master--rubocop-yml
data/README.md CHANGED
@@ -448,8 +448,7 @@ portion is the all-uppercase [service name](#the-service-name).
448
448
 
449
449
  INFO,buggy=DEBUG,/noisy/i=ERROR
450
450
 
451
- Logging levels can be changed at runtime, via [signals](#default-signals) or
452
- [the HTTP admin interface](#http-admin-interface).
451
+ Logging levels can be changed at runtime via [signals](#default-signals).
453
452
 
454
453
  * **`<SERVICENAME>_LOGSTASH_SERVER`** (string; default `""`) -- if set to a
455
454
  non-empty string, we will engage the services of the [loggerstash
@@ -686,57 +685,6 @@ When the service is shutdown, all signal handlers will be automatically
686
685
  unhooked, which saves you having to do it yourself.
687
686
 
688
687
 
689
- ## HTTP Admin Interface
690
-
691
- In these modern times we live in, it seems everything from nuclear reactors to
692
- toasters can be controlled from a browser. Why should your services be any
693
- different?
694
-
695
-
696
- ### HTTP Admin Configuration
697
-
698
- In the spirit of "secure by default", you must explicitly enable the HTTP admin
699
- interface, and configure an authentication method. To do that, use the
700
- following environment variables, where `<SERVICENAME>_` is the all-uppercase
701
- version of [the service name](#the-service-name).
702
-
703
- * **`<SERVICENAME>_HTTP_ADMIN_PORT`** (integer; range 1..65535; default: `""`)
704
- -- if set to a valid port number (`1` to `65535` inclusive), the HTTP admin
705
- interface will listen on that port, if also enabled by configuring
706
- authentication.
707
-
708
- * **`<SERVICENAME>_HTTP_ADMIN_BASIC_AUTH`** (string; default: `""`) -- if set
709
- to a string containing a username and password separated by a colon, then
710
- authentication via [HTTP Basic auth](https://tools.ietf.org/html/rfc7617)
711
- will be supported. Note that in addition to this setting, an admin port must
712
- also be specified in order for the admin interface to be enabled.
713
-
714
- * **`<SERVICENAME>_HTTP_ADMIN_PROXY_USERNAME_HEADER`** (string; default: `""`)
715
- -- if set to a non-empty string, then incoming requests will be examined for
716
- a HTTP header with the specified name. If such a header exists and has a
717
- non-empty value, then the request will be deemed to have been authenticated
718
- by an upstream authenticating proxy (such as
719
- [`discourse-auth-proxy`](https://github.com/discourse/discourse-auth-proxy))
720
- as the user given in the header value. Note that in addition to this
721
- setting, an admin port must also be specified in order for the admin
722
- interface to be enabled.
723
-
724
-
725
- ### HTTP Admin Usage
726
-
727
- The HTTP admin interface provides both an interactive, browser-based mode,
728
- as well as a RESTful interface, which should, in general, provide equivalent
729
- functionality.
730
-
731
- * Visiting the service's `IP address:port` in a web browser will bring up an HTML
732
- interface showing all the features that are available. Usage should
733
- (hopefully) be self-explanatory.
734
-
735
- * Visiting the service's `IP address:port` whilst accepting `application/json`
736
- responses will provide a directory of links to available endpoints which you
737
- can use to interact with the HTTP admin interface programmatically.
738
-
739
-
740
688
  # Contributing
741
689
 
742
690
  Patches can be sent as [a Github pull
@@ -4,16 +4,8 @@ module ServiceSkeleton
4
4
  module UltravisorLoggerstash
5
5
  def logstash_writer
6
6
  #:nocov:
7
- @ultravisor[:logstash_writer].unsafe_instance(wait: false)
7
+ @ultravisor[:logstash_writer].unsafe_instance
8
8
  #:nocov:
9
9
  end
10
-
11
- # logstash_writer will be nil if the logstash_writer worker is not running
12
- # Ultravisor's restart policy ensures this will never happen at runtime. But
13
- # it does happen during startup and shutdown. In this case, we want to skip
14
- # writing to logstash, not block forever. STDOUT logging will continue.
15
- def loggerstash_log_message(*args)
16
- super if !logstash_writer.nil?
17
- end
18
10
  end
19
11
  end
@@ -1,15 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- begin
4
- require 'git-version-bump'
5
- rescue LoadError
6
- nil
7
- end
8
-
9
3
  Gem::Specification.new do |s|
10
4
  s.name = "service_skeleton"
11
5
 
12
- s.version = '1.0.5'
6
+ s.version = '2.0.0'
13
7
 
14
8
  s.platform = Gem::Platform::RUBY
15
9
 
@@ -32,14 +26,12 @@ Gem::Specification.new do |s|
32
26
  s.required_ruby_version = ">= 2.5.0"
33
27
 
34
28
  s.add_runtime_dependency "frankenstein", "~> 2.0"
35
- s.add_runtime_dependency "loggerstash", ">= 0.0.9", "< 1"
29
+ s.add_runtime_dependency "loggerstash", "~> 1"
36
30
  s.add_runtime_dependency "prometheus-client", "~> 2.0"
37
31
  s.add_runtime_dependency "sigdump", "~> 0.2"
38
32
  s.add_runtime_dependency "to_regexp", "~> 0.2"
39
33
 
40
34
  s.add_development_dependency 'bundler'
41
- s.add_development_dependency 'github-release'
42
- s.add_development_dependency 'git-version-bump'
43
35
  s.add_development_dependency 'guard-rspec'
44
36
  s.add_development_dependency 'guard-rubocop'
45
37
  s.add_development_dependency 'rack-test'
@@ -185,13 +185,13 @@ class Ultravisor
185
185
  !!(@restart == :always || (@restart == :on_failure && termination_exception))
186
186
  end
187
187
 
188
- def unsafe_instance(wait: true)
188
+ def unsafe_instance
189
189
  unless @access == :unsafe
190
190
  raise Ultravisor::ThreadSafetyError,
191
191
  "#unsafe_instance called on a child not declared with access: :unsafe"
192
192
  end
193
193
 
194
- current_instance(wait: wait)
194
+ current_instance
195
195
  end
196
196
 
197
197
  def cast
@@ -394,9 +394,9 @@ class Ultravisor
394
394
  end
395
395
  end
396
396
 
397
- def current_instance(wait: true)
397
+ def current_instance
398
398
  @spawn_m.synchronize do
399
- while wait && @instance.nil?
399
+ while @instance.nil?
400
400
  @spawn_cv.wait(@spawn_m)
401
401
  end
402
402
 
@@ -49,8 +49,4 @@ RSpec.configure do |config|
49
49
  config.mock_with :rspec do |mocks|
50
50
  mocks.verify_partial_doubles = true
51
51
  end
52
-
53
- config.after(:each) do
54
- Thread.current.name = nil
55
- end
56
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_skeleton
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Palmer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-03-04 00:00:00.000000000 Z
12
+ date: 2021-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: frankenstein
@@ -29,20 +29,14 @@ dependencies:
29
29
  name: loggerstash
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 0.0.9
35
- - - "<"
32
+ - - "~>"
36
33
  - !ruby/object:Gem::Version
37
34
  version: '1'
38
35
  type: :runtime
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
41
38
  requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: 0.0.9
45
- - - "<"
39
+ - - "~>"
46
40
  - !ruby/object:Gem::Version
47
41
  version: '1'
48
42
  - !ruby/object:Gem::Dependency
@@ -101,34 +95,6 @@ dependencies:
101
95
  - - ">="
102
96
  - !ruby/object:Gem::Version
103
97
  version: '0'
104
- - !ruby/object:Gem::Dependency
105
- name: github-release
106
- requirement: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- type: :development
112
- prerelease: false
113
- version_requirements: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- - !ruby/object:Gem::Dependency
119
- name: git-version-bump
120
- requirement: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- type: :development
126
- prerelease: false
127
- version_requirements: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
98
  - !ruby/object:Gem::Dependency
133
99
  name: guard-rspec
134
100
  requirement: !ruby/object:Gem::Requirement
@@ -368,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
368
334
  - !ruby/object:Gem::Version
369
335
  version: '0'
370
336
  requirements: []
371
- rubygems_version: 3.1.4
337
+ rubygems_version: 3.0.3
372
338
  signing_key:
373
339
  specification_version: 4
374
340
  summary: The bare bones of a service