OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.
Python
fix: Factory reset results in a Backend start-up error: "Permission denied"
Mike Pawlowski7d8460acb679
diff --git a/Makefile b/Makefileindex ad4da2496..be229179a 100644--- a/Makefile+++ b/Makefile@@ -81,7 +81,7 @@ endef# PHONY TARGETS######################.PHONY: help check_tools help_docker help_dev help_test help_local help_utils \- dev dev-cpu dev-local dev-local-cpu dev-local-build-lf dev-local-build-lf-cpu ensure-rsa-keys stop clean build logs \+ dev dev-cpu dev-local dev-local-cpu dev-local-build-lf dev-local-build-lf-cpu ensure-rsa-keys ensure-config-dir stop clean build logs \shell-backend shell-frontend install \test test-unit test-integration test-ci test-ci-local test-sdk test-os-jwt lint \backend frontend docling docling-stop install-be install-fe build-be build-fe build-os build-lf logs-be logs-fe logs-lf logs-os \@@ -346,17 +346,31 @@ dev-cpu: ## Start full stack with CPU only@echo " $(CYAN)OpenSearch:$(NC) http://localhost:9200"@echo " $(CYAN)Dashboards:$(NC) http://localhost:5601"+ensure-config-dir: ## Create config directory if absent (owned by host user, prevents Docker from creating it as root)+ @if [ ! -d config ]; then \+ echo "$(YELLOW)Creating config directory...$(NC)"; \+ mkdir -p config; \+ echo "$(PURPLE)config directory created.$(NC)"; \+ fi+ensure-rsa-keys: ## Generate RSA keys for JWT signing if absent, or fix permissions if present+ @if [ ! -d keys ]; then \+ echo "$(YELLOW)Creating keys directory...$(NC)"; \+ mkdir -p keys; \+ echo "$(PURPLE)keys directory created.$(NC)"; \+ fi@if [ ! -f keys/private_key.pem ]; then \echo "$(YELLOW)Generating RSA keys for JWT signing...$(NC)"; \uv run python -c "from src.main import generate_jwt_keys; generate_jwt_keys()"; \+ echo "$(PURPLE)RSA keys for JWT signing generated.$(NC)"; \else \echo "$(CYAN)RSA keys already exist, ensuring correct permissions...$(NC)"; \chmod 600 keys/private_key.pem 2>/dev/null || true; \chmod 644 keys/public_key.pem 2>/dev/null || true; \+ echo "$(PURPLE)RSA keys permissions ensured.$(NC)"; \fi-dev-local: ensure-rsa-keys ## Start infrastructure for local development+dev-local: ensure-config-dir ensure-rsa-keys ## Start infrastructure for local development@echo "$(YELLOW)Starting infrastructure only (for local development)...$(NC)"$(COMPOSE_CMD) -f docker-compose.yml -f docker-compose.gpu.yml up -d opensearch openrag-backend dashboards langflow@echo "$(PURPLE)Infrastructure started!$(NC)"@@ -367,7 +381,7 @@ dev-local: ensure-rsa-keys ## Start infrastructure for local development@echo ""@echo "$(YELLOW)Now run 'make backend' and 'make frontend' in separate terminals$(NC)"-dev-local-cpu: ensure-rsa-keys ## Start infrastructure for local development, with CPU only+dev-local-cpu: ensure-config-dir ensure-rsa-keys ## Start infrastructure for local development, with CPU only@echo "$(YELLOW)Starting infrastructure only (for local development)...$(NC)"$(COMPOSE_CMD) up -d opensearch openrag-backend dashboards langflow@echo "$(PURPLE)Infrastructure started!$(NC)"@@ -378,7 +392,7 @@ dev-local-cpu: ensure-rsa-keys ## Start infrastructure for local development, wi@echo ""@echo "$(YELLOW)Now run 'make backend' and 'make frontend' in separate terminals$(NC)"-dev-local-build-lf: ensure-rsa-keys ## Start infrastructure for local development, building only Langflow image+dev-local-build-lf: ensure-config-dir ensure-rsa-keys ## Start infrastructure for local development, building only Langflow image@echo "$(YELLOW)Building Langflow image...$(NC)"$(COMPOSE_CMD) -f docker-compose.yml -f docker-compose.gpu.yml build langflow@echo "$(YELLOW)Starting infrastructure only (for local development)...$(NC)"@@ -391,7 +405,7 @@ dev-local-build-lf: ensure-rsa-keys ## Start infrastructure for local developmen@echo ""@echo "$(YELLOW)Now run 'make backend' and 'make frontend' in separate terminals$(NC)"-dev-local-build-lf-cpu: ensure-rsa-keys ## Start infrastructure for local development, building only Langflow image with CPU only+dev-local-build-lf-cpu: ensure-config-dir ensure-rsa-keys ## Start infrastructure for local development, building only Langflow image with CPU only@echo "$(YELLOW)Building Langflow image (CPU)...$(NC)"$(COMPOSE_CMD) build langflow@echo "$(YELLOW)Starting infrastructure only (for local development)...$(NC)"@@ -544,12 +558,14 @@ factory-reset: ## Complete reset (stop, remove volumes, clear data, remove imagefi; \if [ -d "config" ]; then \echo "Removing config..."; \- rm -rf config; \+ rm -rf config 2>/dev/null || \+ $(CONTAINER_RUNTIME) run --rm -v "$$(pwd):/data" alpine sh -c "rm -rf /data/config" 2>/dev/null || true; \echo "$(PURPLE)config removed$(NC)"; \fi; \if [ -f "keys/private_key.pem" ] || [ -f "keys/public_key.pem" ]; then \echo "Removing JWT keys..."; \- rm -f keys/private_key.pem keys/public_key.pem; \+ rm -f keys/private_key.pem keys/public_key.pem 2>/dev/null || \+ $(CONTAINER_RUNTIME) run --rm -v "$$(pwd)/keys:/data" alpine sh -c "rm -f /data/private_key.pem /data/public_key.pem" 2>/dev/null || true; \echo "$(PURPLE)JWT keys removed$(NC)"; \fi; \echo "$(YELLOW)Removing OpenRAG images...$(NC)"; \