-
Notifications
You must be signed in to change notification settings - Fork 6
/
run_Panorama_docker.sh
executable file
·60 lines (51 loc) · 2.59 KB
/
run_Panorama_docker.sh
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
57
58
59
60
#!/bin/bash
# Docker-executable
# Peter Ramm, 28.12.2016
# Allow overriding of environment by docker run
if [ -z "$PANORAMA_HOME" ]; then
export PANORAMA_HOME=$PWD
fi
if [ -z "$HTTP_PORT" ]; then
export HTTP_PORT=8080
fi
# Writable directory for work area, usage-log and client_info-store, used by Panorama internally
if [ -z "$PANORAMA_VAR_HOME" ]; then
export PANORAMA_VAR_HOME=/var/opt/panorama
fi
# Remove temporary objects from previous runs, especially the pid-file if the container was stopped by docker stop -t 0
rm -rf $PANORAMA_HOME/tmp
if [ -z "$MAX_JAVA_HEAP_SPACE_MB" ]
then
MAX_JAVA_HEAP_SPACE_MB=1024
fi
echo "max. Java heap space set to $MAX_JAVA_HEAP_SPACE_MB megabytes"
export RAILS_LOG_TO_STDOUT_AND_FILE=true
export RAILS_SERVE_STATIC_FILES=true
export RAILS_MIN_THREADS=10
# Default for RAILS_MAX_THREADS is set as ENV in Dockerfile
# Optional Parameter:
# -XX:ReservedCodeCacheSize=48M Default = 48M, Buffer for JIT compiled code
# -XX:+ UseCodeCacheFlushing Flush old / unused code to enable JIT compilation of current code
# -Xmx1024m Maximum heap space
# -Xms1024m Initial heap space
# -Djruby.compile.fastest=true (EXPERIMENTAL) Turn on all experimental compiler optimizations.
# -Djruby.compile.threadless=true (EXPERIMENTAL) Turn on compilation without polling for "unsafe" thread events.
# -Xcompile.invokedynamic=true Use invokedynamic for optimizing Ruby code., erroneous with Panorama
# -Dwarbler.port=<port> Set http-port to use
# If you run Panorama on virtualized headless Linux server (e.g. in cloud environment) and your browser hangs after first request:
# Reason: Your server does not generate enough entropy values in /dev/random, so read on /dev/random blocks during encryption operation
# Solution: Start Panorama with non-blocking entropy generator by option java.security.egd=file:/dev/urandom
# -Djava.security.egd=file:/dev/urandom
# On Read Hat Linux and clones (Oracle Linux etc.) you can install rng-tools instead of using /dev/urandom like described here:
# yum install -y rng-tools
# systemctl enable rngd.service
# systemctl start rngd.service
export JAVA_OPTS="-Xmx${MAX_JAVA_HEAP_SPACE_MB}m \
-XX:ReservedCodeCacheSize=80M \
-Djruby.compile.fastest=true \
-Djruby.compile.threadless=true"
CMD="bundle exec bin/rails server --port $HTTP_PORT --environment production"
echo "Starting $CMD"
# "exec ..." ensures that rails server runs in the same process like shell script before
# this ensures that application is gracefully shut down at docker stop
exec $CMD