-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·157 lines (135 loc) · 5.72 KB
/
deploy.sh
File metadata and controls
executable file
·157 lines (135 loc) · 5.72 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/bash
#
# Deployment script for Curity UI Kit
#
# This script deploys build artifacts (assets, templates, and messages) to a production environment.
#
# Prerequisites:
# - Set IDSVR_HOME environment variable to your Identity Server installation directory
# - Run the build process before deploying: npm run build
#
# Usage:
# ./deploy.sh [template-area-name]
#
# Without arguments: Deploys to overrides only
# With template-area-name: Deploys only to the specified template area (not to overrides)
#
set -e
# Parse arguments
TEMPLATE_AREA=""
if [ $# -gt 0 ]; then
TEMPLATE_AREA="$1"
fi
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if IDSVR_HOME is set
if [ -z "$IDSVR_HOME" ]; then
echo -e "${RED}Error: IDSVR_HOME environment variable is not set${NC}"
echo "Please set IDSVR_HOME to point to your Identity Server installation directory"
echo "Example: export IDSVR_HOME=/path/to/idsvr/dist"
exit 1
fi
# Check if IDSVR_HOME exists
if [ ! -d "$IDSVR_HOME" ]; then
echo -e "${RED}Error: IDSVR_HOME directory does not exist: $IDSVR_HOME${NC}"
exit 1
fi
echo -e "${GREEN}Starting deployment to: $IDSVR_HOME/usr/share${NC}"
echo ""
# Function to copy files with feedback
copy_with_feedback() {
local source=$1
local dest=$2
local description=$3
if [ -e "$source" ]; then
echo -e "${YELLOW}Deploying $description...${NC}"
mkdir -p "$dest"
cp -r "$source" "$dest"
echo -e "${GREEN}✓ $description deployed${NC}"
else
echo -e "${YELLOW}⚠ Skipping $description (source not found: $source)${NC}"
fi
}
echo "================================================"
echo "Identity Server Deployment"
echo "================================================"
# Identity Server - Assets (CSS, Fonts, Images, JS)
copy_with_feedback \
"src/identity-server/build/webroot" \
"$IDSVR_HOME/usr/share/" \
"Identity Server Assets (CSS, Fonts, Images, JS)"
# Identity Server - Templates
copy_with_feedback \
"src/identity-server/build/templates" \
"$IDSVR_HOME/usr/share/" \
"Identity Server Templates"
# Identity Server - Messages
copy_with_feedback \
"src/identity-server/build/messages" \
"$IDSVR_HOME/usr/share/" \
"Identity Server Messages"
echo ""
echo "================================================"
echo "Self Service Portal Deployment"
echo "================================================"
# Self Service Portal - Check if dist exists
if [ ! -d "src/self-service-portal/app/dist" ]; then
echo -e "${YELLOW}⚠ Self Service Portal build not found. Skipping USSP deployment.${NC}"
echo -e "${YELLOW} Run 'npm run build:ussp' first if you want to deploy the Self Service Portal.${NC}"
else
if [ -n "$TEMPLATE_AREA" ]; then
# Deploy to specific template area only
echo -e "${YELLOW}Deploying Self Service Portal to template area: $TEMPLATE_AREA${NC}"
USSP_TEMPLATE_PATH="$IDSVR_HOME/usr/share/templates/template-areas/$TEMPLATE_AREA/apps/self-service-portal"
USSP_MESSAGES_BASE="$IDSVR_HOME/usr/share/messages/template-areas/$TEMPLATE_AREA"
# Check if template area exists
if [ ! -d "$IDSVR_HOME/usr/share/templates/template-areas/$TEMPLATE_AREA" ]; then
echo -e "${RED}Error: Template area '$TEMPLATE_AREA' does not exist in $IDSVR_HOME/usr/share/templates/template-areas/${NC}"
exit 1
fi
mkdir -p "$USSP_TEMPLATE_PATH"
cp src/self-service-portal/app/dist/index.html "$USSP_TEMPLATE_PATH/index.vm"
cp -r src/self-service-portal/app/dist/assets "$USSP_TEMPLATE_PATH/" 2>/dev/null || true
echo -e "${GREEN}✓ Self Service Portal Templates deployed to template area: $TEMPLATE_AREA${NC}"
# Deploy USSP Messages for this template area
if [ -d "src/self-service-portal/messages" ]; then
for lang_dir in src/self-service-portal/messages/*/; do
if [ -d "$lang_dir" ]; then
lang=$(basename "$lang_dir")
dest_dir="$USSP_MESSAGES_BASE/$lang/apps/self-service-portal"
mkdir -p "$dest_dir"
cp -r "$lang_dir"* "$dest_dir/"
echo -e "${GREEN}✓ Self Service Portal Messages ($lang) deployed to template area: $TEMPLATE_AREA${NC}"
fi
done
fi
else
# Deploy to overrides
echo -e "${YELLOW}Deploying Self Service Portal templates and messages to overrides...${NC}"
USSP_TEMPLATE_PATH="$IDSVR_HOME/usr/share/templates/overrides/apps/self-service-portal"
USSP_MESSAGES_BASE="$IDSVR_HOME/usr/share/messages/overrides"
mkdir -p "$USSP_TEMPLATE_PATH"
cp src/self-service-portal/app/dist/index.html "$USSP_TEMPLATE_PATH/index.vm"
cp -r src/self-service-portal/app/dist/assets "$USSP_TEMPLATE_PATH/" 2>/dev/null || true
echo -e "${GREEN}✓ Self Service Portal Templates assets and templates deployed to overrides${NC}"
# Deploy USSP Messages for overrides
if [ -d "src/self-service-portal/messages" ]; then
for lang_dir in src/self-service-portal/messages/*/; do
if [ -d "$lang_dir" ]; then
lang=$(basename "$lang_dir")
dest_dir="$USSP_MESSAGES_BASE/$lang/apps/self-service-portal"
mkdir -p "$dest_dir"
cp -r "$lang_dir"* "$dest_dir/"
echo -e "${GREEN}✓ Self Service Portal Messages ($lang) deployed to overrides${NC}"
fi
done
fi
fi
fi
echo ""
echo "================================================"
echo -e "${GREEN}Deployment completed successfully!${NC}"
echo "================================================"