bullion 0.9.0 → 0.10.0

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
  SHA256:
3
- metadata.gz: 492f8a3bde7d33dbbea336746adb4c37e479cef37f3057818090a7f1603d72db
4
- data.tar.gz: 1bb02e31080caef0cb917ac178605f65fb33aa40f8c0790d970c3902e7990b5e
3
+ metadata.gz: 74fbfc1ee8b98c2ff1c707302c8e62c9b2f8d106308b8b3b02d6a1ffe622cb77
4
+ data.tar.gz: adbd79fc4e82a9630dee2dd71c1e33c7e0a8f02732c986af07b1ba3d1733fd5c
5
5
  SHA512:
6
- metadata.gz: 553bc8beb6536fd32b0ca0ac43ea86031747e0758c2c819f38c5e4243664091f6d3509b721d1207ac7596a1d668ba6483e57dbda3f4190d47c4260cc2bdf6ee1
7
- data.tar.gz: a24b70400af69f84513725fdeb28a6365660509c796704dabffc9cb68e44d3288fe6b757e4bdf5d9231d45a48a04b11542ac6517c010275c49d7a9651d81f7f3
6
+ metadata.gz: f1cfc723554109cdb6e837e2dabd66eed6dd52d3cd7ca649923f88940c31e83e957e749ec1449c6eef4ffbcc89aafbbf822a3725b55688a3dc5d4290bd63552b
7
+ data.tar.gz: ccbe2a235fa91b4568b6977f55b22122de5f0fc1e0c2620c4ef9e16dfc4ce618ccff0322ea1e5c9dc3711f2dc10b22a9dc0bcd5c45d406adb08640229ec78048
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.9.0"
2
+ ".": "0.10.0"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.10.0](https://github.com/jgnagy/bullion/compare/bullion/v0.9.0...bullion/v0.10.0) (2025-07-05)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * update Docker image with Itsi configuration
9
+
10
+ ### Bug Fixes
11
+
12
+ * update Docker image with Itsi configuration ([4be39dd](https://github.com/jgnagy/bullion/commit/4be39dd6200f058907029e23a07f19241705b701))
13
+
3
14
  ## [0.9.0](https://github.com/jgnagy/bullion/compare/bullion/v0.8.0...bullion/v0.9.0) (2025-07-05)
4
15
 
5
16
 
data/Dockerfile CHANGED
@@ -16,7 +16,7 @@ FROM ruby:3.4.4
16
16
  LABEL maintainer="Jonathan Gnagy <jonathan.gnagy@gmail.com>"
17
17
 
18
18
  ENV BULLION_PORT=9292
19
- ENV BULLION_ENVIRONMENT=development
19
+ ENV RACK_ENV=production
20
20
  ENV DATABASE_URL=sqlite3:///tmp/bullion.db
21
21
 
22
22
  RUN apt-get update && apt-get upgrade -y && apt-get -y install libsqlite3-dev sqlite3 curl libsodium-dev build-essential libclang-dev
@@ -27,6 +27,7 @@ COPY ./scripts/docker-entrypoint.sh /entrypoint.sh
27
27
  COPY --from=build /bullion.gem /app/bullion.gem
28
28
  COPY ./db /app/db
29
29
  COPY ./config.ru /app/config.ru
30
+ COPY ./Itsi.rb /app/Itsi.rb
30
31
  COPY ./Rakefile /app/Rakefile
31
32
 
32
33
  RUN mkdir /ssl
@@ -34,7 +35,8 @@ RUN mkdir /ssl
34
35
  RUN chmod +x /entrypoint.sh \
35
36
  && chown nobody /app/db \
36
37
  && chown nobody /app/db/schema.rb \
37
- && chown -R nobody:nogroup /ssl
38
+ && chown -R nobody:nogroup /ssl \
39
+ && chown nobody /app
38
40
 
39
41
  WORKDIR /app
40
42
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bullion (0.9.0)
4
+ bullion (0.10.0)
5
5
  benchmark (~> 0.4)
6
6
  dry-configurable (~> 1.1)
7
7
  httparty (~> 0.21)
data/Itsi.rb CHANGED
@@ -10,13 +10,13 @@ env = ENV.fetch("APP_ENV") { ENV.fetch("RACK_ENV", "development") }
10
10
 
11
11
  # Number of worker processes to spawn
12
12
  # If more than 1, Itsi will be booted in Cluster mode
13
- workers ENV["ITSI_WORKERS"]&.to_i || (env == "development" ? 1 : nil)
13
+ workers ENV["WORKERS"]&.to_i || (env == "development" ? 1 : nil)
14
14
 
15
15
  # Number of threads to spawn per worker process
16
16
  # For pure CPU bound applicationss, you'll get the best results keeping this number low
17
17
  # Setting a value of 1 is great for superficial benchmarks, but in reality
18
18
  # it's better to set this a bit higher to allow expensive requests to get overtaken and minimize head-of-line blocking
19
- threads ENV.fetch("ITSI_THREADS", 3)
19
+ threads ENV.fetch("THREADS", 3).to_i
20
20
 
21
21
  # If your application is IO bound (e.g. performing a lot of proxied HTTP requests, or heavy queries etc)
22
22
  # you can see *substantial* benefits from enabling this option.
@@ -24,7 +24,7 @@ threads ENV.fetch("ITSI_THREADS", 3)
24
24
  # E.g.
25
25
  # `fiber_scheduler "Itsi::Scheduler"` - The default fast and light-weight scheduler that comes with Itsi
26
26
  # `fiber_scheduler "Async::Scheduler"` - Bring your own scheduler!
27
- fiber_scheduler nil
27
+ fiber_scheduler "Itsi::Scheduler"
28
28
 
29
29
  # If you bind to https, without specifying a certificate, Itsi will use a self-signed certificate.
30
30
  # The self-signed certificate will use a CA generated for your
@@ -45,7 +45,7 @@ fiber_scheduler nil
45
45
  # bind "unix:///tmp/itsi.sock"
46
46
  # bind "tls:///tmp/itsi.secure.sock"
47
47
 
48
- bind "http://0.0.0.0:9292"
48
+ bind "http://0.0.0.0:#{ENV.fetch("BULLION_PORT", 9292)}"
49
49
 
50
50
  # If you want to preload the application, set preload to true
51
51
  # to load the entire rack-app defined in rack_file_name before forking.
@@ -64,7 +64,7 @@ preload true
64
64
  # When this limit is reached, the worker will be gracefully restarted.
65
65
  # Only one worker is restarted at a time to ensure we don't take down
66
66
  # all of them at once, if they reach the threshold simultaneously.
67
- worker_memory_limit 1024 * 1024 * 1024
67
+ worker_memory_limit ENV.fetch("WORKER_MEMORY_LIMIT") { 1024 * 1024 * 1024 } # Default to 1GB
68
68
 
69
69
  # You can provide an optional block of code to run, when a worker hits its memory threshold
70
70
  # (Use this to send yourself an alert,
@@ -96,7 +96,7 @@ oob_gc_responses_threshold 512
96
96
  # Log level
97
97
  # Set this to one of the following values: debug, info, warn, error, fatal
98
98
  # Can also be set using the ITSI_LOG environment variable
99
- log_level :info
99
+ log_level ENV.fetch("LOG_LEVEL", "warn").to_sym
100
100
 
101
101
  # Log Format
102
102
  # Set this to be either :plain or :json. If you leave it blank Itsi will try
data/README.md CHANGED
@@ -40,8 +40,9 @@ Whether run locally or via Docker, the following environment variables configure
40
40
  | `DNS01_NAMESERVERS` | _None_ | A comma-delimited list of nameservers to use for resolving [DNS-01](https://letsencrypt.org/docs/challenge-types/#dns-01-challenge) challenges. Usually you'll want this to be set to your _internal_ nameservers so internal names resolve correctly. When not set, it'll use the host's DNS. |
41
41
  | `LOG_LEVEL` | `warn` | Log level for Bullion. Supported levels (starting with the noisiest) are debug, info, warn, error, and fatal. |
42
42
  | `BULLION_PORT` | `9292` | TCP port Bullion will listen on. |
43
- | `MIN_THREADS` | `2` | Minimum number of [Puma](https://puma.io/) threads for processing requests. |
44
- | `MAX_THREADS` | `32` | Maximum number of [Puma](https://puma.io/) threads for processing requests. |
43
+ | `THREADS` | `3` | Number of [Itsi threads](https://itsi.fyi/options/threads/) for processing requests. |
44
+ | `WORKERS` | `1` | Number of [Itsi workers](https://itsi.fyi/options/workers/) to spawn. |
45
+ | `WORKER_MEMORY_LIMIT` | `1024**3` | [Itsi worker memory limit](https://itsi.fyi/options/worker_memory_limit/) for each worker process (in bytes). Default is 1GiB. |
45
46
  | `RACK_ENV` | `production`* | When run via Docker, the default is `production`, when run via `rake local_demo` it is `development`. Used to tell Bullion if it is run in development mode or for testing. |
46
47
 
47
48
  ### Integrating
data/Rakefile CHANGED
@@ -4,12 +4,62 @@ ENV["RACK_ENV"] ||= "development"
4
4
 
5
5
  if %w[development test].include? ENV["RACK_ENV"]
6
6
  ENV["DATABASE_URL"] = "sqlite3:#{File.expand_path(".")}/tmp/db/#{ENV["RACK_ENV"]}.sqlite3"
7
+ require "bundler/gem_tasks"
8
+ require "rspec/core/rake_task"
9
+ require "rubocop/rake_task"
10
+ require "yard"
11
+
12
+ RSpec::Core::RakeTask.new(:spec) do |t|
13
+ t.exclude_pattern = "spec/integration/**{,/*/**}/*_spec.rb"
14
+ t.rspec_opts = "--require spec_helper"
15
+ end
16
+ RSpec::Core::RakeTask.new(:integration_testing) do |t|
17
+ t.pattern = "spec/integration/**{,/*/**}/*_spec.rb"
18
+ t.rspec_opts = "--require integration_helper"
19
+ end
20
+ RuboCop::RakeTask.new(:rubocop)
21
+ YARD::Rake::YardocTask.new
22
+
23
+ desc "Runs a backgrounded demo environment"
24
+ task :demo do
25
+ rack_env = "test"
26
+ database_url = "sqlite3:#{File.expand_path(".")}/tmp/db/#{rack_env}.sqlite3"
27
+ system("RACK_ENV=\"#{rack_env}\" DATABASE_URL=\"#{database_url}\" bundle exec rake db:migrate")
28
+ system(
29
+ "RACK_ENV=\"#{rack_env}\" DATABASE_URL=\"#{database_url}\" " \
30
+ "LOG_LEVEL='#{ENV.fetch("LOG_LEVEL", "info")}' " \
31
+ "itsi --daemonize"
32
+ )
33
+ FileUtils.touch(File.join(File.expand_path("."), "tmp", "daemon.pid"))
34
+ end
35
+
36
+ desc "Runs a foregrounded demo environment"
37
+ task :foreground_demo do
38
+ system("itsi")
39
+ end
40
+
41
+ desc "Cleans up test or demo environment"
42
+ task :cleanup do
43
+ at_exit do
44
+ pid_file = File.join(File.expand_path("."), "tmp", "daemon.pid")
45
+ if File.exist?(pid_file)
46
+ system("itsi stop")
47
+ FileUtils.rm_f(pid_file)
48
+ end
49
+ FileUtils.rm_f(File.join(File.expand_path("."), "tmp", "tls.crt"))
50
+ FileUtils.rm_f(File.join(File.expand_path("."), "tmp", "tls.key"))
51
+ FileUtils.rm_f(File.join(File.expand_path("."), "tmp", "root_tls.crt"))
52
+ FileUtils.rm_f(File.join(File.expand_path("."), "tmp", "root_tls.key"))
53
+ FileUtils.rm_rf(File.join(File.expand_path("."), "tmp", "db"))
54
+ ENV["CA_DIR"] = nil
55
+ ENV["CA_SECRET"] = nil
56
+ ENV["CA_DOMAINS"] = nil
57
+ end
58
+ end
59
+
60
+ Rake::Task["integration_testing"].enhance(["cleanup"])
7
61
  end
8
62
 
9
- require "bundler/gem_tasks"
10
- require "rspec/core/rake_task"
11
- require "rubocop/rake_task"
12
- require "yard"
13
63
  require "openssl"
14
64
  require "sqlite3"
15
65
  require "sinatra/activerecord/rake"
@@ -22,17 +72,6 @@ namespace :db do
22
72
  end
23
73
  end
24
74
 
25
- RSpec::Core::RakeTask.new(:spec) do |t|
26
- t.exclude_pattern = "spec/integration/**{,/*/**}/*_spec.rb"
27
- t.rspec_opts = "--require spec_helper"
28
- end
29
- RSpec::Core::RakeTask.new(:integration_testing) do |t|
30
- t.pattern = "spec/integration/**{,/*/**}/*_spec.rb"
31
- t.rspec_opts = "--require integration_helper"
32
- end
33
- RuboCop::RakeTask.new(:rubocop)
34
- YARD::Rake::YardocTask.new
35
-
36
75
  desc "Prepares a demo or test environment"
37
76
  task :prep do
38
77
  FileUtils.mkdir_p(File.join(File.expand_path("."), "tmp"))
@@ -108,45 +147,6 @@ task :prep do
108
147
  )
109
148
  end
110
149
 
111
- desc "Runs a backgrounded demo environment"
112
- task :demo do
113
- rack_env = "test"
114
- database_url = "sqlite3:#{File.expand_path(".")}/tmp/db/#{rack_env}.sqlite3"
115
- system("RACK_ENV=\"#{rack_env}\" DATABASE_URL=\"#{database_url}\" bundle exec rake db:migrate")
116
- system(
117
- "RACK_ENV=\"#{rack_env}\" DATABASE_URL=\"#{database_url}\" " \
118
- "LOG_LEVEL='#{ENV.fetch("LOG_LEVEL", "info")}' " \
119
- "itsi --daemonize"
120
- )
121
- FileUtils.touch(File.join(File.expand_path("."), "tmp", "daemon.pid"))
122
- end
123
-
124
- desc "Runs a foregrounded demo environment"
125
- task :foreground_demo do
126
- system("itsi")
127
- end
128
-
129
- desc "Cleans up test or demo environment"
130
- task :cleanup do
131
- at_exit do
132
- pid_file = File.join(File.expand_path("."), "tmp", "daemon.pid")
133
- if File.exist?(pid_file)
134
- system("itsi stop")
135
- FileUtils.rm_f(pid_file)
136
- end
137
- FileUtils.rm_f(File.join(File.expand_path("."), "tmp", "tls.crt"))
138
- FileUtils.rm_f(File.join(File.expand_path("."), "tmp", "tls.key"))
139
- FileUtils.rm_f(File.join(File.expand_path("."), "tmp", "root_tls.crt"))
140
- FileUtils.rm_f(File.join(File.expand_path("."), "tmp", "root_tls.key"))
141
- FileUtils.rm_rf(File.join(File.expand_path("."), "tmp", "db"))
142
- ENV["CA_DIR"] = nil
143
- ENV["CA_SECRET"] = nil
144
- ENV["CA_DOMAINS"] = nil
145
- end
146
- end
147
-
148
- Rake::Task["integration_testing"].enhance(["cleanup"])
149
-
150
150
  task test: %i[prep db:migrate spec demo integration_testing]
151
151
  task unit: %i[prep db:migrate spec]
152
152
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bullion
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.0"
5
5
  end
@@ -2,8 +2,4 @@
2
2
 
3
3
  # Starts the server
4
4
  rake db:migrate
5
- puma \
6
- -p ${BULLION_PORT:-9292} \
7
- -e ${RACK_ENV:-production} \
8
- -t ${MIN_THREADS:-2}:${MAX_THREADS:-32} \
9
- config.ru
5
+ itsi
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy
@@ -400,7 +400,6 @@ files:
400
400
  - bin/setup
401
401
  - bullion.gemspec
402
402
  - config.ru
403
- - config/puma.rb
404
403
  - db/migrate/20210104000000_create_accounts.rb
405
404
  - db/migrate/20210104060422_create_certificates.rb
406
405
  - db/migrate/20210105060406_create_orders.rb
data/config/puma.rb DELETED
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- threads 2, Integer(ENV.fetch("MAX_THREADS", 32))