smart_domain 0.1.0 → 0.1.2

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +65 -0
  3. data/CHANGELOG.md +6 -8
  4. data/README.md +52 -0
  5. data/Rakefile +3 -3
  6. data/lib/generators/{active_domain → smart_domain}/domain/domain_generator.rb +16 -16
  7. data/lib/generators/{active_domain → smart_domain}/domain/templates/events/created_event.rb.tt +1 -1
  8. data/lib/generators/{active_domain → smart_domain}/domain/templates/events/deleted_event.rb.tt +1 -1
  9. data/lib/generators/{active_domain → smart_domain}/domain/templates/events/updated_event.rb.tt +2 -2
  10. data/lib/generators/{active_domain → smart_domain}/domain/templates/service.rb.tt +5 -5
  11. data/lib/generators/{active_domain → smart_domain}/domain/templates/setup.rb.tt +4 -4
  12. data/lib/generators/{active_domain → smart_domain}/install/install_generator.rb +13 -13
  13. data/lib/smart_domain/configuration.rb +1 -1
  14. data/lib/smart_domain/domain/exceptions.rb +2 -2
  15. data/lib/smart_domain/domain/service.rb +1 -1
  16. data/lib/smart_domain/event/adapters/memory.rb +24 -9
  17. data/lib/smart_domain/event/base.rb +26 -13
  18. data/lib/smart_domain/event/handler.rb +5 -3
  19. data/lib/smart_domain/event/mixins.rb +11 -1
  20. data/lib/smart_domain/event/registration.rb +4 -4
  21. data/lib/smart_domain/generators/domain_generator.rb +1 -1
  22. data/lib/smart_domain/generators/install_generator.rb +1 -1
  23. data/lib/smart_domain/handlers/audit_handler.rb +22 -24
  24. data/lib/smart_domain/handlers/metrics_handler.rb +8 -1
  25. data/lib/smart_domain/integration/active_record.rb +6 -8
  26. data/lib/smart_domain/railtie.rb +24 -24
  27. data/lib/smart_domain/tasks/domains.rake +18 -14
  28. data/lib/smart_domain/version.rb +1 -1
  29. data/lib/smart_domain.rb +20 -20
  30. data/smart_domain.gemspec +26 -25
  31. metadata +32 -43
  32. data/examples/blog_app/.kamal/hooks/docker-setup.sample +0 -3
  33. data/examples/blog_app/.kamal/hooks/post-app-boot.sample +0 -3
  34. data/examples/blog_app/.kamal/hooks/post-deploy.sample +0 -14
  35. data/examples/blog_app/.kamal/hooks/post-proxy-reboot.sample +0 -3
  36. data/examples/blog_app/.kamal/hooks/pre-app-boot.sample +0 -3
  37. data/examples/blog_app/.kamal/hooks/pre-build.sample +0 -51
  38. data/examples/blog_app/.kamal/hooks/pre-connect.sample +0 -47
  39. data/examples/blog_app/.kamal/hooks/pre-deploy.sample +0 -122
  40. data/examples/blog_app/.kamal/hooks/pre-proxy-reboot.sample +0 -3
  41. data/examples/blog_app/.kamal/secrets +0 -20
  42. data/examples/blog_app/bin/kamal +0 -27
  43. data/examples/blog_app/config/deploy.yml +0 -120
  44. data/examples/blog_app/config/master.key +0 -1
  45. /data/examples/blog_app/config/initializers/{active_domain.rb → smart_domain.rb} +0 -0
  46. /data/lib/generators/{active_domain → smart_domain}/domain/templates/policy.rb.tt +0 -0
  47. /data/lib/generators/{active_domain → smart_domain}/install/templates/README +0 -0
  48. /data/lib/generators/{active_domain → smart_domain}/install/templates/application_event.rb +0 -0
  49. /data/lib/generators/{active_domain → smart_domain}/install/templates/application_policy.rb +0 -0
  50. /data/lib/generators/{active_domain → smart_domain}/install/templates/application_service.rb +0 -0
  51. /data/lib/generators/{active_domain → smart_domain}/install/templates/initializer.rb +0 -0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_domain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rachid Al Maach
@@ -11,7 +11,7 @@ cert_chain: []
11
11
  date: 2025-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: activemodel
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '7.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: activemodel
28
+ name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '7.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: activerecord
56
+ name: rails
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,61 +67,61 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '7.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec
70
+ name: factory_bot_rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.12'
75
+ version: '6.2'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.12'
82
+ version: '6.2'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec-rails
84
+ name: faker
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '6.0'
89
+ version: '3.2'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '6.0'
96
+ version: '3.2'
97
97
  - !ruby/object:Gem::Dependency
98
- name: factory_bot_rails
98
+ name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '6.2'
103
+ version: '3.12'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '6.2'
110
+ version: '3.12'
111
111
  - !ruby/object:Gem::Dependency
112
- name: faker
112
+ name: rspec-rails
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '3.2'
117
+ version: '6.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '3.2'
124
+ version: '6.0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rubocop
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -191,6 +191,7 @@ extensions: []
191
191
  extra_rdoc_files: []
192
192
  files:
193
193
  - ".rspec"
194
+ - ".rubocop.yml"
194
195
  - CHANGELOG.md
195
196
  - LICENSE
196
197
  - README.md
@@ -199,16 +200,6 @@ files:
199
200
  - examples/blog_app/.github/dependabot.yml
200
201
  - examples/blog_app/.github/workflows/ci.yml
201
202
  - examples/blog_app/.gitignore
202
- - examples/blog_app/.kamal/hooks/docker-setup.sample
203
- - examples/blog_app/.kamal/hooks/post-app-boot.sample
204
- - examples/blog_app/.kamal/hooks/post-deploy.sample
205
- - examples/blog_app/.kamal/hooks/post-proxy-reboot.sample
206
- - examples/blog_app/.kamal/hooks/pre-app-boot.sample
207
- - examples/blog_app/.kamal/hooks/pre-build.sample
208
- - examples/blog_app/.kamal/hooks/pre-connect.sample
209
- - examples/blog_app/.kamal/hooks/pre-deploy.sample
210
- - examples/blog_app/.kamal/hooks/pre-proxy-reboot.sample
211
- - examples/blog_app/.kamal/secrets
212
203
  - examples/blog_app/.rubocop.yml
213
204
  - examples/blog_app/.ruby-version
214
205
  - examples/blog_app/Dockerfile
@@ -271,7 +262,6 @@ files:
271
262
  - examples/blog_app/bin/docker-entrypoint
272
263
  - examples/blog_app/bin/importmap
273
264
  - examples/blog_app/bin/jobs
274
- - examples/blog_app/bin/kamal
275
265
  - examples/blog_app/bin/rails
276
266
  - examples/blog_app/bin/rake
277
267
  - examples/blog_app/bin/rubocop
@@ -286,19 +276,17 @@ files:
286
276
  - examples/blog_app/config/ci.rb
287
277
  - examples/blog_app/config/credentials.yml.enc
288
278
  - examples/blog_app/config/database.yml
289
- - examples/blog_app/config/deploy.yml
290
279
  - examples/blog_app/config/environment.rb
291
280
  - examples/blog_app/config/environments/development.rb
292
281
  - examples/blog_app/config/environments/production.rb
293
282
  - examples/blog_app/config/environments/test.rb
294
283
  - examples/blog_app/config/importmap.rb
295
- - examples/blog_app/config/initializers/active_domain.rb
296
284
  - examples/blog_app/config/initializers/assets.rb
297
285
  - examples/blog_app/config/initializers/content_security_policy.rb
298
286
  - examples/blog_app/config/initializers/filter_parameter_logging.rb
299
287
  - examples/blog_app/config/initializers/inflections.rb
288
+ - examples/blog_app/config/initializers/smart_domain.rb
300
289
  - examples/blog_app/config/locales/en.yml
301
- - examples/blog_app/config/master.key
302
290
  - examples/blog_app/config/puma.rb
303
291
  - examples/blog_app/config/queue.yml
304
292
  - examples/blog_app/config/recurring.yml
@@ -329,19 +317,19 @@ files:
329
317
  - examples/blog_app/tmp/.keep
330
318
  - examples/blog_app/vendor/.keep
331
319
  - examples/blog_app/vendor/javascript/.keep
332
- - lib/generators/active_domain/domain/domain_generator.rb
333
- - lib/generators/active_domain/domain/templates/events/created_event.rb.tt
334
- - lib/generators/active_domain/domain/templates/events/deleted_event.rb.tt
335
- - lib/generators/active_domain/domain/templates/events/updated_event.rb.tt
336
- - lib/generators/active_domain/domain/templates/policy.rb.tt
337
- - lib/generators/active_domain/domain/templates/service.rb.tt
338
- - lib/generators/active_domain/domain/templates/setup.rb.tt
339
- - lib/generators/active_domain/install/install_generator.rb
340
- - lib/generators/active_domain/install/templates/README
341
- - lib/generators/active_domain/install/templates/application_event.rb
342
- - lib/generators/active_domain/install/templates/application_policy.rb
343
- - lib/generators/active_domain/install/templates/application_service.rb
344
- - lib/generators/active_domain/install/templates/initializer.rb
320
+ - lib/generators/smart_domain/domain/domain_generator.rb
321
+ - lib/generators/smart_domain/domain/templates/events/created_event.rb.tt
322
+ - lib/generators/smart_domain/domain/templates/events/deleted_event.rb.tt
323
+ - lib/generators/smart_domain/domain/templates/events/updated_event.rb.tt
324
+ - lib/generators/smart_domain/domain/templates/policy.rb.tt
325
+ - lib/generators/smart_domain/domain/templates/service.rb.tt
326
+ - lib/generators/smart_domain/domain/templates/setup.rb.tt
327
+ - lib/generators/smart_domain/install/install_generator.rb
328
+ - lib/generators/smart_domain/install/templates/README
329
+ - lib/generators/smart_domain/install/templates/application_event.rb
330
+ - lib/generators/smart_domain/install/templates/application_policy.rb
331
+ - lib/generators/smart_domain/install/templates/application_service.rb
332
+ - lib/generators/smart_domain/install/templates/initializer.rb
345
333
  - lib/smart_domain.rb
346
334
  - lib/smart_domain/configuration.rb
347
335
  - lib/smart_domain/domain/exceptions.rb
@@ -369,6 +357,7 @@ metadata:
369
357
  homepage_uri: https://github.com/rachid/smart_domain
370
358
  source_code_uri: https://github.com/rachid/smart_domain
371
359
  changelog_uri: https://github.com/rachid/smart_domain/blob/main/CHANGELOG.md
360
+ rubygems_mfa_required: 'true'
372
361
  post_install_message:
373
362
  rdoc_options: []
374
363
  require_paths:
@@ -1,3 +0,0 @@
1
- #!/bin/sh
2
-
3
- echo "Docker set up on $KAMAL_HOSTS..."
@@ -1,3 +0,0 @@
1
- #!/bin/sh
2
-
3
- echo "Booted app version $KAMAL_VERSION on $KAMAL_HOSTS..."
@@ -1,14 +0,0 @@
1
- #!/bin/sh
2
-
3
- # A sample post-deploy hook
4
- #
5
- # These environment variables are available:
6
- # KAMAL_RECORDED_AT
7
- # KAMAL_PERFORMER
8
- # KAMAL_VERSION
9
- # KAMAL_HOSTS
10
- # KAMAL_ROLES (if set)
11
- # KAMAL_DESTINATION (if set)
12
- # KAMAL_RUNTIME
13
-
14
- echo "$KAMAL_PERFORMER deployed $KAMAL_VERSION to $KAMAL_DESTINATION in $KAMAL_RUNTIME seconds"
@@ -1,3 +0,0 @@
1
- #!/bin/sh
2
-
3
- echo "Rebooted kamal-proxy on $KAMAL_HOSTS"
@@ -1,3 +0,0 @@
1
- #!/bin/sh
2
-
3
- echo "Booting app version $KAMAL_VERSION on $KAMAL_HOSTS..."
@@ -1,51 +0,0 @@
1
- #!/bin/sh
2
-
3
- # A sample pre-build hook
4
- #
5
- # Checks:
6
- # 1. We have a clean checkout
7
- # 2. A remote is configured
8
- # 3. The branch has been pushed to the remote
9
- # 4. The version we are deploying matches the remote
10
- #
11
- # These environment variables are available:
12
- # KAMAL_RECORDED_AT
13
- # KAMAL_PERFORMER
14
- # KAMAL_VERSION
15
- # KAMAL_HOSTS
16
- # KAMAL_ROLES (if set)
17
- # KAMAL_DESTINATION (if set)
18
-
19
- if [ -n "$(git status --porcelain)" ]; then
20
- echo "Git checkout is not clean, aborting..." >&2
21
- git status --porcelain >&2
22
- exit 1
23
- fi
24
-
25
- first_remote=$(git remote)
26
-
27
- if [ -z "$first_remote" ]; then
28
- echo "No git remote set, aborting..." >&2
29
- exit 1
30
- fi
31
-
32
- current_branch=$(git branch --show-current)
33
-
34
- if [ -z "$current_branch" ]; then
35
- echo "Not on a git branch, aborting..." >&2
36
- exit 1
37
- fi
38
-
39
- remote_head=$(git ls-remote $first_remote --tags $current_branch | cut -f1)
40
-
41
- if [ -z "$remote_head" ]; then
42
- echo "Branch not pushed to remote, aborting..." >&2
43
- exit 1
44
- fi
45
-
46
- if [ "$KAMAL_VERSION" != "$remote_head" ]; then
47
- echo "Version ($KAMAL_VERSION) does not match remote HEAD ($remote_head), aborting..." >&2
48
- exit 1
49
- fi
50
-
51
- exit 0
@@ -1,47 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # A sample pre-connect check
4
- #
5
- # Warms DNS before connecting to hosts in parallel
6
- #
7
- # These environment variables are available:
8
- # KAMAL_RECORDED_AT
9
- # KAMAL_PERFORMER
10
- # KAMAL_VERSION
11
- # KAMAL_HOSTS
12
- # KAMAL_ROLES (if set)
13
- # KAMAL_DESTINATION (if set)
14
- # KAMAL_RUNTIME
15
-
16
- hosts = ENV["KAMAL_HOSTS"].split(",")
17
- results = nil
18
- max = 3
19
-
20
- elapsed = Benchmark.realtime do
21
- results = hosts.map do |host|
22
- Thread.new do
23
- tries = 1
24
-
25
- begin
26
- Socket.getaddrinfo(host, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)
27
- rescue SocketError
28
- if tries < max
29
- puts "Retrying DNS warmup: #{host}"
30
- tries += 1
31
- sleep rand
32
- retry
33
- else
34
- puts "DNS warmup failed: #{host}"
35
- host
36
- end
37
- end
38
-
39
- tries
40
- end
41
- end.map(&:value)
42
- end
43
-
44
- retries = results.sum - hosts.size
45
- nopes = results.count { |r| r == max }
46
-
47
- puts "Prewarmed %d DNS lookups in %.2f sec: %d retries, %d failures" % [ hosts.size, elapsed, retries, nopes ]
@@ -1,122 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # A sample pre-deploy hook
4
- #
5
- # Checks the Github status of the build, waiting for a pending build to complete for up to 720 seconds.
6
- #
7
- # Fails unless the combined status is "success"
8
- #
9
- # These environment variables are available:
10
- # KAMAL_RECORDED_AT
11
- # KAMAL_PERFORMER
12
- # KAMAL_VERSION
13
- # KAMAL_HOSTS
14
- # KAMAL_COMMAND
15
- # KAMAL_SUBCOMMAND
16
- # KAMAL_ROLES (if set)
17
- # KAMAL_DESTINATION (if set)
18
-
19
- # Only check the build status for production deployments
20
- if ENV["KAMAL_COMMAND"] == "rollback" || ENV["KAMAL_DESTINATION"] != "production"
21
- exit 0
22
- end
23
-
24
- require "bundler/inline"
25
-
26
- # true = install gems so this is fast on repeat invocations
27
- gemfile(true, quiet: true) do
28
- source "https://rubygems.org"
29
-
30
- gem "octokit"
31
- gem "faraday-retry"
32
- end
33
-
34
- MAX_ATTEMPTS = 72
35
- ATTEMPTS_GAP = 10
36
-
37
- def exit_with_error(message)
38
- $stderr.puts message
39
- exit 1
40
- end
41
-
42
- class GithubStatusChecks
43
- attr_reader :remote_url, :git_sha, :github_client, :combined_status
44
-
45
- def initialize
46
- @remote_url = github_repo_from_remote_url
47
- @git_sha = `git rev-parse HEAD`.strip
48
- @github_client = Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"])
49
- refresh!
50
- end
51
-
52
- def refresh!
53
- @combined_status = github_client.combined_status(remote_url, git_sha)
54
- end
55
-
56
- def state
57
- combined_status[:state]
58
- end
59
-
60
- def first_status_url
61
- first_status = combined_status[:statuses].find { |status| status[:state] == state }
62
- first_status && first_status[:target_url]
63
- end
64
-
65
- def complete_count
66
- combined_status[:statuses].count { |status| status[:state] != "pending"}
67
- end
68
-
69
- def total_count
70
- combined_status[:statuses].count
71
- end
72
-
73
- def current_status
74
- if total_count > 0
75
- "Completed #{complete_count}/#{total_count} checks, see #{first_status_url} ..."
76
- else
77
- "Build not started..."
78
- end
79
- end
80
-
81
- private
82
- def github_repo_from_remote_url
83
- url = `git config --get remote.origin.url`.strip.delete_suffix(".git")
84
- if url.start_with?("https://github.com/")
85
- url.delete_prefix("https://github.com/")
86
- elsif url.start_with?("git@github.com:")
87
- url.delete_prefix("git@github.com:")
88
- else
89
- url
90
- end
91
- end
92
- end
93
-
94
-
95
- $stdout.sync = true
96
-
97
- begin
98
- puts "Checking build status..."
99
-
100
- attempts = 0
101
- checks = GithubStatusChecks.new
102
-
103
- loop do
104
- case checks.state
105
- when "success"
106
- puts "Checks passed, see #{checks.first_status_url}"
107
- exit 0
108
- when "failure"
109
- exit_with_error "Checks failed, see #{checks.first_status_url}"
110
- when "pending"
111
- attempts += 1
112
- end
113
-
114
- exit_with_error "Checks are still pending, gave up after #{MAX_ATTEMPTS * ATTEMPTS_GAP} seconds" if attempts == MAX_ATTEMPTS
115
-
116
- puts checks.current_status
117
- sleep(ATTEMPTS_GAP)
118
- checks.refresh!
119
- end
120
- rescue Octokit::NotFound
121
- exit_with_error "Build status could not be found"
122
- end
@@ -1,3 +0,0 @@
1
- #!/bin/sh
2
-
3
- echo "Rebooting kamal-proxy on $KAMAL_HOSTS..."
@@ -1,20 +0,0 @@
1
- # Secrets defined here are available for reference under registry/password, env/secret, builder/secrets,
2
- # and accessories/*/env/secret in config/deploy.yml. All secrets should be pulled from either
3
- # password manager, ENV, or a file. DO NOT ENTER RAW CREDENTIALS HERE! This file needs to be safe for git.
4
-
5
- # Example of extracting secrets from 1password (or another compatible pw manager)
6
- # SECRETS=$(kamal secrets fetch --adapter 1password --account your-account --from Vault/Item KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY)
7
- # KAMAL_REGISTRY_PASSWORD=$(kamal secrets extract KAMAL_REGISTRY_PASSWORD ${SECRETS})
8
- # RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY ${SECRETS})
9
-
10
- # Example of extracting secrets from Rails credentials
11
- # KAMAL_REGISTRY_PASSWORD=$(rails credentials:fetch kamal.registry_password)
12
-
13
- # Use a GITHUB_TOKEN if private repositories are needed for the image
14
- # GITHUB_TOKEN=$(gh config get -h github.com oauth_token)
15
-
16
- # Grab the registry password from ENV
17
- # KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
18
-
19
- # Improve security by using a password manager. Never check config/master.key into git!
20
- RAILS_MASTER_KEY=$(cat config/master.key)
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'kamal' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
-
13
- bundle_binstub = File.expand_path("bundle", __dir__)
14
-
15
- if File.file?(bundle_binstub)
16
- if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17
- load(bundle_binstub)
18
- else
19
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
- end
22
- end
23
-
24
- require "rubygems"
25
- require "bundler/setup"
26
-
27
- load Gem.bin_path("kamal", "kamal")
@@ -1,120 +0,0 @@
1
- # Name of your application. Used to uniquely configure containers.
2
- service: blog_app
3
-
4
- # Name of the container image (use your-user/app-name on external registries).
5
- image: blog_app
6
-
7
- # Deploy to these servers.
8
- servers:
9
- web:
10
- - 192.168.0.1
11
- # job:
12
- # hosts:
13
- # - 192.168.0.1
14
- # cmd: bin/jobs
15
-
16
- # Enable SSL auto certification via Let's Encrypt and allow for multiple apps on a single web server.
17
- # If used with Cloudflare, set encryption mode in SSL/TLS setting to "Full" to enable CF-to-app encryption.
18
- #
19
- # Using an SSL proxy like this requires turning on config.assume_ssl and config.force_ssl in production.rb!
20
- #
21
- # Don't use this when deploying to multiple web servers (then you have to terminate SSL at your load balancer).
22
- #
23
- # proxy:
24
- # ssl: true
25
- # host: app.example.com
26
-
27
- # Where you keep your container images.
28
- registry:
29
- # Alternatives: hub.docker.com / registry.digitalocean.com / ghcr.io / ...
30
- server: localhost:5555
31
-
32
- # Needed for authenticated registries.
33
- # username: your-user
34
-
35
- # Always use an access token rather than real password when possible.
36
- # password:
37
- # - KAMAL_REGISTRY_PASSWORD
38
-
39
- # Inject ENV variables into containers (secrets come from .kamal/secrets).
40
- env:
41
- secret:
42
- - RAILS_MASTER_KEY
43
- clear:
44
- # Run the Solid Queue Supervisor inside the web server's Puma process to do jobs.
45
- # When you start using multiple servers, you should split out job processing to a dedicated machine.
46
- SOLID_QUEUE_IN_PUMA: true
47
-
48
- # Set number of processes dedicated to Solid Queue (default: 1)
49
- # JOB_CONCURRENCY: 3
50
-
51
- # Set number of cores available to the application on each server (default: 1).
52
- # WEB_CONCURRENCY: 2
53
-
54
- # Match this to any external database server to configure Active Record correctly
55
- # Use blog_app-db for a db accessory server on same machine via local kamal docker network.
56
- # DB_HOST: 192.168.0.2
57
-
58
- # Log everything from Rails
59
- # RAILS_LOG_LEVEL: debug
60
-
61
- # Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation:
62
- # "bin/kamal logs -r job" will tail logs from the first server in the job section.
63
- aliases:
64
- console: app exec --interactive --reuse "bin/rails console"
65
- shell: app exec --interactive --reuse "bash"
66
- logs: app logs -f
67
- dbc: app exec --interactive --reuse "bin/rails dbconsole --include-password"
68
-
69
- # Use a persistent storage volume for sqlite database files and local Active Storage files.
70
- # Recommended to change this to a mounted volume path that is backed up off server.
71
- volumes:
72
- - "blog_app_storage:/rails/storage"
73
-
74
- # Bridge fingerprinted assets, like JS and CSS, between versions to avoid
75
- # hitting 404 on in-flight requests. Combines all files from new and old
76
- # version inside the asset_path.
77
- asset_path: /rails/public/assets
78
-
79
-
80
- # Configure the image builder.
81
- builder:
82
- arch: amd64
83
-
84
- # # Build image via remote server (useful for faster amd64 builds on arm64 computers)
85
- # remote: ssh://docker@docker-builder-server
86
- #
87
- # # Pass arguments and secrets to the Docker build process
88
- # args:
89
- # RUBY_VERSION: 3.3.6
90
- # secrets:
91
- # - GITHUB_TOKEN
92
- # - RAILS_MASTER_KEY
93
-
94
- # Use a different ssh user than root
95
- # ssh:
96
- # user: app
97
-
98
- # Use accessory services (secrets come from .kamal/secrets).
99
- # accessories:
100
- # db:
101
- # image: mysql:8.0
102
- # host: 192.168.0.2
103
- # # Change to 3306 to expose port to the world instead of just local network.
104
- # port: "127.0.0.1:3306:3306"
105
- # env:
106
- # clear:
107
- # MYSQL_ROOT_HOST: '%'
108
- # secret:
109
- # - MYSQL_ROOT_PASSWORD
110
- # files:
111
- # - config/mysql/production.cnf:/etc/mysql/my.cnf
112
- # - db/production.sql:/docker-entrypoint-initdb.d/setup.sql
113
- # directories:
114
- # - data:/var/lib/mysql
115
- # redis:
116
- # image: valkey/valkey:8
117
- # host: 192.168.0.2
118
- # port: 6379
119
- # directories:
120
- # - data:/data
@@ -1 +0,0 @@
1
- c993036f99084b62923212c97ff582b8