dockerfile-rails 1.6.13 → 1.6.15
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/generators/dockerfile_generator.rb +68 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 408907e489bd861b56cdbf73efa0213276ffee3cd1edaab526e3e978325d6bb1
|
4
|
+
data.tar.gz: afedfb85e018faf90a4a84b712d0b0e8060e7c898868b02499a0bd87bce81984
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a90b5fa2032eb15f8dacb12ccbe1f4fc711f8ebdd4a4f90b24291d146af948413783b484c3bc0054614e7deb9f5acff5a90cf9da96f1d86f9481b85146debf2b
|
7
|
+
data.tar.gz: d3db627db5dab2c89517cd8eaf34e66dbadb4b17ae43b5533fd4e6430e4372cc09f7ebb509c509281954cd1896fc42713947d2aec631557955a7488e52f562ee
|
@@ -42,6 +42,7 @@ class DockerfileGenerator < Rails::Generators::Base
|
|
42
42
|
"sentry" => false,
|
43
43
|
"sudo" => false,
|
44
44
|
"swap" => nil,
|
45
|
+
"tigris" => false,
|
45
46
|
"thruster" => false,
|
46
47
|
"variant" => nil,
|
47
48
|
"windows" => false,
|
@@ -161,6 +162,9 @@ class DockerfileGenerator < Rails::Generators::Base
|
|
161
162
|
class_option :litefs, type: :boolean, default: OPTION_DEFAULTS.litefs,
|
162
163
|
desc: "replicate sqlite3 databases using litefs"
|
163
164
|
|
165
|
+
class_option :tigris, type: :boolean, default: OPTION_DEFAULTS.tigris,
|
166
|
+
desc: "configure active storage to use tigris"
|
167
|
+
|
164
168
|
class_option :postgresql, aliases: "--postgres", type: :boolean, default: OPTION_DEFAULTS.postgresql,
|
165
169
|
desc: "include postgresql libraries"
|
166
170
|
|
@@ -372,7 +376,12 @@ class DockerfileGenerator < Rails::Generators::Base
|
|
372
376
|
remove_file "config/dockerfile.yml"
|
373
377
|
end
|
374
378
|
|
375
|
-
|
379
|
+
if options.tigris?
|
380
|
+
configure_tigris
|
381
|
+
end
|
382
|
+
|
383
|
+
# check Dockerfile for common errors: missing packages, mismatched Ruby version;
|
384
|
+
# also add DATABASE_URL to fly.toml if needed
|
376
385
|
if options.skip? && File.exist?("Dockerfile")
|
377
386
|
message = nil
|
378
387
|
shell = Thor::Base.shell.new
|
@@ -393,6 +402,14 @@ class DockerfileGenerator < Rails::Generators::Base
|
|
393
402
|
STDERR.puts "\n" + shell.set_color(message, Thor::Shell::Color::RED, Thor::Shell::Color::BOLD)
|
394
403
|
end
|
395
404
|
|
405
|
+
if (options.sqlite3? || @sqlite3) && !dockerfile.include?("DATABASE_URL") && File.exist?("fly.toml")
|
406
|
+
toml = IO.read("fly.toml")
|
407
|
+
if !toml.include?("[[env]]")
|
408
|
+
toml += "\n[[env]]\n DATABASE_URL = \"sqlite3:///data/production.sqlite3\"\n"
|
409
|
+
File.write "fly.toml", toml
|
410
|
+
end
|
411
|
+
end
|
412
|
+
|
396
413
|
exit 42 if message
|
397
414
|
end
|
398
415
|
end
|
@@ -539,6 +556,10 @@ private
|
|
539
556
|
system "bundle add redis --skip-install" unless @gemfile.include? "redis"
|
540
557
|
end
|
541
558
|
|
559
|
+
if options.tigris?
|
560
|
+
system "bundle add aws-sdk-s3 --require=false --skip-install" unless @gemfile.include? "aws-sdk-s3"
|
561
|
+
end
|
562
|
+
|
542
563
|
if options.sentry?
|
543
564
|
system "bundle add sentry-ruby --skip-install" unless @gemfile.include? "sentry-ruby"
|
544
565
|
system "bundle add sentry-rails --skip-install" unless @gemfile.include? "sentry-rails"
|
@@ -985,7 +1006,7 @@ private
|
|
985
1006
|
instructions = IO.read @@instructions["base"]
|
986
1007
|
|
987
1008
|
if instructions.start_with? "#!"
|
988
|
-
instructions = "# custom instructions\nRUN #{
|
1009
|
+
instructions = "# custom instructions\nRUN #{@@instructions["base"].strip}"
|
989
1010
|
end
|
990
1011
|
|
991
1012
|
instructions.html_safe
|
@@ -997,7 +1018,7 @@ private
|
|
997
1018
|
instructions = IO.read @@instructions["build"]
|
998
1019
|
|
999
1020
|
if instructions.start_with? "#!"
|
1000
|
-
instructions = "# custom build instructions\nRUN #{
|
1021
|
+
instructions = "# custom build instructions\nRUN #{@@instructions["build"].strip}"
|
1001
1022
|
end
|
1002
1023
|
|
1003
1024
|
instructions.html_safe
|
@@ -1009,7 +1030,7 @@ private
|
|
1009
1030
|
instructions = IO.read @@instructions["deploy"]
|
1010
1031
|
|
1011
1032
|
if instructions.start_with? "#!"
|
1012
|
-
instructions = "# custom deploy instructions\nRUN #{
|
1033
|
+
instructions = "# custom deploy instructions\nRUN #{@@instructions["deploy"].strip}"
|
1013
1034
|
end
|
1014
1035
|
|
1015
1036
|
instructions.html_safe
|
@@ -1290,6 +1311,49 @@ private
|
|
1290
1311
|
system "#{flyctl} consul attach"
|
1291
1312
|
end
|
1292
1313
|
|
1314
|
+
def configure_tigris
|
1315
|
+
return unless options.tigris?
|
1316
|
+
|
1317
|
+
service = [
|
1318
|
+
"tigris:",
|
1319
|
+
" service: S3",
|
1320
|
+
' access_key_id: <%= ENV["AWS_ACCESS_KEY_ID"] %>',
|
1321
|
+
' secret_access_key: <%= ENV["AWS_SECRET_ACCESS_KEY"] %>',
|
1322
|
+
' endpoint: <%= ENV["AWS_ENDPOINT_URL_S3"] %>',
|
1323
|
+
' bucket: <%= ENV["BUCKET_NAME"] %>'
|
1324
|
+
]
|
1325
|
+
|
1326
|
+
shell = Thor::Base.shell.new
|
1327
|
+
|
1328
|
+
if File.exist?("config/storage.yml")
|
1329
|
+
storage = IO.read("config/storage.yml")
|
1330
|
+
if storage.include? "tigris"
|
1331
|
+
STDOUT.puts shell.set_color("unchanged".rjust(12), Thor::Shell::Color::BLUE, Thor::Shell::Color::BOLD) +
|
1332
|
+
" config/storage.yml"
|
1333
|
+
else
|
1334
|
+
storage = storage.strip + "\n\n" + service.join("\n") + "\n"
|
1335
|
+
IO.write("config/storage.yml", storage)
|
1336
|
+
STDOUT.puts shell.set_color("updated".rjust(12), Thor::Shell::Color::GREEN, Thor::Shell::Color::BOLD) +
|
1337
|
+
" config/storage.yml"
|
1338
|
+
end
|
1339
|
+
end
|
1340
|
+
|
1341
|
+
if File.exist?("config/environments/production.rb")
|
1342
|
+
production = IO.read("config/environments/production.rb")
|
1343
|
+
if !production.include?("tigris") && production.include?("config.active_storage.service")
|
1344
|
+
production.sub!(/config.active_storage.service.*/, "config.active_storage.service = :tigris")
|
1345
|
+
production.sub! "# Store uploaded files on the local file system",
|
1346
|
+
"# Store uploaded files in Tigris Global Object Storage"
|
1347
|
+
IO.write("config/environments/production.rb", production)
|
1348
|
+
STDOUT.puts shell.set_color("updated".rjust(12), Thor::Shell::Color::GREEN, Thor::Shell::Color::BOLD) +
|
1349
|
+
" config/environments/production.rb"
|
1350
|
+
else
|
1351
|
+
STDOUT.puts shell.set_color("unchanged".rjust(12), Thor::Shell::Color::BLUE, Thor::Shell::Color::BOLD) +
|
1352
|
+
" config/environments/production.yml"
|
1353
|
+
end
|
1354
|
+
end
|
1355
|
+
end
|
1356
|
+
|
1293
1357
|
def fly_make_toml
|
1294
1358
|
toml = File.read("fly.toml")
|
1295
1359
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dockerfile-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05
|
11
|
+
date: 2024-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|