-
Notifications
You must be signed in to change notification settings - Fork 14
/
script-functions
120 lines (105 loc) · 2.45 KB
/
script-functions
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#
# script-functions
#
# Common functions for the scripts in the shibboleth-idp-docker
# project.
#
#
# Derive directory containing this script.
#
DIR=$(dirname "${BASH_SOURCE[0]}")
#
# Default properties; may be overridden by assignments in
# an optional CONFIG file.
#
#
# We obtain front-channel certificates from Let's Encrypt using
# the certbot ACME client. Its state (across potentially many sites)
# is held in a series of directories or Docker volumes.
#
CERTBOT_IMAGE=certbot/certbot
CERTBOT_VOL_ETC=/srv/certbot/etc
CERTBOT_VOL_LIB=/srv/certbot/lib
CERTBOT_VOL_LOG=/srv/certbot/log
#
# IDP_HOME_LOCAL
#
# Root directory of the IdP installation, in local space.
# The same files will appear at a different location in Docker
# containers.
#
IDP_HOME_LOCAL=${DIR}/shibboleth-idp
#
# BROWSER_CERT_PASSWORD
#
# Password for the PKCS12 file containing the front-channel
# (i.e., browser-facing) X.509 credential.
#
BROWSER_CERT_PASSWORD=changeit
#
# SEALER_PASSWORD
#
# Password for the sealer keystore. Must match the idp.sealer.* properties in
# credentials/secrets.properties, which were originally taken from the
# definition of SEALPASS in install-idp.
#
SEALER_PASSWORD=changeit
#
# IPADDR
#
# IP address to bind to. By default, bind to all Docker host interfaces
#
# One alternative is to bind to a particular host interface on a
# Docker host which has multiple interfaces. Another is to bind to
# the localhost address (127.0.0.1) for local testing.
#
IPADDR=0.0.0.0
#
# Default name for the container, if deploying using "docker run".
#
CONTAINER_NAME=shibboleth-idp
#
# Default names for the stack and service, if deploying using
# "docker stack deploy".
#
STACK_NAME=idp
SERVICE_NAME=idp
#
# Override settings if a CONFIG file exists in the same directory
# as this script.
#
if [ -s ${DIR}/CONFIG ]; then
. ${DIR}/CONFIG
fi
#
# Functions.
#
echoerr() {
echo "$@" 1>&2
}
#
# What's the actual name of the running container?
#
containerName() {
#
# Try for the basic container name.
#
name=$(docker ps --filter "name=^${CONTAINER_NAME}$" \
--format "{{.Names}}")
if [ ! -z "${name}" ]; then
echo ${name}
return
fi
#
# Try for the service.
#
name=$(docker ps --filter "name=^${STACK_NAME}_${SERVICE_NAME}\\.1\\." \
--format "{{.Names}}")
echo $name
}
# Tell Emacs that this is a shell script.
# Local Variables:
# mode: sh
# indent-tabs-mode: nil
# tab-width: 4
# End: