forked from syahrul-aiman/nodejs-java-buildpack
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnodejs.sh
More file actions
executable file
·56 lines (44 loc) · 1.49 KB
/
nodejs.sh
File metadata and controls
executable file
·56 lines (44 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
calculate_concurrency() {
MEMORY_AVAILABLE=${MEMORY_AVAILABLE-$(detect_memory 512)}
WEB_MEMORY=${WEB_MEMORY-512}
WEB_CONCURRENCY=${WEB_CONCURRENCY-$((MEMORY_AVAILABLE/WEB_MEMORY))}
if (( WEB_CONCURRENCY < 1 )); then
WEB_CONCURRENCY=1
elif (( WEB_CONCURRENCY > 32 )); then
WEB_CONCURRENCY=32
fi
WEB_CONCURRENCY=$WEB_CONCURRENCY
}
log_concurrency() {
echo "Detected $MEMORY_AVAILABLE MB available memory, $WEB_MEMORY MB limit per process (WEB_MEMORY)"
echo "Recommending WEB_CONCURRENCY=$WEB_CONCURRENCY"
}
detect_memory() {
local default=$1
local limit=$(ulimit -u)
case $limit in
256) echo "512";; # Standard-1X
512) echo "1024";; # Standard-2X
16384) echo "2560";; # Performance-M
32768) echo "14336";; # Performance-L
*) echo "$default";;
esac
}
export PATH="$HOME/.heroku/node/bin:$PATH:$HOME/bin:$HOME/node_modules/.bin"
export NODE_HOME="$HOME/.heroku/node"
export NODE_ENV=${NODE_ENV:-production}
export PATH="$HOME/.heroku/java/bin:$PATH"
export JAVA_HOME="$HOME/.heroku/java"
export PATH="$HOME/.heroku/maven/bin:$PATH"
#export PATH="$HOME/.heroku/swift/clang/bin:$PATH"
#export CLANG_HOME="$HOME/.heroku/swift/clang"
#export PATH="$HOME/.heroku/swift/bin:$PATH"
#export SWIFT_HOME="$HOME/.heroku/swift"
export PATH="$HOME/.heroku/cf:$PATH"
calculate_concurrency
export MEMORY_AVAILABLE=$MEMORY_AVAILABLE
export WEB_MEMORY=$WEB_MEMORY
export WEB_CONCURRENCY=$WEB_CONCURRENCY
if [ "$LOG_CONCURRENCY" = "true" ]; then
log_concurrency
fi