mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
refactor: rename database → storage
More semantically accurate: contains SQLite files, schema, fixtures, test data. Updated all references in code, scripts, docs.
This commit is contained in:
@@ -14,7 +14,7 @@ php -S 127.0.0.1:8000
|
||||
|
||||
**Problems:**
|
||||
- Serves from project root (all files accessible via web)
|
||||
- Exposes sensitive files: `database/`, `tests/`, `vendor/`, config files
|
||||
- Exposes sensitive files: `storage/`, `tests/`, `vendor/`, config files
|
||||
- Doesn't match production DocumentRoot configuration
|
||||
- Security risk: `.env`, database files, source code all accessible
|
||||
|
||||
@@ -216,7 +216,7 @@ deploy-code:
|
||||
```just
|
||||
test-deploy:
|
||||
ssh posterg "mkdir -p /var/www/html/database"
|
||||
rsync -vur --progress ./database/test.db posterg:/var/www/html/database/test.db
|
||||
rsync -vur --progress ./storage/test.db posterg:/var/www/html/storage/test.db
|
||||
```
|
||||
|
||||
**New:**
|
||||
@@ -229,9 +229,9 @@ deploy-database:
|
||||
echo; \
|
||||
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
|
||||
ssh posterg "mkdir -p /var/www/posterg/database" && \
|
||||
rsync -vur --progress ./database/test.db posterg:/var/www/posterg/database/ && \
|
||||
ssh posterg "chown www-data:posterg /var/www/posterg/database/test.db && \
|
||||
chmod 660 /var/www/posterg/database/test.db" && \
|
||||
rsync -vur --progress ./storage/test.db posterg:/var/www/posterg/storage/ && \
|
||||
ssh posterg "chown www-data:posterg /var/www/posterg/storage/test.db && \
|
||||
chmod 660 /var/www/posterg/storage/test.db" && \
|
||||
echo "✅ Database deployed"; \
|
||||
else \
|
||||
echo "❌ Cancelled"; \
|
||||
@@ -241,7 +241,7 @@ deploy-database:
|
||||
[group('deploy')]
|
||||
backup-remote-db:
|
||||
@echo "💾 Backing up remote database..."
|
||||
@ssh posterg "sqlite3 /var/www/posterg/database/test.db .dump" > database/remote_backup_$(date +%Y%m%d_%H%M%S).sql
|
||||
@ssh posterg "sqlite3 /var/www/posterg/storage/test.db .dump" > database/remote_backup_$(date +%Y%m%d_%H%M%S).sql
|
||||
@echo "✅ Remote database backed up locally"
|
||||
```
|
||||
|
||||
@@ -338,7 +338,7 @@ server {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~ /database/ {
|
||||
location ~ /storage/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ mv lib src/lib
|
||||
just serve
|
||||
# Opens http://localhost:8000
|
||||
# Verify that sensitive files return 404:
|
||||
# http://localhost:8000/database/test.db → 404
|
||||
# http://localhost:8000/storage/test.db → 404
|
||||
# http://localhost:8000/config/ → 404
|
||||
# http://localhost:8000/src/ → 404
|
||||
```
|
||||
@@ -461,7 +461,7 @@ just server-status
|
||||
- [ ] File uploads work (if applicable)
|
||||
- [ ] Logs written to `/var/www/posterg/var/logs/`
|
||||
- [ ] Sensitive URLs return 404:
|
||||
- https://posterg.erg.be/database/test.db
|
||||
- https://posterg.erg.be/storage/test.db
|
||||
- https://posterg.erg.be/config/
|
||||
- https://posterg.erg.be/src/
|
||||
- https://posterg.erg.be/vendor/
|
||||
@@ -477,7 +477,7 @@ just server-status
|
||||
| Assets | `/assets/` | `/public/assets/` |
|
||||
| Config | `/inc/` | `/config/` or `/src/` |
|
||||
| Libraries | `/lib/` | `/src/lib/` |
|
||||
| Database | `/database/` | `/database/` (stays) |
|
||||
| Database | `/storage/` | `/storage/` (stays) |
|
||||
| Vendor | `/vendor/` | `/vendor/` (stays) |
|
||||
| Tests | `/tests/` | `/tests/` (stays) |
|
||||
|
||||
@@ -554,7 +554,7 @@ require_once APP_ROOT . '/config/app.php';
|
||||
|
||||
### Issue: Database connection fails
|
||||
**Cause:** Path to database file wrong
|
||||
**Fix:** Update path from `database/test.db` to `../database/test.db` (from public/)
|
||||
**Fix:** Update path from `storage/test.db` to `../storage/test.db` (from public/)
|
||||
|
||||
### Issue: Can't write to cache/logs
|
||||
**Cause:** Wrong permissions on var/ directory
|
||||
|
||||
Reference in New Issue
Block a user