brut 0.20.2 → 0.21.0.pre.1
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 +4 -4
- data/lib/brut/cli/apps/deploy/deploy_config.rb +62 -0
- data/lib/brut/cli/apps/deploy/git_checks.rb +54 -0
- data/lib/brut/cli/apps/deploy.rb +275 -304
- data/lib/brut/cli/apps/new/add_segment.rb +5 -0
- data/lib/brut/cli/apps/new/app.rb +10 -0
- data/lib/brut/cli/apps/new/segments/docker_deploy.rb +30 -0
- data/lib/brut/cli/apps/new/segments/sidekiq.rb +8 -8
- data/lib/brut/cli/apps/new/segments.rb +1 -0
- data/lib/brut/cli/commands/base_command.rb +6 -2
- data/lib/brut/framework/app.rb +2 -1
- data/lib/brut/framework/config.rb +13 -1
- data/lib/brut/framework/mcp.rb +1 -4
- data/lib/brut/front_end/csrf_protector.rb +10 -6
- data/lib/brut/front_end/handlers/instrumentation_handler.rb +1 -1
- data/lib/brut/front_end/middlewares/annotate_brut_owned_paths.rb +2 -0
- data/lib/brut/front_end/routing.rb +22 -0
- data/lib/brut/instrumentation/open_telemetry.rb +5 -0
- data/lib/brut/sinatra_helpers.rb +16 -4
- data/lib/brut/spec_support/cli_command_support.rb +60 -7
- data/lib/brut/spec_support/matchers/have_executed.rb +2 -0
- data/lib/brut/version.rb +1 -1
- data/templates/Base/dx/exec +10 -3
- data/templates/segments/DockerDeploy/deploy/Dockerfile +126 -0
- data/templates/segments/DockerDeploy/deploy/deploy_config.rb +17 -0
- data/templates/segments/DockerDeploy/deploy/docker-entrypoint +15 -0
- data/templates/segments/Heroku/deploy/deploy_config.rb +21 -0
- metadata +8 -3
- data/lib/brut/cli/apps/new/old_app.rb +0 -81
- data/templates/segments/Heroku/deploy/docker_config.rb +0 -30
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# This contains settings for your production Docker setup.
|
|
2
|
+
# You own and maintain this file. It is `require`d by brut deploy docker
|
|
3
|
+
class AppDeployConfig < Brut::CLI::Apps::Deploy::Heroku::DeployConfig
|
|
4
|
+
|
|
5
|
+
# Can return a Docker platform is your deployment platform is not
|
|
6
|
+
# linux/amd64. Note that --platform will override this value.
|
|
7
|
+
def platform = nil
|
|
8
|
+
|
|
9
|
+
# Return an array of ProcessDescription instances, that you can
|
|
10
|
+
# create with the `process_description` method.
|
|
11
|
+
#
|
|
12
|
+
# For example, if you have the Sidekiq segment installed, `bin/run sidekiq`
|
|
13
|
+
# runs Sidekiq, so you would implement the method as follows:
|
|
14
|
+
#
|
|
15
|
+
# def additional_processes = [
|
|
16
|
+
# process_description("sidekiq", [ "bundle", "exec", "bin/run sidekiq" ]),
|
|
17
|
+
# ]
|
|
18
|
+
#
|
|
19
|
+
def additional_processes
|
|
20
|
+
end
|
|
21
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: brut
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.21.0.pre.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Bryant Copeland
|
|
@@ -507,6 +507,8 @@ files:
|
|
|
507
507
|
- lib/brut/cli/apps/build_assets.rb
|
|
508
508
|
- lib/brut/cli/apps/db.rb
|
|
509
509
|
- lib/brut/cli/apps/deploy.rb
|
|
510
|
+
- lib/brut/cli/apps/deploy/deploy_config.rb
|
|
511
|
+
- lib/brut/cli/apps/deploy/git_checks.rb
|
|
510
512
|
- lib/brut/cli/apps/new.rb
|
|
511
513
|
- lib/brut/cli/apps/new/add_segment.rb
|
|
512
514
|
- lib/brut/cli/apps/new/add_segment_options.rb
|
|
@@ -517,7 +519,6 @@ files:
|
|
|
517
519
|
- lib/brut/cli/apps/new/erb_binding_delegate.rb
|
|
518
520
|
- lib/brut/cli/apps/new/internet_identifier.rb
|
|
519
521
|
- lib/brut/cli/apps/new/invalid_identifier.rb
|
|
520
|
-
- lib/brut/cli/apps/new/old_app.rb
|
|
521
522
|
- lib/brut/cli/apps/new/ops.rb
|
|
522
523
|
- lib/brut/cli/apps/new/ops/add_css_import.rb
|
|
523
524
|
- lib/brut/cli/apps/new/ops/add_i18n_message.rb
|
|
@@ -538,6 +539,7 @@ files:
|
|
|
538
539
|
- lib/brut/cli/apps/new/segments.rb
|
|
539
540
|
- lib/brut/cli/apps/new/segments/bare_bones.rb
|
|
540
541
|
- lib/brut/cli/apps/new/segments/demo.rb
|
|
542
|
+
- lib/brut/cli/apps/new/segments/docker_deploy.rb
|
|
541
543
|
- lib/brut/cli/apps/new/segments/heroku.rb
|
|
542
544
|
- lib/brut/cli/apps/new/segments/sidekiq.rb
|
|
543
545
|
- lib/brut/cli/apps/new/versions.rb
|
|
@@ -818,9 +820,12 @@ files:
|
|
|
818
820
|
- templates/segments/Demo/specs/front_end/pages/guestbook_page.spec.rb
|
|
819
821
|
- templates/segments/Demo/specs/front_end/pages/guestbook_page/message_component.spec.rb
|
|
820
822
|
- templates/segments/Demo/specs/front_end/pages/new_guestbook_message_page.spec.rb
|
|
823
|
+
- templates/segments/DockerDeploy/deploy/Dockerfile
|
|
824
|
+
- templates/segments/DockerDeploy/deploy/deploy_config.rb
|
|
825
|
+
- templates/segments/DockerDeploy/deploy/docker-entrypoint
|
|
821
826
|
- templates/segments/Heroku/deploy/Dockerfile
|
|
827
|
+
- templates/segments/Heroku/deploy/deploy_config.rb
|
|
822
828
|
- templates/segments/Heroku/deploy/docker-entrypoint
|
|
823
|
-
- templates/segments/Heroku/deploy/docker_config.rb
|
|
824
829
|
- templates/segments/Sidekiq/app/boot_sidekiq.rb
|
|
825
830
|
- templates/segments/Sidekiq/app/config/sidekiq.yml
|
|
826
831
|
- templates/segments/Sidekiq/app/src/back_end/jobs/app_job.rb
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
class Brut::CLI::Apps::New
|
|
3
|
-
class App
|
|
4
|
-
def initialize(current_dir:, app_options:, out:, err:)
|
|
5
|
-
@out = out
|
|
6
|
-
@app_options = app_options
|
|
7
|
-
|
|
8
|
-
@out.puts "Creating app with these options:\n"
|
|
9
|
-
@out.puts "App name: #{app_options.app_name}"
|
|
10
|
-
@out.puts "App ID: #{app_options.app_id}"
|
|
11
|
-
@out.puts "Prefix: #{app_options.prefix}"
|
|
12
|
-
@out.puts "Organization: #{app_options.organization}"
|
|
13
|
-
@out.puts "Include demo? #{app_options.demo}\n"
|
|
14
|
-
|
|
15
|
-
if app_options.dry_run?
|
|
16
|
-
@out.puts "Dry Run"
|
|
17
|
-
Brut::CLI::Apps::New::Ops::BaseOp.dry_run = true
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
templates_dir = Pathname(
|
|
21
|
-
Gem::Specification.find_by_name("brut").gem_dir
|
|
22
|
-
) / "templates"
|
|
23
|
-
|
|
24
|
-
@base = Brut::CLI::Apps::New::Base.new(
|
|
25
|
-
app_options:,
|
|
26
|
-
current_dir:,
|
|
27
|
-
templates_dir:
|
|
28
|
-
)
|
|
29
|
-
@segments = [
|
|
30
|
-
Brut::CLI::Apps::New::Segments::BareBones.new(
|
|
31
|
-
app_options:,
|
|
32
|
-
current_dir:,
|
|
33
|
-
templates_dir:,
|
|
34
|
-
),
|
|
35
|
-
]
|
|
36
|
-
if app_options.demo?
|
|
37
|
-
@segments << Brut::CLI::Apps::New::Segments::Demo.new(
|
|
38
|
-
app_options:,
|
|
39
|
-
current_dir:,
|
|
40
|
-
templates_dir:
|
|
41
|
-
)
|
|
42
|
-
end
|
|
43
|
-
app_options.segments.each do |segment|
|
|
44
|
-
case segment
|
|
45
|
-
when "heroku"
|
|
46
|
-
@segments << Brut::CLI::Apps::New::Segments::Heroku.new(
|
|
47
|
-
project_root: @base.project_root,
|
|
48
|
-
templates_dir:
|
|
49
|
-
)
|
|
50
|
-
when "sidekiq"
|
|
51
|
-
@segments << Brut::CLI::Apps::New::Segments::Sidekiq.new(
|
|
52
|
-
project_root: @base.project_root,
|
|
53
|
-
templates_dir:
|
|
54
|
-
)
|
|
55
|
-
else
|
|
56
|
-
raise "Segment #{segment} is not supported"
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
@segments.sort!
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def create!
|
|
63
|
-
@out.puts "Creating Base app"
|
|
64
|
-
@base.create!
|
|
65
|
-
@segments.each do |segment|
|
|
66
|
-
@out.puts "Creating segment: #{segment.class.friendly_name}"
|
|
67
|
-
segment.add!
|
|
68
|
-
end
|
|
69
|
-
@out.puts "#{@app_options.app_name} was created\n\n"
|
|
70
|
-
@out.puts "Time to get building:"
|
|
71
|
-
@out.puts "1. cd #{@app_options.app_name}"
|
|
72
|
-
@out.puts "2. dx/build"
|
|
73
|
-
@out.puts "3. dx/start"
|
|
74
|
-
@out.puts "4. [ in another terminal ] dx/exec bash"
|
|
75
|
-
@out.puts "5. [ inside the Docker container ] bin/setup"
|
|
76
|
-
@out.puts "6. [ inside the Docker container ] bin/dev"
|
|
77
|
-
@out.puts "7. Visit http://localhost:6502 in your browser"
|
|
78
|
-
@out.puts "8. [ inside the Docker container ] bin/setup help # to see more commands"
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# This contains settings for your production Docker setup.
|
|
2
|
-
# You own and maintain this file. It is `require`d by brut deploy docker
|
|
3
|
-
class DockerConfig
|
|
4
|
-
|
|
5
|
-
# Can return a Docker platform is your deployment platform is not
|
|
6
|
-
# linux/amd64. Note that --platform will override this value.
|
|
7
|
-
def platform = nil
|
|
8
|
-
|
|
9
|
-
# Return a Hash of additional images to run, beyond "web" and "release".
|
|
10
|
-
#
|
|
11
|
-
# The format of this Hash is:
|
|
12
|
-
#
|
|
13
|
-
# {
|
|
14
|
-
# *image name* => {
|
|
15
|
-
# cmd: *command line for Dockerfile RUN directive*,
|
|
16
|
-
# }
|
|
17
|
-
# }
|
|
18
|
-
#
|
|
19
|
-
# For example, if you have the Sidekiq segment installed, `bin/run sidekiq`
|
|
20
|
-
# runs Sidekiq, so you would return this hash:
|
|
21
|
-
#
|
|
22
|
-
# {
|
|
23
|
-
# "sidekiq" => {
|
|
24
|
-
# cmd: "bin/run sidekiq",
|
|
25
|
-
# }
|
|
26
|
-
# }
|
|
27
|
-
#
|
|
28
|
-
def additional_images
|
|
29
|
-
end
|
|
30
|
-
end
|