-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-full-stack.sh
More file actions
executable file
·308 lines (244 loc) · 8.52 KB
/
Copy pathdeploy-full-stack.sh
File metadata and controls
executable file
·308 lines (244 loc) · 8.52 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
#!/usr/bin/env bash
# SPDX-License-Identifier: MPL-2.0
# Pimcore Fortress - Full Stack Deployment Script
#
# Deploys complete verified container ecosystem + databases + Pimcore CMS
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
HYPERPOLYMATH_REPOS="$HOME/Documents/hyperpolymath-repos"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[✓]${NC} $1"
}
log_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
check_dependencies() {
log_info "Checking system dependencies..."
local missing=()
# Check for required commands
command -v podman >/dev/null 2>&1 || missing+=("podman")
command -v podman-compose >/dev/null 2>&1 || missing+=("podman-compose")
command -v php >/dev/null 2>&1 || missing+=("php")
command -v composer >/dev/null 2>&1 || missing+=("composer")
command -v deno >/dev/null 2>&1 || missing+=("deno")
command -v jq >/dev/null 2>&1 || missing+=("jq")
if [ ${#missing[@]} -gt 0 ]; then
log_error "Missing dependencies: ${missing[*]}"
log_info "Install with:"
log_info " sudo dnf install ${missing[*]} -y"
return 1
fi
# Check for clang-devel (needed for VerisimDB)
if ! rpm -qa | grep -q clang-devel; then
log_warning "clang-devel not installed (needed for VerisimDB)"
log_info " sudo dnf install clang-devel -y"
fi
log_success "All dependencies satisfied"
return 0
}
start_databases() {
log_info "Starting databases (PostgreSQL + Redis)..."
cd "$SCRIPT_DIR"
podman-compose -f docker-compose.dev.yml up -d db redis
log_info "Waiting for databases to be ready..."
sleep 5
# Test PostgreSQL
if podman exec pimcore-fortress-db-1 pg_isready -U pimcore >/dev/null 2>&1; then
log_success "PostgreSQL ready (port 5432)"
else
log_error "PostgreSQL failed to start"
return 1
fi
# Test Redis
if podman exec pimcore-fortress-redis-1 redis-cli ping >/dev/null 2>&1; then
log_success "Redis ready (port 6379)"
else
log_error "Redis failed to start"
return 1
fi
}
start_vordr() {
log_info "Starting Vörðr container runtime (port 8080)..."
cd "$HYPERPOLYMATH_REPOS/vordr/src/mcp-adapter"
# Kill existing instance
if [ -f "$HYPATIA_TMPDIR/vordr-mcp.pid" ]; then
kill "$(cat "$HYPATIA_TMPDIR/vordr-mcp.pid")" 2>/dev/null || true
fi
# Start Vörðr
nohup deno run --allow-net --allow-read --allow-env http-server.ts \
> "$HYPATIA_TMPDIR/vordr-mcp.log" 2>&1 &
echo $! > "$HYPATIA_TMPDIR/vordr-mcp.pid"
sleep 3
# Test
if curl -s -X POST http://localhost:8080 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"ping"}' \
| grep -q '"pong"'; then
log_success "Vörðr running (PID: $(cat "$HYPATIA_TMPDIR/vordr-mcp.pid"))"
else
log_error "Vörðr failed to start"
return 1
fi
}
start_svalinn() {
log_info "Starting Svalinn edge gateway (port 8000)..."
cd "$HYPERPOLYMATH_REPOS/svalinn"
# Kill existing instance
pkill -f "deno.*svalinn" || true
# Start Svalinn
AUTH_ENABLED=false \
SVALINN_PORT=8000 \
VORDR_ENDPOINT=http://localhost:8080 \
nohup deno task start > "$HYPATIA_TMPDIR/svalinn.log" 2>&1 &
echo $! > "$HYPATIA_TMPDIR/svalinn.pid"
sleep 3
# Test
if curl -s http://localhost:8000/health | grep -q '"version"'; then
log_success "Svalinn running (PID: $(cat "$HYPATIA_TMPDIR/svalinn.pid"))"
else
log_error "Svalinn failed to start"
return 1
fi
}
start_verisimdb() {
log_info "Starting VerisimDB provenance ledger (port 9090)..."
local binary="$HYPERPOLYMATH_REPOS/verisimdb/target/release/verisimdb"
if [ ! -f "$binary" ]; then
log_warning "VerisimDB not built yet"
log_info "Building VerisimDB (this may take several minutes)..."
cd "$HYPERPOLYMATH_REPOS/verisimdb"
cargo build --release
if [ ! -f "$binary" ]; then
log_error "VerisimDB build failed"
return 1
fi
fi
# Kill existing instance
pkill -f "verisimdb.*--port" || true
# Start VerisimDB
nohup "$binary" --port 9090 > "$HYPATIA_TMPDIR/verisimdb.log" 2>&1 &
echo $! > "$HYPATIA_TMPDIR/verisimdb.pid"
sleep 3
log_success "VerisimDB running (PID: $(cat "$HYPATIA_TMPDIR/verisimdb.pid"))"
}
install_pimcore() {
log_info "Installing Pimcore dependencies..."
cd "$SCRIPT_DIR"
if [ ! -d "vendor" ]; then
log_info "Running composer install..."
composer install --no-interaction --optimize-autoloader
log_success "Composer dependencies installed"
else
log_success "Composer dependencies already installed"
fi
# Check .env file
if [ ! -f ".env" ]; then
log_info "Creating .env file..."
cat > .env << 'ENVEOF'
APP_ENV=dev
APP_DEBUG=true
APP_SECRET=$(openssl rand -hex 32)
DATABASE_URL="postgresql://pimcore:pimcore@localhost:5432/pimcore"
REDIS_URL="redis://localhost:6379"
LITHOGLYPH_API_URL="http://localhost:8082"
VERISIMDB_ENDPOINT="http://localhost:9090/sparql"
PIMCORE_ADMIN_USERNAME=admin
PIMCORE_ADMIN_PASSWORD=admin
ENVEOF
log_success ".env file created"
fi
# Initialize Pimcore database
log_info "Initializing Pimcore database..."
php bin/console doctrine:database:create --if-not-exists
php bin/console doctrine:schema:update --force
php bin/console cache:clear
log_success "Pimcore initialized"
}
start_pimcore() {
log_info "Starting Pimcore web server (port 8081)..."
cd "$SCRIPT_DIR"
# Kill existing PHP server
pkill -f "php.*8081" || true
# Start Pimcore
nohup php -S localhost:8081 -t public/ > "$HYPATIA_TMPDIR/pimcore.log" 2>&1 &
echo $! > "$HYPATIA_TMPDIR/pimcore.pid"
sleep 3
if curl -s http://localhost:8081 >/dev/null 2>&1; then
log_success "Pimcore running (PID: $(cat "$HYPATIA_TMPDIR/pimcore.pid"))"
log_success "Access at: http://localhost:8081"
else
log_error "Pimcore failed to start"
return 1
fi
}
print_status() {
echo ""
echo "======================================"
echo " Pimcore Fortress - Service Status"
echo "======================================"
echo ""
# Check each service
services=(
"PostgreSQL:5432:podman ps -f name=db --format '{{.Status}}'"
"Redis:6379:podman ps -f name=redis --format '{{.Status}}'"
"Vörðr:8080:curl -s -X POST http://localhost:8080 -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"ping\"}'"
"Svalinn:8000:curl -s http://localhost:8000/health"
"VerisimDB:9090:[ -f "$HYPATIA_TMPDIR/verisimdb.pid" ] && ps -p \$(cat "$HYPATIA_TMPDIR/verisimdb.pid")"
"Pimcore:8081:curl -s http://localhost:8081"
)
for service_def in "${services[@]}"; do
IFS=':' read -r name port check <<< "$service_def"
printf " %-12s [%s] " "$name" "$port"
if eval "$check" >/dev/null 2>&1; then
echo -e "${GREEN}✓ Running${NC}"
else
echo -e "${RED}✗ Stopped${NC}"
fi
done
echo ""
echo "======================================"
echo ""
}
main() {
echo ""
echo "======================================"
echo " Pimcore Fortress Deployment"
echo " Verified Container Ecosystem"
echo "======================================"
echo ""
# Check dependencies first
if ! check_dependencies; then
log_error "Dependency check failed"
exit 1
fi
# Start services in order
start_databases || { log_error "Database startup failed"; exit 1; }
start_vordr || { log_error "Vörðr startup failed"; exit 1; }
start_svalinn || { log_error "Svalinn startup failed"; exit 1; }
start_verisimdb || log_warning "VerisimDB startup failed (non-critical)"
# Pimcore setup
install_pimcore || { log_error "Pimcore installation failed"; exit 1; }
start_pimcore || { log_error "Pimcore startup failed"; exit 1; }
# Print final status
print_status
log_success "Deployment complete!"
log_info "Next steps:"
log_info " 1. Access Pimcore at http://localhost:8081"
log_info " 2. Login with admin/admin"
log_info " 3. Upload assets to test Lithoglyph integration"
echo ""
}
# Run main function
main "$@"