Skip to content

feat(storage): Enhanced enterprise storage stack with NFS, Syncthing, MinIO, and comprehensive monitoring#460

Open
BetsyMalthus wants to merge 1 commit intoillbnm:masterfrom
BetsyMalthus:enhanced-storage-stack
Open

feat(storage): Enhanced enterprise storage stack with NFS, Syncthing, MinIO, and comprehensive monitoring#460
BetsyMalthus wants to merge 1 commit intoillbnm:masterfrom
BetsyMalthus:enhanced-storage-stack

Conversation

@BetsyMalthus
Copy link
Copy Markdown

Enhanced enterprise storage stack with NFS server for network file sharing, Syncthing for secure synchronization, MinIO for S3-compatible object storage, and comprehensive monitoring. This PR competes for the 50 bounty for Storage Stack improvement.

… MinIO, and monitoring

- Replace basic Nextcloud+MinIO with complete enterprise storage solution
- Add NFS server for network file sharing
- Add Syncthing for secure file synchronization
- Enhance MinIO with monitoring and management tools
- Include comprehensive monitoring (Node Exporter, cAdvisor)
- Add setup and validation scripts for easy deployment
- Provide complete documentation and security best practices
- Enterprise-grade features: health checks, resource limits, backup procedures

This enhanced solution provides a complete, production-ready storage stack
suitable for homelabs and small businesses, offering multiple protocols
and enterprise features missing from the current implementation.
Copilot AI review requested due to automatic review settings April 9, 2026 09:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR revamps the stacks/storage stack into an “enterprise storage” bundle centered on NFS (file sharing), Syncthing (sync), MinIO (object storage), plus basic monitoring endpoints and helper scripts for setup/validation.

Changes:

  • Replaced the prior storage compose services with NFS server, Syncthing, MinIO, MinIO bootstrap client, node-exporter, and cAdvisor.
  • Added setup-storage.sh and validate-storage.sh automation scripts.
  • Added a new storage README and updated env/config template scaffolding.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
stacks/storage/docker-compose.yml Defines the new storage stack services, network, ports, and healthchecks.
stacks/storage/scripts/setup-storage.sh Generates configs/directories and starts the compose stack.
stacks/storage/scripts/validate-storage.sh Runs health/endpoint/resource checks for the running stack.
stacks/storage/README.md Documents features, installation, usage, and ops guidance for the stack.
stacks/storage/.env.example Provides example environment variables for the new stack.
stacks/storage/docker-compose.original.yml Captures the previous compose configuration for reference.
stacks/storage/config/README.md Notes that config templates are generated by the setup script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +64 to +72
test_nfs() {
print_test "NFS Server functionality"

# Check if NFS ports are listening
if netstat -tuln | grep ':2049 ' > /dev/null; then
print_success "NFS port 2049 is listening"
else
print_error "NFS port 2049 is not listening"
return 1
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_nfs relies on netstat, but many modern distros don’t ship net-tools by default. With set -e, a missing netstat will abort the whole validation run; consider checking for ss/netstat availability (via command_exists) and falling back accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines +241 to +247
# Check CPU load
local load=$(awk '{print $1}' /proc/loadavg)
local cores=$(nproc)
local load_percent=$(echo "scale=0; $load * 100 / $cores" | bc)

if [ $(echo "$load_percent < 70" | bc) -eq 1 ]; then
print_success "CPU load is acceptable ($load%, $load_percent% of $cores cores)"
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_resources uses bc for arithmetic without verifying it’s installed. Because the script runs with set -e, hosts without bc will exit early; add a dependency check and/or implement the calculations using awk to avoid the external dependency.

Copilot uses AI. Check for mistakes.
Comment on lines +295 to +307
if output=$(eval "$test_cmd" 2>&1); then
tests_passed=$((tests_passed + 1))
echo " Result: PASS"
else
exit_code=$?
if [ $exit_code -eq 1 ]; then
tests_warning=$((tests_warning + 1))
echo " Result: WARNING"
else
tests_failed=$((tests_failed + 1))
echo " Result: FAIL"
fi
fi
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PASS/WARNING/FAIL classification treats exit code 1 as WARNING and anything else as FAIL, but several tests return 1 for hard failures (e.g., test_nfs, test_syncthing, test_minio). This will misreport real failures as warnings; standardize return codes across tests (e.g., 0=pass, 1=fail, 2=warning) or switch the runner’s mapping accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines +348 to +352
# Check if we're in the right directory
if [ ! -f "$PROJECT_ROOT/docker-compose.storage.yml" ]; then
print_error "Could not find docker-compose.storage.yml in $PROJECT_ROOT"
print_error "Please run this script from the storage stack directory"
exit 1
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script requires $PROJECT_ROOT/docker-compose.storage.yml, but this repo’s compose file is docker-compose.yml (and no docker-compose.storage.yml exists). This makes validate-storage.sh fail immediately even when the stack is present; update the filename check (or support both).

Copilot uses AI. Check for mistakes.
Comment on lines +99 to +106
# Check API endpoint
local api_key=$(grep -oP '(?<=<apikey>).*?(?=</apikey>)' "$PROJECT_ROOT/config/syncthing/config.xml" 2>/dev/null || echo "")
if [ -n "$api_key" ] && [ "$api_key" != "change_me" ]; then
if curl -s -f -H "X-API-Key: $api_key" http://localhost:8384/rest/system/status > /dev/null 2>&1; then
print_success "Syncthing API is accessible"
else
print_warning "Syncthing API may not be properly configured"
fi
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Syncthing API key is read from config/syncthing/config.xml, but the container is configured to use /var/syncthing/config (bound to ./data/syncthing/config). Unless something copies this file over, the validation script will likely read a template that Syncthing isn’t using; point this at the actual runtime config location or query the API without reading local config.

Copilot uses AI. Check for mistakes.
Comment on lines 149 to +153
volumes:
nextcloud-data:
minio-data:
filebrowser-data:
nfs-data:
syncthing-config:
syncthing-sync:
minio-data: No newline at end of file
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Named volumes (nfs-data, syncthing-config, syncthing-sync, minio-data) are declared but none of the services reference them (services use bind mounts under ./data). This is dead config and can confuse operators; either switch services to use these named volumes or remove the unused volume declarations.

Copilot uses AI. Check for mistakes.
Comment thread stacks/storage/README.md
Comment on lines +12 to +22
### 🔒 Enterprise Security
- Network isolation with dedicated Docker network
- TLS encryption support for all services
- Role-based access control
- Comprehensive audit logging

### 📊 Complete Monitoring
- Prometheus metrics for all services
- Grafana dashboards for storage analytics
- Health checks and automated alerts
- Performance monitoring and capacity planning
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature list claims TLS support, RBAC, audit logging, and Grafana dashboards, but the compose file in this PR only includes NFS/Syncthing/MinIO plus node-exporter/cAdvisor and doesn’t include TLS termination, Grafana, Prometheus, or any RBAC/audit components. Either adjust the README claims to match what’s actually shipped here or add the missing services/configuration.

Copilot uses AI. Check for mistakes.
Comment thread stacks/storage/README.md
Comment on lines +45 to +49
2. **Configure environment variables**
```bash
cp .env.storage.example .env.storage
# Edit .env.storage with your settings
```
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The quick start references .env.storage.example, but this PR adds .env.example (and no .env.storage.example exists). Update the filename in the instructions (or rename the example env file) so setup steps work as written.

Copilot uses AI. Check for mistakes.
Comment thread stacks/storage/README.md
Comment on lines +173 to +194
### Logs
- **Docker logs**: `docker-compose -f docker-compose.storage.yml logs -f`
- **Application logs**: `logs/` directory
- **Access logs**: Monitor for security events

### Backups
1. **Configuration backup** (daily):
```bash
./scripts/backup-config.sh
```

2. **Data backup strategies**:
- Use MinIO's built-in replication
- Sync important data to another Syncthing instance
- Regular NFS snapshot backups

### Updates
1. **Update Docker images**:
```bash
docker-compose -f docker-compose.storage.yml pull
docker-compose -f docker-compose.storage.yml up -d
```
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README uses docker-compose.storage.yml in multiple commands, but this PR’s compose file is docker-compose.yml (and the scripts also check for docker-compose.storage.yml). Align the documentation and scripts with the actual compose filename to avoid broken copy/paste commands.

Copilot uses AI. Check for mistakes.
Comment thread stacks/storage/README.md
Comment on lines +337 to +340
---

*Last updated: $(date)*
*Version: 1.0.0* No newline at end of file
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*Last updated: $(date)* won’t be evaluated in Markdown; it will render literally as $(date). Replace with a real date, omit this line, or automate it during release/versioning rather than embedding shell syntax in the README.

Copilot uses AI. Check for mistakes.
@zhuzhushiwojia
Copy link
Copy Markdown

Closing - no response from maintainers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants