Created
April 8, 2015 20:55
-
-
Save jelder/31b1fff30d4be43168ae to your computer and use it in GitHub Desktop.
Dynamically configure Passenger based on current Dyno type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# http://stackoverflow.com/questions/24634958/programmatically-detect-heroku-dyno-size-at-run-time/24634959#24634959 | |
function dyno_size() { | |
case $(ulimit -u) in | |
256) | |
echo "1X" | |
;; | |
512) | |
echo "2X" | |
;; | |
32768) | |
echo "PX" | |
;; | |
*) | |
echo "unknown" | |
;; | |
esac | |
} | |
case $(dyno_size) in | |
1X) | |
echo "--min-instances=1 --max-pool-size=1" | |
;; | |
2X) | |
echo "--min-instances=3 --max-pool-size=3" | |
;; | |
PX) | |
echo "--min-instances=12 --max-pool-size=12" | |
;; | |
*) | |
echo "--min-instances=1 --max-pool-size=1" | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment