Skip to content

Commit 45ae0d1

Browse files
author
Vidas P
committed
Don't use foreman when running in SINGLE_DYNO mode
1 parent e9024be commit 45ae0d1

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88

99
## [current]
10+
### Fixed
11+
- Don't use `foreman` to manage multiple processes when running with `SINGLE_DYNO=1`.
1012

1113

1214
## [0.9.9.2] - 2020-09-09

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ gem 'jquery-datatables', '~> 1.10.19'
7171
gem 'grape', '~> 1.3.2'
7272
gem 'grape-entity', '~> 0.8.0'
7373
gem 'jwt', '~> 2.2.1'
74-
gem 'foreman', '~> 0.87.1'
7574

7675
group :development do
7776
gem 'bullet', '~> 6.1.0'
7877
gem 'sqlite3', '~> 1.4.2'
7978
gem 'better_errors', '~> 2.7.0'
8079
gem 'binding_of_caller', '~> 0.8.0'
80+
gem 'foreman', '~> 0.87.1'
8181
gem 'guard', '~> 2.16.2'
8282
gem 'guard-livereload', '~> 2.5.2'
8383
gem 'guard-rspec', '~> 4.7.3'

docker/scripts/init

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,20 @@ if [ -z "${DO_NOT_SEED}" ]; then
4040
fi
4141

4242
# Start ActiveWorkflow
43+
44+
# When SINGLE_DYNO=1 run all the processes in the same container. This should
45+
# only be used for testing/demonstration purposes. SINGLE_DYNO mode was
46+
# added specifically to support running ActiveWorkflow on Heroku free plan.
47+
# Please use multiple container configuration in production.
48+
4349
if [ -z "${SINGLE_DYNO}" ]; then
4450
# Web only
4551
exec bundle exec puma
4652
else
47-
exec bundle exec foreman start
53+
# Simple "homegrown" process management with somewhat graceful shutdown.
54+
(until bundle exec puma; do sleep 1; done) &
55+
web_id=$!
56+
(until bundle exec rails runner bin/scheduler.rb; do sleep 1; done) &
57+
(until bundle exec script/delayed_job -n 2 run; do sleep 1; done) &
58+
wait $web_id
4859
fi

0 commit comments

Comments
 (0)