comparison docker/libervia_cont.sh @ 95:33f9610480ea

docker (libervia_cont): SAT_CONT_PORT_<port> environment variable can now be used to specify destination ports when -p is used
author Goffi <goffi@goffi.org>
date Wed, 24 Feb 2016 20:24:05 +0100
parents 70f65a6b3392
children c425b8a99a29
comparison
equal deleted inserted replaced
94:eeff161a19e8 95:33f9610480ea
22 # environment variables that can be used for configuration: 22 # environment variables that can be used for configuration:
23 # SAT_CONT_TLS_DIR for TLS certificates directory 23 # SAT_CONT_TLS_DIR for TLS certificates directory
24 # SAT_CONT_DOMAIN for the host name 24 # SAT_CONT_DOMAIN for the host name
25 # SAT_CONT_BACKUP_DIR is the directory where tar.gz backup will be written 25 # SAT_CONT_BACKUP_DIR is the directory where tar.gz backup will be written
26 # SAT_CONT_DK_EXTRA is used for extra options (used with all containers but sat_data) 26 # SAT_CONT_DK_EXTRA is used for extra options (used with all containers but sat_data)
27 # SAT_CONT_PORT_<port> is used to specify port when -p is used, <port> must be an exposed port
27 28
28 CONTAINERS="prosody sat_pubsub salut sat libervia" 29 CONTAINERS="prosody sat_pubsub salut sat libervia"
29 30
30 DK_DETACH="-d" 31 DK_DETACH="-d"
31 DK_TERM="-ti" 32 DK_TERM="-ti"
112 fi 113 fi
113 cont=$1 114 cont=$1
114 ports=$(get_dyn_var $cont ports) 115 ports=$(get_dyn_var $cont ports)
115 ARG="" 116 ARG=""
116 for port in $ports; do 117 for port in $ports; do
117 ARG="$ARG -p $port:$port" 118 host_port=$(eval echo "\$SAT_CONT_PORT_${port}")
119 if [ -z "$host_port" ]; then
120 host_port=$port
121 fi
122 if [ "$host_port" != 0 ]; then
123 ARG="$ARG -p $host_port:$port"
124 fi
118 done 125 done
119 echo $ARG 126 echo $ARG
120 } 127 }
121 128
122 download_missing() { 129 download_missing() {
254 exit 1 261 exit 1
255 fi 262 fi
256 done 263 done
257 printf '\nLibervia is launched and should be reachable in a couple of seconds.\nYou can check logs with "docker logs -f libervia" (or any other container name).\n' 264 printf '\nLibervia is launched and should be reachable in a couple of seconds.\nYou can check logs with "docker logs -f libervia" (or any other container name).\n'
258 printf "An \"admin\" account has been created, you can check its password on $VOLUME_ALIAS container, in file /home/sat/ADMIN_PWD. Config can be tuned on this container.\n" 265 printf "An \"admin\" account has been created, you can check its password on $VOLUME_ALIAS container, in file /home/sat/ADMIN_PWD. Config can be tuned on this container.\n"
259 printf 'Below are the ports used to connect, you can go with your browser to Libervia HTTP port.\n\n' 266 printf 'Below are the ports used to connect, you can go with your browser to Libervia HTTP(S) port.\n\n'
260 list_ports 267 list_ports
261 ;; 268 ;;
262 STOP) 269 STOP)
263 printf "stopping Libervia\n" 270 printf "stopping Libervia\n"
264 REVERSED="" 271 REVERSED=""