dockerfile-rails 1.4.0 → 1.4.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9cd11ebc9f7480d2cd29942b3dbb771ddd98377291a93aa27c70317bab0114e
|
4
|
+
data.tar.gz: 95611b26453984a5e51d2606321c3fdef93cf41b42a23b39f515a1e21ff97e5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76d6de186f304dc03e775de367c0b9b17e53b8eaf2b74738fa4cc8f6323fb84e3cc235a357f8c4d0bc2c3957b8e07411e96523d6052c12a58ab8aa89963f781f
|
7
|
+
data.tar.gz: addd1bd0774d6ec14f92811d8ba0ff5616c089c73e72a7d06a9e5fdd2b0a68dfca490fff760d973fd7ff3c6c80e4dd755deed439165a4f43d91cbb336ec3f420
|
@@ -244,6 +244,17 @@ class DockerfileGenerator < Rails::Generators::Base
|
|
244
244
|
fly_attach_consul
|
245
245
|
end
|
246
246
|
|
247
|
+
if fly_processes # therefore File.exist?('fly.toml')
|
248
|
+
if File.stat("fly.toml").size > 0
|
249
|
+
template "fly.toml.erb", "fly.toml"
|
250
|
+
else
|
251
|
+
toml = fly_make_processes(fly_processes)
|
252
|
+
if toml != IO.read("fly.toml")
|
253
|
+
File.write "fly.toml", toml
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
247
258
|
if @gemfile.include?("vite_ruby")
|
248
259
|
package = JSON.load_file("package.json")
|
249
260
|
unless package.dig("scripts", "build")
|
@@ -501,7 +512,7 @@ private
|
|
501
512
|
end
|
502
513
|
|
503
514
|
def deploy_packages
|
504
|
-
packages =
|
515
|
+
packages = %w(curl) # work with the default healthcheck strategy in MRSK
|
505
516
|
packages += @@packages["deploy"] if @@packages["deploy"]
|
506
517
|
|
507
518
|
# start with databases: sqlite3, postgres, mysql
|
@@ -851,6 +862,21 @@ private
|
|
851
862
|
end
|
852
863
|
end
|
853
864
|
|
865
|
+
def fly_processes
|
866
|
+
return unless File.exist? "fly.toml"
|
867
|
+
return unless using_sidekiq?
|
868
|
+
|
869
|
+
if procfile.size > 1
|
870
|
+
list = { "app" => "foreman start --procfile=Procfile.prod" }
|
871
|
+
else
|
872
|
+
list = { "app" => procfile.values.first }
|
873
|
+
end
|
874
|
+
|
875
|
+
list["sidekiq"] = "bundle exec sidekiq"
|
876
|
+
|
877
|
+
list
|
878
|
+
end
|
879
|
+
|
854
880
|
def more_docker_ignores
|
855
881
|
more = ""
|
856
882
|
|
@@ -902,11 +928,33 @@ private
|
|
902
928
|
return unless flyctl
|
903
929
|
|
904
930
|
# see if secret is already set?
|
905
|
-
|
906
|
-
|
931
|
+
begin
|
932
|
+
secrets = JSON.parse(`#{flyctl} secrets list --json`)
|
933
|
+
return if secrets.any? { |secret| secret["Name"] == "FLY_CONSUL_URL" }
|
934
|
+
rescue
|
935
|
+
return # likely got an error like "Could not find App"
|
936
|
+
end
|
907
937
|
|
908
938
|
# attach consul
|
909
|
-
say_status
|
939
|
+
say_status :execute, "flyctl consul attach", :green
|
910
940
|
system "#{flyctl} consul attach"
|
911
941
|
end
|
942
|
+
|
943
|
+
def fly_make_processes(list)
|
944
|
+
toml = File.read("fly.toml")
|
945
|
+
|
946
|
+
if toml.include? "[processes]"
|
947
|
+
toml.sub!(/\[processes\].*?(\n\n|\n?\z)/m, "[processes]\n" +
|
948
|
+
list.map { |name, cmd| " #{name} = #{cmd.inspect}" }.join("\n") + '\1')
|
949
|
+
else
|
950
|
+
toml += "\n[processes]\n" +
|
951
|
+
list.map { |name, cmd| " #{name} = #{cmd.inspect}\n" }.join
|
952
|
+
|
953
|
+
app = list.has_key?("app") ? "app" : list.keys.first
|
954
|
+
|
955
|
+
toml.sub! "[http_service]\n", "\\0 processes = [#{app.inspect}]\n"
|
956
|
+
end
|
957
|
+
|
958
|
+
toml
|
959
|
+
end
|
912
960
|
end
|
@@ -10,7 +10,7 @@ ARG RUBY_VERSION=<%= RUBY_VERSION %>
|
|
10
10
|
<% if options.fullstaq -%>
|
11
11
|
FROM <%= platform %>quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-<%= options.jemalloc ? 'jemalloc-' : '' %>slim<% unless options.precompile == "defer" %> as base<% end %>
|
12
12
|
<% else -%>
|
13
|
-
FROM <%= platform %>ruby:$RUBY_VERSION-slim<% unless options.precompile == "defer" %> as base<% end %>
|
13
|
+
FROM <%= platform %>registry.docker.com/library/ruby:$RUBY_VERSION-slim<% unless options.precompile == "defer" %> as base<% end %>
|
14
14
|
<% end -%>
|
15
15
|
|
16
16
|
<% unless options.label.empty? -%>
|
@@ -230,17 +230,16 @@ COPY <<-"EOF" /rails/Procfile.prod
|
|
230
230
|
<% end -%>
|
231
231
|
EOF
|
232
232
|
|
233
|
+
<% end -%>
|
233
234
|
# Start the server by default, this can be overwritten at runtime
|
234
235
|
EXPOSE 3000
|
235
236
|
<% if deploy_database == 'sqlite3' -%>
|
236
237
|
VOLUME /data
|
237
238
|
<% end -%>
|
239
|
+
<% unless fly_processes -%>
|
240
|
+
<% if procfile.size > 1 -%>
|
238
241
|
CMD ["foreman", "start", "--procfile=Procfile.prod"]
|
239
242
|
<% else -%>
|
240
|
-
# Start the server by default, this can be overwritten at runtime
|
241
|
-
EXPOSE 3000
|
242
|
-
<% if deploy_database == 'sqlite3' -%>
|
243
|
-
VOLUME /data
|
244
|
-
<% end -%>
|
245
243
|
CMD <%= procfile.values.first.split(" ").inspect %>
|
246
244
|
<% end -%>
|
245
|
+
<% end -%>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= fly_make_processes(fly_processes) -%>
|
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.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- lib/generators/templates/docker-entrypoint.erb
|
50
50
|
- lib/generators/templates/dockerfile.yml.erb
|
51
51
|
- lib/generators/templates/dockerignore.erb
|
52
|
+
- lib/generators/templates/fly.toml.erb
|
52
53
|
- lib/generators/templates/litefs.yml.erb
|
53
54
|
- lib/generators/templates/node-version.erb
|
54
55
|
homepage: https://github.com/fly-apps/dockerfile-rails
|