dockerfile-rails 1.6.24 → 1.6.25

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: 3d63730b1e3ff8ac7968202d2511f66b51f2faa890350ab71b7f553538aebaae
4
- data.tar.gz: f5b546990dbdcc931c5cac7ace90c7219b2af280271c8650b82dc23a33f3ac76
3
+ metadata.gz: 749745baff7e3b0f67b72f9f94c2df9086c344c9665e2d67498c02c33cfbcbab
4
+ data.tar.gz: 1b62d4bcf87fd0872057ee0e796b8f529a3b29b811e13447e7ac7df60961ab80
5
5
  SHA512:
6
- metadata.gz: be28e7ce7e16ea25334727debb71c212bf976fcc602863479ee9ea908849939a9e9ce3e6acbfbd5bfb1ae3c5d0d768c448f8bacfc321543a5fe9a8dd93a55634
7
- data.tar.gz: 2e4236bcc182926d0667bc0ff69e24e3034985cce89c0a99690da808029a20d1a1e9bec982d15ed273b877bd374819d490feb76fe46a61478f2e7b98473de6b7
6
+ metadata.gz: a88d05eac975d08d6ad47766300a996740c56e7a273488c7ec4e3f59729841d3edf132d91740a82410b7e60aff8017fb5aeabd15095b7ea0673f3088d08dd49f
7
+ data.tar.gz: b78e868ec797f8c2bdb01e0afc7214e60b7a134414a06b15cc2151e8fcee62e6a59cfcbdde6898af22bb38a3742f4af433187b0e3aaa323c6dd85f956df3f012
data/DEMO.md CHANGED
@@ -7,7 +7,7 @@ Rails provides a _smoke test_ for new applications that makes sure that you have
7
7
  ```bash
8
8
  rails new demo --minimal
9
9
  cd demo
10
- echo 'Rails.application.routes.draw { root "rails/welcome#index" }' > config/routes.rb
10
+ echo 'Rails.application.routes.draw { root "rails/welcome#index" }' >> config/routes.rb
11
11
  bundle add dockerfile-rails --optimistic --group development
12
12
  bin/rails generate dockerfile
13
13
  docker buildx build . -t rails-demo
@@ -333,7 +333,7 @@ class DockerfileGenerator < Rails::Generators::Base
333
333
 
334
334
  if fix_database_config
335
335
  template "database.yml.erb", "config/database.yml",
336
- force: File.exist?("fly.toml")
336
+ force: options.force? || File.exist?("fly.toml")
337
337
  end
338
338
 
339
339
  if solidq_launcher == :puma && !File.read("config/puma.rb").include?(":solid_queue")
@@ -421,24 +421,12 @@ class DockerfileGenerator < Rails::Generators::Base
421
421
  end
422
422
 
423
423
  if File.exist?("fly.toml")
424
- env = {}
425
-
426
- if (options.sqlite3? || @sqlite3) && !dockerfile.include?("DATABASE_URL")
427
- env["DATABASE_URL"] = "sqlite3:///data/production.sqlite3"
428
- end
429
-
430
- if using_thruster? && !dockerfile.include?("HTTP_PORT")
431
- env["HTTP_PORT"] = "8080"
432
- end
433
-
434
- if solidq_launcher == :env && !dockerfile.include?("SOLID_QUEUE_IN_PUMA")
435
- env["SOLID_QUEUE_IN_PUMA"] = "true"
436
- end
424
+ env = fly_toml_env
437
425
 
438
426
  unless env.empty?
439
427
  toml = IO.read("fly.toml")
440
- if !toml.include?("[[env]]")
441
- toml += "\n[[env]]\n" + env.map { |key, value| " #{key} = #{value.inspect}" }.join("\n")
428
+ if !toml.include?("[env]")
429
+ toml += "\n[env]\n" + env.map { |key, value| " #{key} = #{value.inspect}" }.join("\n") + "\n"
442
430
  File.write "fly.toml", toml
443
431
  end
444
432
  end
@@ -1249,9 +1237,15 @@ private
1249
1237
  rails: "./bin/rails server -p 3001"
1250
1238
  }
1251
1239
  elsif using_thruster?
1252
- base = {
1253
- rails: "bundle exec thrust ./bin/rails server"
1254
- }
1240
+ if File.exist? "bin/thrust"
1241
+ base = {
1242
+ rails: "./bin/thrust ./bin/rails server"
1243
+ }
1244
+ else
1245
+ base = {
1246
+ rails: "bundle exec thrust ./bin/rails server"
1247
+ }
1248
+ end
1255
1249
  else
1256
1250
  base = {
1257
1251
  rails: "./bin/rails server"
@@ -1271,7 +1265,7 @@ private
1271
1265
 
1272
1266
  def fly_processes
1273
1267
  return unless File.exist? "fly.toml"
1274
- return unless using_sidekiq? || using_solidq?
1268
+ return unless using_sidekiq? || using_solidq? || using_thruster?
1275
1269
 
1276
1270
  if procfile.size > 1
1277
1271
  list = { "app" => "foreman start --procfile=Procfile.prod" }
@@ -1435,11 +1429,45 @@ private
1435
1429
  end
1436
1430
  end
1437
1431
 
1432
+ def fly_toml_env
1433
+ env = {}
1434
+ dockerfile = File.read("Dockerfile") rescue ""
1435
+
1436
+ if using_thruster?
1437
+ env["PORT"] = "8080"
1438
+ end
1439
+
1440
+ if (options.sqlite3? || @sqlite3) && !dockerfile.include?("DATABASE_URL")
1441
+ env["DATABASE_URL"] = "sqlite3:///data/production.sqlite3"
1442
+ end
1443
+
1444
+ if using_thruster? # && !dockerfile.include?("HTTP_PORT")
1445
+ # env["HTTP_PORT"] = "8080"
1446
+ env["PORT"] = "8080"
1447
+ end
1448
+
1449
+ if solidq_launcher == :env && !dockerfile.include?("SOLID_QUEUE_IN_PUMA")
1450
+ env["SOLID_QUEUE_IN_PUMA"] = "true"
1451
+ end
1452
+
1453
+ env
1454
+ end
1455
+
1438
1456
  def fly_make_toml
1439
1457
  toml = File.read("fly.toml")
1458
+ env = fly_toml_env
1459
+
1460
+ unless env.empty? || toml.include?("[env]")
1461
+ toml += "\n[env]\n" + env.map { |key, value| " #{key} = #{value.inspect}" }.join("\n") + "\n"
1462
+ end
1440
1463
 
1441
1464
  list = fly_processes
1442
1465
  if list
1466
+ if using_thruster?
1467
+ primary = list.keys.first
1468
+ list[primary] = list[primary].sub(/^.*thrust /, "")
1469
+ end
1470
+
1443
1471
  if toml.include? "[processes]"
1444
1472
  toml.sub!(/\[processes\].*?(\n\n|\n?\z)/m, "[processes]\n" +
1445
1473
  list.map { |name, cmd| " #{name} = #{cmd.inspect}" }.join("\n") + '\1')
@@ -1464,7 +1492,14 @@ private
1464
1492
 
1465
1493
  if deploy_database == "sqlite3"
1466
1494
  if not toml.include? "[mounts]"
1467
- toml += "[mounts]\n source=\"data\"\n destination=\"/data\"\n\n"
1495
+ toml += <<~EOF + "\n"
1496
+ [mounts]
1497
+ source = "data"
1498
+ destination = "/data"
1499
+ auto_extend_size_threshold = 80
1500
+ auto_extend_size_increment = "1GB"
1501
+ auto_extend_size_limit = "10GB"
1502
+ EOF
1468
1503
  end
1469
1504
  end
1470
1505
 
@@ -303,7 +303,7 @@ EXPOSE <%= using_thruster? ? '80' : '3000' %>
303
303
  <% if deploy_database == 'sqlite3' -%>
304
304
  VOLUME /data
305
305
  <% end -%>
306
- <% unless fly_processes -%>
306
+ <% unless fly_processes && !using_thruster? -%>
307
307
  <% if !options.procfile.blank? -%>
308
308
  CMD ["foreman", "start", "--procfile=<%= options.procfile %>"]
309
309
  <% elsif procfile.size > 1 -%>
@@ -91,7 +91,7 @@ services:
91
91
  redis-db:
92
92
  image: redis
93
93
  <% end -%>
94
- <% if (using_sidekiq? or using_solidq?) and deploy_database != 'sqlite3' -%>
94
+ <% if (using_sidekiq? and deploy_database != 'sqlite3') or solidq_launcher == :process -%>
95
95
 
96
96
  <%= using_sidekiq? ? "sidekiq" : "solidq" %>:
97
97
  build: .
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.24
4
+ version: 1.6.25
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-11-04 00:00:00.000000000 Z
11
+ date: 2024-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails