- Shell 79.4%
- Go Template 20.6%
chore(deps): update helm release editor-app to v2.9.0 See merge request logius/nldoc/infra/nldoc!36 |
||
|---|---|---|
| charts/db-secrets | ||
| scripts | ||
| values | ||
| .editorconfig | ||
| .gitignore | ||
| CODEOWNERS | ||
| helmfile.yaml | ||
| INGRESS.md | ||
| INSTALL.md | ||
| LICENSE | ||
| list-credentials.sh | ||
| README.md | ||
| renovate.json | ||
| setup-nldoc.sh | ||
NLdoc Application
A document conversion infrastructure, featuring authentication, API access, and a web-based editor.
Quick Start
Prerequisites
- Rancher Desktop or another Kubernetes cluster (Linux, macOS, Windows)
- kubectl - Kubernetes command-line tool
- helmfile - Kubernetes package manager
- terraform - Infrastructure as code tool
- mkcert (recommended for TLS)
Setup
Run the automated setup script:
./setup-nldoc.sh
This script will:
- Verify prerequisites
- Create Kubernetes namespaces
- Set up certificate management
- Configure local DNS entries
- Deploy all services with Helmfile
- Configure authentication with Terraform
Setup Script Options
The setup script supports several command-line flags to customize the installation:
./setup-nldoc.sh [OPTIONS]
Available flags:
--verboseor-v- Show verbose output from helmfile operations--reset- Delete all namespaces before setup (runs cleanup script)--skip-ingress- Skip Traefik ingress controller setup--skip-namespaces- Skip namespace creation--skip-hosts- Skip /etc/hosts file configuration--skip-cert- Skip certificate management setup--skip-logging- Skip ELK stack (Elasticsearch, Kibana, Filebeat) deployment
Examples:
# Full setup with verbose output
./setup-nldoc.sh --verbose
# Skip certificate setup for development
./setup-nldoc.sh --skip-cert
For alternative setup methods and detailed manual instructions, see INSTALL.md.
Application Components
Infrastructure Services
- PostgreSQL - Primary database
- RabbitMQ - Message queue for async processing
- MinIO - S3-compatible object storage
Application Services
- Editor App - Web-based document editor (frontend)
- API - REST API for document operations (backend)
- Kimi - Document processing service
Access URLs
After setup, access the application at:
- Editor App: https://editor-app.nldoc.k8s
- API: https://api.nldoc.k8s
- RabbitMQ Management: https://rabbitmq.nldoc.k8s (username:
user) - MinIO Console: https://minio.nldoc.k8s
Useful Commands
Check Application Status
# View all pods
kubectl get pods -A
# Check specific services
kubectl get pods -n nld-app # API and Editor
kubectl get pods -n nld-kimi # Processing service
View Logs
# API logs
kubectl logs -n nld-app deployment/api -f
# Editor app logs
kubectl logs -n nld-app deployment/editor-app -f
# Processing service logs (with structured logging)
kubectl logs -n nld-kimi -l app.kubernetes.io/name=kimi -f --max-log-requests 100 | ecslog -l info
Credentials and Access
# List all ingress endpoints
kubectl get ingress -A
# Get service credentials
./list-credentials.sh
# Test API authentication
./test_auth.sh
Configuration
Local Development
- Copy
terraform/terraform.tfvars.local.exampletoterraform/terraform.tfvars.local - Modify organization settings as needed
- Run
./setup-nldoc.shto apply changes
Production
- Configure
terraform/terraform.tfvarsfor your environment - Set up proper TLS certificates
- Configure external databases if needed
Troubleshooting
Common Issues
Services not accessible
# Check ingress configuration
kubectl get ingress -A
kubectl describe ingress -n nld-app api
# Check DNS resolution
nslookup api.nldoc.k8s
Certificate issues
# Check certificates
kubectl get certificates -A
kubectl describe certificate -n nld-app api-cert
Pod startup issues
# Check pod status
kubectl get pods -n nld-app
kubectl describe pod -n nld-app <pod-name>
Getting Help
- Check logs for the specific service having issues
- Verify all prerequisites are properly installed
- Ensure Kubernetes cluster is running and accessible
- Check that all required ports are available
Development
Architecture
The application follows a microservices pattern:
- Frontend (Editor App) communicates with Backend (API)
- API processes requests and queues jobs via RabbitMQ
- Kimi service processes queued jobs
- All services use PostgreSQL for persistence
- MinIO stores file attachments and processed documents
Making Changes
- Application code is deployed via Helm charts from GitLab registries
- Infrastructure changes go through the helmfile.yaml
- Authentication configuration is managed via Terraform
For more detailed development information, see the individual service repositories.
Helper Scripts
The scripts/ directory contains modular helper scripts used by the main setup process:
Core Setup Scripts
check-prerequisites.sh- Verifies all required tools are installed and detects Kubernetes environmentsetup-namespaces.sh- Creates all required Kubernetes namespacessetup-ingress-controller.sh- Installs and configures Traefik ingress controllersetup-cert-management.sh- Sets up cert-manager and mkcert for TLS certificatessetup-hosts-file.sh- Configures local /etc/hosts entries for service accesssetup-logging.sh- Configures ELK stack (Elasticsearch, Kibana, Filebeat) with JSON log parsing
Utility Scripts
common.sh- Shared functions for colored output and waiting operationsdelete-all-namespaces.sh- Safely removes all nld-* namespaces with confirmationreset-terraform.sh- Resets Terraform state and configurationsetup-kibana-dataview.sh- Creates Kibana data views for log visualization
All scripts can be run independently, but the main setup-nldoc.sh orchestrates them in the correct order. Scripts respect the same flags passed to the main setup script (e.g., --verbose).