Update 4 files
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 40s
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 40s
This commit is contained in:
@@ -56,29 +56,68 @@ fi
|
||||
echo "Starting ELK stack..."
|
||||
docker compose up -d --build || _die "Failed to start ELK stack"
|
||||
|
||||
# Wait for services to be ready
|
||||
# Wait for services to be ready with polling
|
||||
echo "Waiting for services to start..."
|
||||
sleep 10
|
||||
MAX_WAIT=120 # Maximum 2 minutes
|
||||
WAITED=0
|
||||
while [ $WAITED -lt $MAX_WAIT ]; do
|
||||
# Check if all services are running
|
||||
if bash ./status.sh 2>/dev/null | grep -q "Running"; then
|
||||
echo "All services are up!"
|
||||
break
|
||||
fi
|
||||
|
||||
# Check status
|
||||
bash ./status.sh || _die "Services failed to start properly"
|
||||
# Show progress
|
||||
echo -n "."
|
||||
sleep 2
|
||||
WAITED=$((WAITED + 2))
|
||||
done
|
||||
echo ""
|
||||
|
||||
if [ $WAITED -ge $MAX_WAIT ]; then
|
||||
echo "Warning: Services took longer than expected to start"
|
||||
echo "Checking current status..."
|
||||
bash ./status.sh || true
|
||||
fi
|
||||
|
||||
# Create custom user
|
||||
echo "Setting up custom user..."
|
||||
docker exec ${CONTAINER_NAME}_elasticsearch bash -c "
|
||||
until curl -s -u elastic:${ELASTIC_PASSWORD} http://localhost:9200/_cluster/health | grep -q '\"status\":\"yellow\"\|\"status\":\"green\"'; do
|
||||
sleep 2
|
||||
done
|
||||
echo "Setting up custom user '${KIBANA_USERNAME:-admin}'..."
|
||||
echo -n "Waiting for Elasticsearch API..."
|
||||
|
||||
curl -X POST -u elastic:${ELASTIC_PASSWORD} \
|
||||
# First wait for Elasticsearch to be ready
|
||||
WAITED=0
|
||||
while [ $WAITED -lt 60 ]; do
|
||||
if docker exec ${CONTAINER_NAME}_elasticsearch curl -s -u elastic:${ELASTIC_PASSWORD} http://localhost:9200/_cluster/health 2>/dev/null | grep -q '"status":"yellow"\|"status":"green"'; then
|
||||
echo " Ready!"
|
||||
break
|
||||
fi
|
||||
echo -n "."
|
||||
sleep 2
|
||||
WAITED=$((WAITED + 2))
|
||||
done
|
||||
|
||||
if [ $WAITED -lt 60 ]; then
|
||||
# Now create the user
|
||||
docker exec ${CONTAINER_NAME}_elasticsearch bash -c "
|
||||
|
||||
result=\$(curl -s -X POST -u elastic:${ELASTIC_PASSWORD} \
|
||||
-H 'Content-Type: application/json' \
|
||||
http://localhost:9200/_security/user/${KIBANA_USERNAME:-admin} \
|
||||
-d '{
|
||||
\"password\" : \"${KIBANA_USER_PASSWORD:-changeme}\",
|
||||
\"roles\" : [ \"superuser\" ],
|
||||
\"full_name\" : \"Admin User\"
|
||||
}' 2>/dev/null || true
|
||||
"
|
||||
}' 2>/dev/null)
|
||||
|
||||
if echo \"\$result\" | grep -q '\"created\":true'; then
|
||||
echo \"User created successfully\"
|
||||
else
|
||||
echo \"User already exists (this is fine)\"
|
||||
fi
|
||||
"
|
||||
else
|
||||
echo "Warning: Elasticsearch API not ready after 60 seconds"
|
||||
fi
|
||||
|
||||
echo "Installation of ${CONTAINER_NAME} complete"
|
||||
echo ""
|
||||
|
Reference in New Issue
Block a user