-
Notifications
You must be signed in to change notification settings - Fork 6
/
docker-start-without-usb.sh
executable file
·72 lines (56 loc) · 1.75 KB
/
docker-start-without-usb.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
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Stop on error
set -e
#SSH Port
: ${CCU2_SSH_PORT:=2222}
#Rfd Port
: ${CCU2_RFD_PORT:=2001}
#hs485d Port
: ${CCU2_HS485D_PORT:=2000}
#HM Server Port
: ${CCU2_HMSERVER_PORT:=2010}
#Rega Port
: ${CCU2_REGA_PORT:=8181}
#Webui Port
: ${CCU2_WEBUI_PORT:=8585}
#virtualdevices Port
: ${CCU2_VIRTDEV_PORT:=9292}
#Name of the docker volume where CCU2 data will persist
#It can be a local location as well such as a mounted NAS folder, cluster fs (glusterfs), etc.
: ${DOCKER_CCU2_DATA:="ccu2_data"}
#Docker ID is used to push built image to a docker repository (needed for docker swarm)
: ${DOCKER_ID:="litti/dccu2-x86_64"}
#Additional options for docker create service / docker run
: ${DOCKER_OPTIONS:=""}
##############################################
# No need to touch anything below this line #
##############################################
DOCKER_VOLUME_INTERNAL_PATH="/usr/local/"
DOCKER_NAME=dccu2-x86_64
#######
# RUN #
#######
echo "Removing old plain docker instances"
docker ps -a |grep -q $DOCKER_NAME && docker stop $DOCKER_NAME && docker rm -f $DOCKER_NAME
echo "Starting container as plain docker"
docker run --name $DOCKER_NAME \
-p ${CCU2_SSH_PORT}:22 \
-p ${CCU2_WEBUI_PORT}:80 \
-p 1900:1900 \
-p ${CCU2_HS485D_PORT}:2000 \
-p ${CCU2_RFD_PORT}:2001 \
-p ${CCU2_HMSERVER_PORT}:2010 \
-p ${CCU2_REGA_PORT}:8181 \
-p 8700:8700 \
-p 8701:8701 \
-p ${CCU2_VIRTDEV_PORT}:9292 \
-e PERSISTENT_DIR=${DOCKER_VOLUME_INTERNAL_PATH} \
-v ${DOCKER_CCU2_DATA}:${DOCKER_VOLUME_INTERNAL_PATH} \
--hostname $DOCKER_NAME \
-d --restart=always \
$DOCKER_OPTIONS \
$DOCKER_ID
docker logs -f $(docker ps -a | grep "dccu2-x86_64" | awk '{print $1}')
echo
echo "Docker container started!"
echo "Docker data volume used: ${DOCKER_CCU2_DATA}"