๐ A complete, containerized media management system with WebDAV and S3 support, Apache Camel integration, and a modern web interface.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Client Applications โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Web App โ โ Mobile App โ โ 3rd Party Clients โ โ
โ โโโโโโโฌโโโโโโโโ โโโโโโโโฌโโโโโโโ โโโโโโโโโโโโฌโโโโโโโโโโโ โ
โ โ โ โ โ
โโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ API Gateway (Nginx) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโดโโโโโโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ WebDAV Server โ โ Backend API โ
โ (Nginx + WebDAV) โ โ (Node.js + Express) โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโโ โโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ โ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Storage Backend โ โ Database (PostgreSQL) โ
โ โข Local Filesystem โ โ - User accounts โ
โ โข S3-Compatible โ โ - File metadata โ
โ โข WebDAV Mounts โ โ - Access controls โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
git clone https://github.com/yourusername/mediacamel.git
cd mediacamel
make setup
This will:
.env
file from .env.example
if it doesnโt exist.env
file to customize your setup:
cp .env.example .env
nano .env
Key settings to review:
WEBDAV_USER
and WEBDAV_PASSWORD
MINIO_ROOT_USER
and MINIO_ROOT_PASSWORD
for S3 accessmake build
make up
make logs
make status
This will show all running services and their status.
make setup # Setup project environment
make build # Build all Docker containers
make up # Start all services
make down # Stop and remove all containers
make restart # Restart all services
make logs # Show logs for all services
make clean # Remove all containers, networks, and volumes
make status # Show service status and URLs
make test-webdav # Test WebDAV connection
make test-api # Test API endpoints
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ Web Users โ โ Filestash Web โ โ Apache Camel โ โ MedaVault โ
โ โโโโโถโ Client โ โ Integration โโโโโถโ Photo Vault โ
โ (Upload files) โ โ (WebDAV GUI) โ โ (Processing) โ โ (Storage) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ WebDAV Server โ โ PostgreSQL โ
โ (nginx) โ โ Database โ
โ Port: 8081 โ โ (Metadata) โ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
Service | Port | Description |
---|---|---|
WebDAV Server | 8081 | WebDAV file access |
Filestash Client | 8082 | Web-based file manager |
Status Endpoint | 8084 | WebDAV server status |
MedaVault Backend | 8084 | REST API and business logic |
Web Dashboard | 8085 | Admin dashboard and monitoring |
:8084/status
# Clone the repository
git clone https://github.com/wronai/mediacamel.git
cd mediacamel
# Copy and configure environment variables
cp .env.example .env
# Edit .env file if needed
# Make setup script executable
chmod +x setup.sh
# Build and start all services
./setup.sh
URL: http://localhost:8081
Username: webdav
Password: medavault123
# Run the test script
./scripts/test-webdav.sh
http://webdav-server
webdav
medavault123
curl -u webdav:medavault123 \
-T your-file.jpg \
"http://localhost:8081/your-file.jpg"
rclone config create webdav webdav \
url=http://localhost:8081 \
vendor=other \
user=webdav \
pass=medavault123
rclone copy local-folder/ webdav:
# Install davfs2
sudo apt install davfs2
# Add user to davfs2 group
sudo usermod -aG davfs2 $(whoami)
# Mount WebDAV
sudo mount -t davfs http://localhost:8081 /mnt/webdav
\\localhost@8081\
http://localhost:8081
mediacamel/
โโโ docker-compose.yml # Main Docker Compose configuration
โโโ .env # Environment variables
โโโ config/ # Configuration files
โ โโโ nginx/ # Nginx configurations
โ โโโ filestash/ # Filestash configuration
โ โโโ medavault/ # MedaVault application configs
โโโ camel-integration/ # Apache Camel integration
โ โโโ Dockerfile
โ โโโ CamelWebDAVProcessor.groovy
โ โโโ lib/ # Custom Java/Groovy libraries
โโโ medavault-backend/ # Node.js API
โ โโโ src/
โ โโโ package.json
โ โโโ Dockerfile
โโโ web-dashboard/ # React/Vue dashboard
โ โโโ public/
โ โโโ src/
โ โโโ package.json
โโโ storage/ # Persistent storage
โ โโโ incoming/ # New uploads
โ โโโ processed/ # Successfully processed files
โ โโโ failed/ # Failed processing attempts
โโโ scripts/ # Utility scripts
โ โโโ setup.sh # Initial setup
โ โโโ test-webdav.sh # WebDAV connection test
โ โโโ backup.sh # Backup utilities
โโโ logs/ # Application logs
MedaVault uses MinIO as an S3-compatible object storage backend. Files can be accessed using any S3-compatible client.
Configuration Options:
S3_ENDPOINT
: MinIO server URL (default: http://minio:9000)S3_BUCKET
: Default bucket name (default: medavault)S3_ACCESS_KEY_ID
: Access key for S3 APIS3_SECRET_ACCESS_KEY
: Secret key for S3 APIS3_REGION
: AWS region (default: us-east-1)Example using AWS CLI:
aws --endpoint-url http://localhost:9000 s3 ls s3://medavault
WebDAV is fully supported for both client access and as a storage backend.
Configuration Options:
WEBDAV_ENABLED
: Enable/disable WebDAV (default: true)WEBDAV_URL
: Base URL for WebDAV serverWEBDAV_USERNAME
: Authentication usernameWEBDAV_PASSWORD
: Authentication passwordMounting WebDAV on Linux:
sudo apt install davfs2
sudo mkdir /mnt/medavault
sudo mount -t davfs http://localhost:9081/webdav /mnt/medavault
MedaVault includes Apache Camel routes for advanced file processing and integration:
from("webdav://:?username=&password=&recursive=true")
.routeId("webdav-to-s3")
.log("Processing file: ${header.CamelFileName}")
.process(exchange -> {
// Add custom processing logic here
String fileName = exchange.getIn().getHeader("CamelFileName", String.class);
exchange.getIn().setHeader("CamelAwsS3Key", "processed/" + fileName);
})
.to("aws2-s3://?accessKey=&secretKey=ยฎion=")
.log("Successfully uploaded ${header.CamelFileName} to S3");
camel-routes
directoryapplication.yml
make restart backend
# View logs for all services
docker-compose logs -f
# View logs for specific service
docker-compose logs -f service_name
# Check service status
docker-compose ps
# Restart a specific service
docker-compose restart service_name
# Rebuild and restart a service
docker-compose up -d --build service_name
# Access container shell
docker-compose exec service_name sh
# Backup database
docker-compose exec medavault-db pg_dump -U postgres medavault > backup.sql
# Clean up old files
# Clean processed files older than 7 days
find storage/processed -type f -mtime +7 -delete
# Stop all services
docker-compose down
Edit the .env
file to configure:
To change WebDAV credentials:
.env
file:
WEBDAV_USER=newuser
WEBDAV_PASSWORD=newpassword
docker-compose up -d --build webdav-server
By default, files are stored in the storage
directory. To change this:
.env
:
STORAGE_PATH=/path/to/your/storage
Logs are stored in the logs
directory by default. You can configure log rotation and levels in the respective service configurations.
Edit config/application.properties
to configure processing rules:
# WebDAV connection
webdav.url=http://webdav-server
webdav.username=${WEBDAV_USER}
webdav.password=${WEBDAV_PASSWORD}
# Processing rules
camel.poll.delay=5000
camel.cleanup.processed=true
# MedaVault API
medavault.api.url=http://medavault-backend:8084/api
Change default credentials in the .env
file before deploying to production.
Always use HTTPS with a valid SSL certificate in production environments.
Restrict access to ports:
Keep all components updated:
docker-compose pull
docker-compose up -d
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)# Install Node.js dependencies
cd medavault-backend
npm install
# Install frontend dependencies
cd ../web-dashboard
npm install
# Backend with hot-reload
cd medavault-backend
npm run dev
# Frontend with hot-reload
cd ../web-dashboard
npm run serve
docker-compose ps | grep webdav
docker-compose logs webdav-server
./scripts/test-webdav.sh
docker-compose ps | grep db
docker-compose logs medavault-db
docker-compose exec medavault-db psql -U postgres -c "\l"
If you encounter permission errors:
# Set correct permissions on storage directories
sudo chown -R 1000:1000 storage/
sudo chmod -R 775 storage/
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and feature requests, please open an issue in the repository.
POST /api/auth/login
Content-Type: application/json
{
"username": "admin",
"password": "yourpassword"
}
POST /api/auth/refresh-token
Authorization: Bearer <refresh_token>
GET /api/media
Authorization: Bearer <token>
POST /api/media/upload
Authorization: Bearer <token>
Content-Type: multipart/form-data
# Form Data:
# file: <file>
# metadata: {"title":"My File","description":"Description"}
GET /api/media/{id}
Authorization: Bearer <token>
GET /api/users
Authorization: Bearer <token>
POST /api/users
Authorization: Bearer <token>
Content-Type: application/json
{
"username": "newuser",
"password": "securepassword",
"email": "user@example.com",
"role": "user"
}
GET /api/health
GET /api/system/info
Authorization: Bearer <token>
GET /metrics
logs/app.log
logs/access.log
logs/error.log
# Create backup
docker-compose exec medavault-db pg_dump -U postgres medavault > backup_$(date +%Y%m%d).sql
# Restore from backup
cat backup_file.sql | docker-compose exec -T medavault-db psql -U postgres medavault
# Backup storage directory
tar -czvf medavault_storage_backup_$(date +%Y%m%d).tar.gz storage/
# Restore
mkdir -p storage
tar -xzvf medavault_storage_backup.tar.gz
# Set production environment
echo "NODE_ENV=production" >> .env
# Update API URL
echo "API_URL=https://yourdomain.com/api" >> .env
# Set secure secrets
openssl rand -base64 32 | sed 's/[^a-zA-Z0-9]//g' | head -c 32
echo "JWT_SECRET=generated_secret_here" >> .env
docker-compose -f docker-compose.prod.yml up -d
server {
listen 80;
server_name yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name yourdomain.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:8085;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /api {
proxy_pass http://localhost:8084;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
# Backend tests
cd medavault-backend
npm test
# Frontend tests
cd ../web-dashboard
npm test
# Backend coverage
cd medavault-backend
npm run test:coverage
# Frontend coverage
cd ../web-dashboard
npm run test:coverage
We welcome contributions! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the Apache License - see the LICENSE file for details.
For issues and feature requests, please open an issue in the repository.
# Get all media
GET /api/media
# Get media by type
GET /api/media?type=image&limit=10
# Get specific media
GET /api/media/{id}
# Download media
GET /api/media/{id}/download
# Get thumbnail
GET /api/media/{id}/thumbnail
# System statistics
GET /api/stats
# Health check
GET /health
# List files
PROPFIND /webdav/
# Upload file
PUT /webdav/filename.jpg
# Download file
GET /webdav/filename.jpg
# Delete file
DELETE /webdav/filename.jpg
# Create directory
MKCOL /webdav/newfolder/
# Sprawdลบ logi Camel
docker-compose logs camel-integration
# Zweryfikuj poลฤ
czenie z WebDAV
curl -u webdav:medavault123 \
-X PROPFIND \
"http://localhost:8081/webdav/"
# Check WebDAV permissions
docker-compose exec webdav-server ls -la /var/www/webdav
# Check storage space
df -h storage/
# Restart database
docker-compose restart medavault-db
# Check database logs
docker-compose logs medavault-db
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
# Centralized logging with ELK stack
docker-compose logs | logstash -f logstash.conf
To connect to the WebDAV server, use the following URL: http://localhost:8081/webdav/
To upload a file, use the PUT
method with the file path as the request body. For example:
curl -u webdav:medavault123 \
-T test.txt \
"http://localhost:8081/webdav/test.txt"
To download a file, use the GET
method with the file path as the request URL. For example:
curl -u webdav:medavault123 \
"http://localhost:8081/webdav/test.txt"
To delete a file, use the DELETE
method with the file path as the request URL. For example:
curl -u webdav:medavault123 \
-X DELETE \
"http://localhost:8081/webdav/test.txt"
This project is licensed under the Apache 2.0 License.
๐ Enjoy your WebDAV + Camel + MedaVault system!
Built with โค๏ธ using: