Skip to content

Commit fa7fa37

Browse files
committed
Clean up bin/docker-entrypoint server check when running litestream
Remove what launches the sever (thrust, litestream) from the check to see if we are running the server. That makes the check more resilient to environment changes (example: not running thruster on fly.io).
1 parent 4ff732a commit fa7fa37

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/generators/dockerfile_generator.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,11 +1164,11 @@ def start_command
11641164
else
11651165
command = Shellwords.split(procfile.values.first)
11661166

1167-
if command.first == "./bin/thrust"
1168-
command[1..]
1169-
else
1170-
command
1171-
end
1167+
thrust = command.index("./bin/thrust")
1168+
thrust = command.index("litestream:run") if thrust.nil?
1169+
command = command[thrust+1...] unless thrust.nil?
1170+
1171+
command
11721172
end
11731173
end
11741174

test/results/litestream/docker-entrypoint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [ -z "${LD_PRELOAD+x}" ]; then
77
fi
88

99
# If running the rails server then create or migrate existing database
10-
if [ "${@: -5:1}" == "./bin/rake" ] && [ "${@: -4:1}" == litestream:run ] && [ "${@: -3:1}" == "./bin/thrust" ] && [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
10+
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
1111
./bin/rails db:prepare
1212
fi
1313

0 commit comments

Comments
 (0)