Project portofolio Sertifikasi Database Programmer (Flask + SQLite).
Pemetaan lengkap unit kompetensi → bukti ada di PORTOFOLIO.md; slide presentasi di presentasi.md (Marp).
/admin/monitor), health-check (/health)siperpus/
├── config.py # konfigurasi per environment (dev/staging/prod/testing)
├── run.py # entry point WSGI
├── requirements.txt # library + versi terkunci
├── app/
│ ├── __init__.py # application factory, logging, error handler
│ ├── db.py # koneksi, query, transaksi, perintah CLI
│ ├── migrate.py # migrasi berversi + backup
│ ├── migrations/ # 001_skema_awal.sql, 002_reservasi_dan_audit.sql
│ ├── repository.py # seluruh SQL aplikasi
│ ├── algorithms.py # struktur data & algoritma
│ ├── security.py # auth, role, CSRF, headers, rate limit, audit
│ ├── monitoring.py # metrik request/query/memori/disk
│ ├── seed.py # data contoh (non-production)
│ ├── views/ # blueprint: auth, katalog, sirkulasi, admin
│ ├── templates/ static/
├── tests/ # 33 test (pytest)
└── docs/ # ERD, log debugging, code review, analisis dampak
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
flask --app run init-db # migrasi + data contoh
flask --app run run --debug # http://127.0.0.1:5000
Akun contoh: admin / Admin#2026 dan petugas / Petugas#2026 (khusus dev/staging).
pytest -q --cov=app # 33 passed
flake8 # lint
pip-audit -r requirements.txt
| | Development | Staging | Production |
|—|—|—|—|
| APP_ENV | development | staging | production |
| Database | instance/perpus_dev.db | instance/perpus_staging.db | DATABASE_PATH |
| DEBUG | ✅ | ❌ | ❌ |
| Log level | DEBUG | INFO | WARNING |
| Cookie Secure + HSTS | ❌ | ❌ | ✅ |
| SECRET_KEY | default boleh | wajib di .env | wajib (aplikasi menolak start) |
| Server | flask run | gunicorn -w 2 | gunicorn -w 4 di balik Nginx (HTTPS) |
CHANGELOG.md & docs/ANALISIS_DAMPAK.md; uji di staging terlebih dahulu.git fetch --tags && git checkout v1.1.0pip install -r requirements.txt (versi terkunci)APP_ENV=production flask --app run migrate → backup otomatis *.backup-<timestamp>.db lalu migrasi.sudo systemctl restart siperpuscurl -f https://<host>/health dan cek /admin/monitor (versi skema).git checkout v1.0.0 → start.┌─────────┬──────────┬──────────────┬─────────────────────────────────────────────────────────┐ │ Role │ Username │ Password │ Akses │ ├─────────┼──────────┼──────────────┼─────────────────────────────────────────────────────────┤ │ Admin │ admin │ Admin#2026 │ Semua menu, termasuk Monitor dan Audit │ ├─────────┼──────────┼──────────────┼─────────────────────────────────────────────────────────┤ │ Petugas │ petugas │ Petugas#2026 │ Buku, Anggota, Sirkulasi, Laporan (Monitor ditolak 403) │ └─────────┴──────────┴──────────────┴─────────────────────────────────────────────────────────┘\
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt
APP_ENV=development flask –app run init-db
APP_ENV=development flask –app run run –debug