-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinstallidentityandauthorization.txt
More file actions
139 lines (113 loc) · 4.63 KB
/
installidentityandauthorization.txt
File metadata and controls
139 lines (113 loc) · 4.63 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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/sh
couchdb_username=$1
couchdb_password=$2
if [ $3 ]; then
runsetup=$3
fi
if ! [ $runsetup ]; then
runsetup=true
fi
if [ $4 ]; then
couchport=$4
fi
if ! [ $couchport ]; then
couchport=5984
fi
if [ $5 ]; then
authzversion=$5
fi
if ! [ $authzversion ]; then
authzversion="latest"
fi
if [ $6 ]; then
identityversion=$6
fi
if ! [ $identityversion ]; then
identityversion="latest"
fi
if [ $7 ]; then
allowunsafeeval=$7
fi
if ! [ $allowunsafeeval ]; then
allowunsafeeval="false"
fi
#
# This script is meant for quick & easy install via:
# curl -sSL https://healthcatalyst.github.io/InstallScripts/installidentityandauthorization.txt | sh /dev/stdin [couchdb_username] [couchdb_password]
u="$(whoami)"
echo "Running as: $u"
echo "stopping existing docker containers"
docker stop fabric.identity || echo 'no container to stop'
docker stop fabric.authorization || echo 'no container to stop'
docker stop fabric.couchdb || echo 'no container to stop'
echo "removing docker container"
docker rm fabric.identity || echo 'no container to remove'
docker rm fabric.authorization || echo 'no container to remove'
docker rm fabric.couchdb || echo 'no container to remove'
echo "removing docker volume for couchdb"
docker volume rm couchdb-data || echo 'no volume to remove'
echo "removing docker image"
echo "pulling latest docker image from repo"
echo "pulling identity version $identityversion"
echo "pulling authorization version $authzversion"
docker pull healthcatalyst/fabric.identity:$identityversion
docker pull healthcatalyst/fabric.authorization:$authzversion
docker pull healthcatalyst/fabric.docker.couchdb
echo "starting couchdb."
docker run -d --name fabric.couchdb \
-e "COUCHDB_USER=$couchdb_username" \
-e "COUCHDB_PASSWORD=$couchdb_password" \
-v couchdb-data:/opt/couchdb/data \
-p 0.0.0.0:$couchport:5984 healthcatalyst/fabric.docker.couchdb
sleep 20
echo "starting fabric.identity"
docker run -d --name fabric.identity \
-e "HostingOptions__StorageProvider=CouchDB" \
-e "HostingOptions__AllowUnsafeEval=$allowunsafeeval" \
-e "CouchDbSettings__Server=http://couchdb:5984" \
-e "CouchDbSettings__Username=$couchdb_username" \
-e "CouchDbSettings__Password=$couchdb_password" \
-p 5001:5001 \
--link fabric.couchdb:couchdb \
healthcatalyst/fabric.identity:$identityversion
sleep 10
if [ "$runsetup" = true ]; then
setupresponse=$(curl -sSL https://raw.githubusercontent.com/HealthCatalyst/Fabric.Identity/master/Fabric.Identity.API/scripts/setup-samples.sh | sh)
installersecret=$(echo $setupresponse | grep -oP '(?<="installerSecret":")[^"]*')
groupfetchersecret=$(echo $setupresponse | grep -oP '(?<="groupFetcherSecret":")[^"]*')
authapisecret=$(echo $setupresponse | grep -oP '(?<="authApiSecret":")[^"]*')
authclientsecret=$(echo $setupresponse | grep -oP '(?<="authClientSecret":")[^"]*')
patietnapisecret=$(echo $setupresponse | grep -oP '(?<="patientApiSecret":")[^"]*')
mvcclientsecret=$(echo $setupresponse | grep -oP '(?<="mvcClientSecret":")[^"]*')
angularclientsecret=$(echo $setupresponse | grep -oP '(?<="angularClientSecret":")[^"]*')
echo ""
echo "The Fabric.Installer secret is: $installersecret"
echo "You need this secret if you want to register additional API resources or clients."
echo ""
echo "The Fabric.GroupFetcher client secret is: $groupfetchersecret"
echo "You need this secret so the group fetcher can authenticate to get and save groups."
echo ""
echo "Update the Fabric.Authorization appsettings.json IdentityServerConfidentialClientSettings.ClientSecret value to:"
echo $authclientsecret
echo ""
echo "Update the Fabric.Identity.Samples.API appsettings.json IdentityServerConfidentialClientSettings.ClientSecret value to:"
echo $patietnapisecret
echo ""
echo "Update the Fabric.Identity.Samples.MVC appsettings.json IdentityServerConfidentialClientSettings.ClientSecret value to:"
echo $mvcclientsecret
echo ""
fi
echo "starting fabric.authorization"
docker run -d --name fabric.authorization \
-e "CouchDbSettings__Server=http://couchdb:5984" \
-e "CouchDbSettings__Username=$couchdb_username" \
-e "CouchDbSettings__Password=$couchdb_password" \
-e "IdentityServerConfidentialClientSettings__ClientSecret=$authclientsecret" \
-p 0.0.0.0:5004:5004 \
--link fabric.identity:localhost \
--link fabric.couchdb:couchdb \
healthcatalyst/fabric.authorization:$authzversion
sleep 10
if [ "$runsetup" = true ]; then
curl -sSL https://raw.githubusercontent.com/HealthCatalyst/Fabric.Authorization/master/Fabric.Authorization.API/scripts/setup-samples.sh | sh /dev/stdin $installersecret
fi