Skip to content

Commit 56552c0

Browse files
Programmatically register RavenDB license after the server starts instead of using an environment variable (which might be ignored)
1 parent 98e15e1 commit 56552c0

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/ServiceControl.RavenDB/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ RUN chown 999:999 /var/lib/ravendb/data
1010
USER ravendb
1111

1212
ENV RAVEN_License_Eula_Accepted=true \
13-
RAVEN_License_Path=/usr/lib/ravendb/servicecontrol-license.json \
1413
RAVEN_Setup_Mode=None
1514

1615
LABEL org.opencontainers.image.source=https://github.com/Particular/ServiceControl \

src/ServiceControl.RavenDB/sc-container-startup.sh

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,31 @@ if [[ -d "$LEGACY_PATH" ]]; then
77
exit 1
88
fi
99

10-
source /usr/lib/ravendb/scripts/run-raven.sh
10+
source /usr/lib/ravendb/scripts/run-raven.sh &
11+
RAVEN_PID=$!
12+
13+
# Wait for RavenDB to be ready (with retries)
14+
echo "Waiting for RavenDB to start..."
15+
for i in {1..30}; do
16+
if curl -s http://localhost:8080/admin/stats > /dev/null 2>&1; then
17+
echo "RavenDB is ready!"
18+
break
19+
fi
20+
sleep 1
21+
done
22+
23+
# Register license
24+
echo "Registering license..."
25+
LICENSE_JSON=$(cat /usr/lib/ravendb/servicecontrol-license.json)
26+
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST http://localhost:8080/admin/license/activate \
27+
-H "Content-Type: application/json" \
28+
-d "$LICENSE_JSON")
29+
30+
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
31+
if [ "$HTTP_CODE" -eq 200 ] || [ "$HTTP_CODE" -eq 204 ]; then
32+
echo "License registered successfully!"
33+
else
34+
echo "Warning: License registration returned HTTP $HTTP_CODE"
35+
fi
36+
37+
wait $RAVEN_PID

0 commit comments

Comments
 (0)