Skip to content

Commit 74fd4fa

Browse files
author
Vidas P
committed
Fix single dyno mode on heroku
1 parent 45ae0d1 commit 74fd4fa

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

CHANGELOG.md

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

99
## [current]
1010
### Fixed
11-
- Don't use `foreman` to manage multiple processes when running with `SINGLE_DYNO=1`.
11+
12+
- Don't use `foreman` to manage multiple processes when running with
13+
`SINGLE_DYNO=1`. Single-dyno mode was demoted to being used purely for trying
14+
out ActiveWorkflow on Heroku (including Free plan). Functionality
15+
previously provided by foreman reimplemented as a simple shell script using
16+
job control functionality of bash. Fixes #9.
1217

1318

1419
## [0.9.9.2] - 2020-09-09

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ A quick and easy way to check out ActiveWorkflow is by deploying it to
2727
All you need to do is click the button bellow and fill in the environment variables for your seed user (admin):
2828
`SEED_USERNAME`, `SEED_PASSWORD` (must be at least 8 characters long) and `SEED_EMAIL`.
2929

30-
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/automaticmode/active_workflow)
30+
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/automaticmode/active_workflow&env[SINGLE_DYNO]=1)
31+
32+
!Note!: The button above deploys ActiveWorkflow on a single dyno so it could be run using Free Heroku plan. This configuration is not recommended for production. See [Getting Started](https://github.com/automaticmode/active_workflow/wiki/Getting-Started#Running-On-Heroku) for more details.
3133

3234
## Usage
3335

app.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,18 @@
44
"website": "https://github.com/automaticmode/active_workflow",
55
"repository": "https://github.com/automaticmode/active_workflow",
66
"stack": "container",
7-
"formation": {
8-
"web": {
9-
"quantity": 1,
10-
"size": "free"
11-
}
12-
},
137
"env": {
148
"SINGLE_DYNO": {
15-
"description": "Set to '1' if you want to run all the processes in a single dyno, leave empty otherwise. Usable only for demonstration purposes. Do not run scheduler and worker dynos if running in SINGLE_DYNO mode.",
16-
"value": "1"
9+
"description": "Set to '1' if you want to run all the processes in a single dyno, leave '0' otherwise. Single dyno mode is only for demonstration purposes. Do not run scheduler and worker dynos if running in SINGLE_DYNO mode.",
10+
"value": "0",
11+
"required": false
1712
},
1813
"SEED_USERNAME": "admin",
1914
"SEED_PASSWORD": "password",
2015
"SEED_EMAIL": "admin@example.com",
2116
"SECRET_KEY_BASE": {
2217
"generator": "secret"
2318
},
24-
"RAILS_ENV": "production",
2519
"RAILS_LOG_TO_STDOUT": "enabled",
2620
"RAILS_MAX_THREADS": "2",
2721
"RAILS_SERVE_STATIC_FILES": "enabled"

docker/scripts/init

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ fi
4646
# added specifically to support running ActiveWorkflow on Heroku free plan.
4747
# Please use multiple container configuration in production.
4848

49-
if [ -z "${SINGLE_DYNO}" ]; then
50-
# Web only
51-
exec bundle exec puma
52-
else
49+
if [ "${SINGLE_DYNO}" -eq "1" ]; then
5350
# Simple "homegrown" process management with somewhat graceful shutdown.
5451
(until bundle exec puma; do sleep 1; done) &
5552
web_id=$!
5653
(until bundle exec rails runner bin/scheduler.rb; do sleep 1; done) &
5754
(until bundle exec script/delayed_job -n 2 run; do sleep 1; done) &
5855
wait $web_id
56+
else
57+
# Web only
58+
exec bundle exec puma
5959
fi

0 commit comments

Comments
 (0)