Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cacd92b
imrpove RT classification for SCAL dataset
imranfadhil Nov 24, 2026
1386608
improve multi well stick plot
imranfadhil Nov 24, 2026
3f88b14
improve rmf handling in header and the wiring with litho step
imranfadhil Nov 24, 2026
1488a5c
debug stickplot and SCAL dataset rock type classification
imranfadhil Nov 24, 2026
2a9d11f
improve inspection hover box in stickplot
imranfadhil Nov 24, 2026
13d8140
debug Pc fitted params not persisted after compute SHF
imranfadhil Nov 24, 2026
853603f
improve zoning in stickplot
imranfadhil Nov 24, 2026
e94009c
debug hardcoded scaling/treatment of Pc > 200 psi as micp in the scal…
imranfadhil Nov 24, 2026
0a35d87
debug multi well FPT module in zone filter and restoring saved parame…
imranfadhil Nov 25, 2026
31c40c4
improve multi well volumetric step with cutoff analysis and debug con…
imranfadhil Nov 25, 2026
9ee94ef
add cutoff sensitivity to the single well ressum step
imranfadhil Nov 25, 2026
a8c10af
debug tvdss inflated in FPT module
imranfadhil Nov 25, 2026
8a9d975
phase 1 enhancement to FDP report generator
imranfadhil Nov 25, 2026
eedf0f8
Phase 2 enhancement on FDP report generator
imranfadhil Nov 25, 2026
0e947a8
Phase 3 enhancement of FDP report generator
imranfadhil Nov 25, 2026
0248480
Phase 4 enhancement to FDP report generator
imranfadhil Nov 25, 2026
524a223
improve FDP report generator
imranfadhil Nov 26, 2026
8a928e2
debug FDP report generator failing
imranfadhil Nov 26, 2026
7e4f8f7
sync key important functionalities in frontend with the quick_pp base
imranfadhil Nov 26, 2026
c1890f3
fix buggy PDF exported from the FDP report generator module
imranfadhil Nov 26, 2026
559da57
improve the log QC in single well workflow
imranfadhil Nov 26, 2026
08357c4
add borehole env correction QC plot in the right pane for single well…
imranfadhil Nov 26, 2026
79fd0ba
add invasion profile and P&T profile in qaqc step
imranfadhil Nov 26, 2026
9afbfec
improve deployment with cloudflare setup
imranfadhil Nov 26, 2026
7f4e84e
add hole section in ancillary and swap step 1 and 2 in single well wo…
imranfadhil Nov 26, 2026
746f425
debug importing handover package doesn't persist
imranfadhil Nov 26, 2026
8ed945d
improve demo with limits, controls and more secure
imranfadhil Nov 27, 2026
64ac98d
incorporate the new log qc changes into the well and fdp reports
imranfadhil Nov 27, 2026
eb9cfda
update and improve SSOT
imranfadhil Nov 27, 2026
a3f7810
bump version to 0.3.8
imranfadhil Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ FRONTEND_MAX_OLD_SPACE=4096
# Public base URL of the app (optional; e.g. https://qpp.example.com)
PUBLIC_URL=

# Cloudflare Named Tunnel token (optional; from Cloudflare Zero Trust -> Networks -> Tunnels).
# Leave blank to use a free temporary *.trycloudflare.com Quick Tunnel instead.
CF_TUNNEL_TOKEN=

# ---- User Access Management (UAM) & Authentication ----
QPP_AUTH_SECRET_KEY=change_this_uam_secret_key
QPP_ADMIN_USERNAME=admin
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@ chainlit*

docs/tutorials/*.ipynb
quick_pp/app/backend/static/reports/*

# Cloudflare CLI local cache
.cloudflare/
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ authors:
email: "imranfadhil@gmail.com"
repository-code: "https://github.com/imranfadhil/quick_pp"
url: "https://quick-pp.readthedocs.io"
version: 0.3.7
date-released: "2026-11-22"
version: 0.3.8
date-released: "2026-11-27"
license: MIT
keywords:
- petrophysics
Expand Down Expand Up @@ -44,4 +44,4 @@ preferred-citation:
orcid: "https://orcid.org/0000-0001-9392-8083"
year: 2026
url: "https://github.com/imranfadhil/quick_pp"
version: 0.3.7
version: 0.3.8
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)


Comprehensive Python library and full-stack web platform for deterministic and probabilistic petrophysical evaluation, Special Core Analysis (SCAL) & relative permeability modeling, multi-well Free Water Level (FWL) contact optimization, stratigraphic log normalization, core-log calibration & depth matching, automated FDP report generation, petrophysical handover packaging, rock physics, and static-to-dynamic geomodeling upscaling.
Comprehensive Python library and full-stack web platform for deterministic and probabilistic petrophysical evaluation, unified borehole environmental & radial invasion QC, Special Core Analysis (SCAL) & relative permeability modeling, multi-well Free Water Level (FWL) & Formation Pressure Testing (FPT) contact analysis, stratigraphic log normalization, source-rock TOC geochemistry, core-log calibration & depth matching, automated CPI/FDP report generation with subsurface gate checks, bi-directional petrophysical handover packaging, rock physics, and static-to-dynamic geomodeling upscaling.

This repository contains the core `quick_pp` scientific Python package, the FastAPI backend (`quick_pp/app/backend`), and the SvelteKit interactive workstation frontend (`quick_pp/app/frontend`), plus MLflow-integrated machine learning pipelines (`quick_pp/machine_learning`).

## Core Capabilities

- **Multi-Mineral, Clastic & Thomas-Stieber Petrophysics** (`quick_pp.lithology`, `quick_pp.porosity`, `quick_pp.saturation`, `quick_pp.permeability`):
Sand-Silt-Clay (modified Kuttan), Carbonate, multi-mineral inversion solver, and **Thomas-Stieber** laminated sand-shale evaluation (`VSH_LAM`, `VSH_DISP`, `VSH_STR`, `PHIT_TS`, `PHIE_TS`, `PHISAND_TS`) with Simandoux, Indonesian, Dual-Water, Waxman-Smits, Juhasz, and Archie saturation models.
- **Multi-Well Contact, Swirr & Formation Pressure Testing (FPT)** (`quick_pp.saturation`, `quick_pp.fluid_type`, `MultiWellFpt.svelte`, `MultiWellSwirr.svelte`):
Simultaneous multi-well Free Water Level (FWL), Oil-Water Contact (OWC), and Top of Transition Zone (TTZ) solver reconciling resistivity-derived $S_w$, capillary pressure Saturation-Height Models ($S_{w,\text{SHM}}$ via Leverett-$J$, Skelt-Harrison, and Cuddy), multi-well irreducible water saturation (`Swirr` via RQI, Semi-log $k$, and Timur models), and wireline formation tester (MDT/RFT) pressure gradient regression (`FormationPressureAnalyzer` with OLS/Huber/RANSAC, automatic mobility/supercharge flagging, in-situ fluid density, excess pressure, and Monte Carlo P10/P50/P90 GOC/OWC/GWC contact intersections).
- **Rock Typing & Supervised Rock Flag Classification** (`quick_pp.rock_type`, `MultiWellRockTyping.svelte`, `InspectorRockTyping.svelte`):
Hydraulic Flow Unit (`FZI`, `RQI`, `GHE`), Winland $R_{35}$, and Pittman pore-throat rock typing, vuggy/fracture carbonate secondary porosity (`VDL`), and standalone multi-well `RandomForestClassifier` rock-type training, cross-validation, and uncored well inference (`train_and_validate_rock_type_classifier`, `predict_with_saved_rt_classifier`) using raw logs and calculated petrophysical curves (`PHIT`, `VSAND`, `VSHALE`, `VSILT`, `VCLAY`, `VDL`).
- **Special Core Analysis (SCAL), Core Calibration & Depth Matching** (`quick_pp.scal`, `quick_pp.core_analysis`, `CoreDepthShiftPanel.svelte`, `CrossplotCanvas.svelte`):
Laboratory-to-reservoir core plug corrections (hydrostatic/uniaxial overburden compaction, Klinkenberg gas slippage, and Dean-Stark clay-bound water reconciliation preserving raw `CPORE_AMB` and `CPERM_AIR` lineage), interactive core-to-log depth matching with piecewise linear shift tables (`anchors` -> `DEPTH_SHIFTED`) and cross-correlation Automatic Suggested Shift, 1:1 Estimation vs. Core Parity Crossplot (`PHIT` vs `CPORE`, `PERM` vs `CPERM` with RMSE, MAE, $R^2$, Bias, and $\pm 0.5\text{–}1.0$ decade bounds), capillary pressure scaling, two-phase relative permeability models (**Corey**, **Brooks-Corey**, and **LET**), automated SCAL curve fitting (`fit_relperm`), and Eclipse/Intersect `SWOF` table generation (`generate_swof_table`).
- **Probabilistic Uncertainty & Monte Carlo Engine** (`quick_pp.uncertainty`):
Vectorized Latin Hypercube Sampling (`scipy.stats.qmc.LatinHypercube`) for volumetric hydrocarbon in-place uncertainty (`mc_volumetric_uncertainty`), log-level CPI uncertainty propagation (`run_log_uncertainty` producing `P10`/`P50`/`P90` curves), and stochastic reservoir summaries (`calc_stochastic_reservoir_summary`).
- **Log Blocking & Static-to-Dynamic Upscaling** (`quick_pp.upscaling`):
Petrophysically rigorous blocking (`upscale_logs`, `block_logs`) onto cellular geomodel grids with thickness-weighted arithmetic porosity/shale averaging, pore-volume weighted saturation averaging (preserving `BVHC`), directional & Cardwell-Parsons (1945) power-law permeability bounds ($k_h, k_{\text{eff}}, k_v, k_v/k_h$), and majority-vote facies upscaling.
- **Multi-Well QA/QC, Stratigraphic Normalization & Stick Plots** (`quick_pp.qaqc`, `MultiWellQaqc.svelte`, `StickPlotCanvas.svelte`):
Zone-by-zone multi-well quantile and histogram log normalization (`stratigraphic_normalization` / `normalize_by_zone`), borehole environmental and invasion corrections (`apply_environmental_corrections`), neutron-density hydrocarbon corrections, automated washout/bad-hole flagging (`badhole_flagging`), multi-well distribution & conditioning workflows, and interactive multi-well structural/stratigraphic Stick Plot cross-sections flattened on datum or formation tops.
- **Logging Environment, Borehole Corrections, Sensor Confidence & Radial Invasion** (`quick_pp.environment`, `quick_pp.borehole_corrections`, `quick_pp.qaqc`, `quick_pp.conditioning`, `InspectorQaqc.svelte`):
Depth-zoned **Hole Sections** (`BS`, mud system, mud weight, salinity, $R_{mf}$), onshore/offshore BHT-calibrated P&T profiles, generic `WL`/`LWD` borehole environmental corrections (`*_ENV_CORR` with spine-and-ribs `DRHO` double-compensation protection), perturbation-propagated per-sample uncertainty (`*_SIGMA`) and sensor confidence (`*_QC_CONF`), 2/3-curve step-profile radial invasion inversion ($R_t, R_{xo}, d_i$ & $R_{xo}/R_t$ vs. $R_{mf}/R_w$ movable-HC classification), 1D bounded Huber nuclear-log resolution harmonization (`GR_ENH`, `NPHI_ENH`, `RHOB_ENH`), missing-data imputation, and zone-by-zone stratigraphic quantile normalization.
- **Multi-Mineral, Clastic, Thin-Bed & Continuous $\rho_{fl}$ Petrophysics** (`quick_pp.lithology`, `quick_pp.porosity`, `quick_pp.saturation`, `quick_pp.permeability`):
Sand-Silt-Clay (modified Kuttan), Carbonate, selectable-log SLSQP multi-mineral solver, and **Thomas-Stieber** laminated/dispersed/structural thin-bed evaluation (`VSH_LAM`, `VSH_DIS`, `VSH_STR`, `PHIT_SAND`, `RSAND_TS`), 3-tier coupled apparent fluid-density ($\rho_{fl}$) solver, adaptive-shoulder coal detection with reversible interval manual overrides, empirical single-well permeability (`Choo`, `Kozeny-Carman`, `Timur`, `Tixier`, `Coates`), Simandoux / Indonesian / Dual-Water / Waxman-Smits / Juhasz / Archie saturation, water-leg $m$ calibration & continuous $m(\phi)$ (`Borai`, `Shell/Lucia`), and multi-criteria reservoir fluid typing (`GAS`, `OIL`, `UNCONFIRMED`, `WATER`).
- **Source Rock & Total Organic Carbon (TOC) Geochemistry** (`quick_pp.source_rock`, `InspectorToc.svelte`):
Passey et al. (1990) $\Delta\log R$ baseline separation across sonic, density, and neutron logs, automated lean-shale baseline detection, Hood et al. (1975) Level of Organic Metamorphism (`LOM`) maturity conversion from $R_o\,\%$, and core pyrolysis TOC calibration.
- **Rock Typing, Power-Law `PERM_TRANS` & Supervised Classification** (`quick_pp.rock_type`, `MultiWellRockTyping.svelte`, `MultiWellPermTransform.svelte`):
Dual Core (`CPORE`, `CPERM`) and Log (`PHIT`, `PERM`) Discrete Rock Typing (`ROCK_FLAG`) via Amaefule `FZI`/`RQI`, Winland $r_{35}$, and Lucia carbonate `RFN` with GMM, Modified Lorenz, or K-Means cutoff discovery and `ROCK_FLAG = 0` non-reservoir isolation; rock-type partitioned power-law permeability transforms ($k = a_k \cdot \phi^{b_k} \to \text{PERM\_TRANS}$); and standalone supervised `RandomForest` / Gradient Boosting rock-type classification across uncored wells.
- **Multi-Well Contact, SHF, Stick Plot & Formation Pressure Testing (FPT)** (`quick_pp.saturation`, `quick_pp.fluid_type`, `MultiWellShf.svelte`, `MultiWellFpt.svelte`, `StickPlotCanvas.svelte`):
Multi-well Leverett-$J$, Skelt-Harrison, and Cuddy Saturation-Height Models ($S_{w,\text{SHF}}$), global and per-zone Free Water Level (FWL) optimization, interactive `TVDSS` Stick Plot structural/stratigraphic cross-sections (`GR`/`COAL` tracks & fluid limits `GUT`/`GDT`/`GOC`/`GWC`, `OUT`/`ODT`/`OWC`, `WUT`/`FWL`), and zone-filtered MDT/RFT pressure gradient regression on true `TVDSS` (`FormationPressureAnalyzer` with OLS/Huber/RANSAC, automatic mobility/supercharge flagging, in-situ fluid density, excess pressure, and covariance $\pm 1\sigma$ contacts).
- **Special Core Analysis (SCAL), Core Calibration & Multi-Log Grain Density** (`quick_pp.scal`, `quick_pp.core_analysis`, `InspectorScal.svelte`, `MultiWellSwirr.svelte`):
Laboratory-to-reservoir core plug corrections (hydrostatic/uniaxial/log-integrated overburden compaction, Klinkenberg gas slippage, and Dean-Stark clay-bound water reconciliation preserving `CPORE_AMB` and `CPERM_AIR` lineage), interactive core-to-log depth matching, multi-log Huber/ridge core grain-density ($\rho_{ma} \to \text{RHOM}$) calibration, explicit fluid-system lab-to-reservoir $P_c$ scaling, PRT Pore-Throat Size Distributions (`plot_ptsd_by_prt`), field-wide `Swirr` fitting, **Corey** / **Brooks-Corey** / **LET** relative permeability, and Eclipse/Intersect `SWOF` table generation (`generate_swof_table`).
- **Probabilistic Volumetrics, Cutoff Sensitivity & Log Blocking** (`quick_pp.ressum`, `quick_pp.uncertainty`, `quick_pp.upscaling`, `MultiWellVolumetrics.svelte`):
PRMS 95% HCPV empirical cutoff sensitivity sweeps (`cutoffs_analysis`), Iman-Conover correlated Latin Hypercube Sampling (`scipy.stats.qmc.LatinHypercube`) for STOIIP/GIIP (`AREA` & `GRV` modes, Log-Average vs. 1D Hypsometric SHF integration, Tornado ranking), log-level CPI uncertainty propagation (`P10`/`P50`/`P90` curves utilizing `*_SIGMA`), and Cardwell-Parsons (1945) power-law ($\omega \in [-1, 1]$) cellular log blocking (`upscale_logs`, `block_logs`).
- **High-Throughput Multi-Format Log & Ancillary Import Engine** (`quick_pp.las_handler`, `BulkImporterModal.svelte`, `BulkAncillaryImporter.svelte`):
Fast two-stage hybrid LAS 2.0/3.0, DLIS and LIS79 (`dlisio`), CSV, and Parquet log importer with automated mnemonic alias mapping, unit standardization, multi-run splicing & depth regularization (preserving raw missing gaps without artificial interpolation by default), and bulk ancillary data ingestion (Formation Tops, Fluid Contacts, Deviation Surveys with minimum-curvature TVD calculation, MDT/RFT Pressure Tests, Core RCA plugs, and SCAL Capillary Pressure & Relative Permeability tables).
Fast two-stage hybrid LAS 2.0/3.0, DLIS and LIS79 (`dlisio`), CSV, and Parquet log importer with automated mnemonic alias mapping, unit standardization, `RAW_*` source preservation, interval-bounded multi-run splicing & depth regularization, and bulk ancillary ingestion (Hole Sections, Formation Tops, Fluid Contacts, Minimum-Curvature Surveys, MDT/RFT Pressure & Mobility Tests, Core RCA plugs, and SCAL $P_c$ & RelPerm tables).
- **Automated FDP & Single-Well Report Generation** (`quick_pp/app/backend/services/report.py`, `quick_pp.plotter.report_plots`, `InspectorReport.svelte`, `ReportPreviewCanvas.svelte`):
10-section Field Development Plan (`FDP_FULL`) and Single-Well CPI (`SINGLE_WELL_CPI`) report generator with publication-grade headless Matplotlib figures, grounded AI narrative synthesis and section enhancement (`executive`, `technical`, `concise`, `audit`), interactive Markdown section editing, and print-ready HTML / multi-page A4 PDF export.
- **Petrophysical Handover Package Builder** (`quick_pp.handover`, `build_handover_archive_bytes`):
Zero-friction `.zip` handover archive generator exporting continuous LAS 2.0 logs with populated `~Well` headers (`EKB`, `EDF`, `EGL`, `WDEP`, coordinates) and `~Parameter` CPI settings, Formation Tops, Fluid Contacts & Perforation Intervals (with interpolated `TVD` and `TVDSS`), Well Headers & Datum summary, Deviation Surveys, Core RCA point-sets (`.csv` and `*_RCA.las` with `RAW_DEPTH`, `SHIFT_M`, `CPORE_AMB`, `CPERM_AIR` lineage), MDT/RFT Pressure Tests (`.csv` and `*_MDT.las`), SCAL Pc & RelPerm tables, Eclipse `SWOF` `.inc` decks, PRMS/SEC Zonal Reservoir Summary & Multi-Tab Master Excel Workbook (`.xlsx`), plus automated `import_to_techlog.py` (SLB Techlog) and `import_to_geolog.tcl` (Emerson Geolog) loader scripts.
10-section Field Development Plan (`FDP_FULL`), Single-Well CPI (`SINGLE_WELL_CPI`), `QAQC_SUMMARY`, and `RESSUM_ONLY` report generator with Borehole Env/Invasion QC & `*_SIGMA`/`*_QC_CONF` audits, automated subsurface QA/QC gate checks (`CHK-01`+) & anomaly remediation logs, publication-grade headless Matplotlib figures, SSOT-grounded AI narrative synthesis (`executive`, `technical`, `concise`, `audit`), and print-ready HTML / multi-page A4 PDF export.
- **Bi-Directional Petrophysical Handover Package Builder & Importer** (`quick_pp.handover`, `HandoverImporter.svelte`):
Zero-friction `.zip` / `.qpp` handover archive export & persistent project re-hydration preserving LAS 2.0 logs (`~Well` headers + `~Parameter` CPI settings), Hole Sections, Formation Tops, Fluid Contacts & Perforation Intervals (`TVD` & `TVDSS`), Deviation Surveys, Core RCA & MDT LAS point-sets, SCAL tables, Eclipse `SWOF` `.inc` decks, PRMS/SEC Zonal Reservoir Summaries, Multi-Tab Master Excel Workbooks (`.xlsx`), and automated SLB Techlog (`import_to_techlog.py`) & Emerson Geolog (`import_to_geolog.tcl`) loader scripts.
- **Rock Physics & Gassmann Fluid Substitution** (`quick_pp.rock_physics`):
Elastic moduli, shear-wave velocity ($V_s$) prediction, Gassmann fluid substitution, and seismic rock physics templates.

Expand Down Expand Up @@ -331,6 +331,6 @@ If you use `quick_pp` in your academic research, coursework, publications, or te
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/imranfadhil/quick_pp}},
version = {0.3.7}
version = {0.3.8}
}
```
2 changes: 1 addition & 1 deletion deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Batch scripts that provision and manage the `quick_pp` UI & Backend stack on a D

The Docker Compose stack ([`quick_pp/app/docker/docker-compose.yaml`](../quick_pp/app/docker/docker-compose.yaml)) runs:
- **`web` (Nginx)**: Unified reverse proxy on port `8080` (and internal `:80`). Routes `/quick_pp/*` to `qpp-backend:6312` and `/` to `qpp-frontend:5469` with a `100 MB` upload limit for LAS files.
- **`quicktunnel` (Cloudflare)**: Runs `cloudflared tunnel --url http://web:80` and prints a free `https://<words>.trycloudflare.com` URL at the end of `sync.bat`.
- **`quicktunnel` (Cloudflare Tunnel)**: Runs `cloudflared` outbound to Cloudflare's edge. Supports a permanent **Named Tunnel** (`https://<DOMAIN>` + Cloudflare Zero Trust Access when `CF_TUNNEL_TOKEN` is set in `config.bat`), or falls back to a free `https://<words>.trycloudflare.com` Quick Tunnel when `CF_TUNNEL_TOKEN` is blank.
- **`qpp-frontend` (SvelteKit / Node 20)**: Builds and serves the SvelteKit UI on `:5469` using relative API paths (`VITE_BACKEND_URL=""`).
- **`qpp-backend` (FastAPI / Gunicorn)**: Serves the petrophysical API on `:6312` with in-memory caching for merged well logs.
- **`postgres` (pgvector/pg17)**: PostgreSQL 17 database.
Expand Down
9 changes: 7 additions & 2 deletions deploy/config.example.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@ set KEY_NAME=%PROJECT_NAME%-do-key
set KEY_FILE=%USERPROFILE%\.ssh\%KEY_NAME%
set PUB_FILE=%USERPROFILE%\.ssh\%KEY_NAME%.pub

REM ---- App config ----
REM Your public domain (e.g. qpp.example.com). Leave blank if using Quick Tunnel / IP.
REM ---- App & Cloudflare Tunnel config ----
REM Your custom domain in Cloudflare (e.g. app.example.com). Leave blank for Quick Tunnel.
set DOMAIN=
REM Cloudflare Zero Trust Named Tunnel token (Networks -> Tunnels -> <tunnel> -> Token).
REM Leave blank to fall back to a random *.trycloudflare.com Quick Tunnel.
set CF_TUNNEL_TOKEN=
REM Optional email allowed by Cloudflare Zero Trust Access (used by setup-cloudflare.bat)
set ALLOWED_EMAIL=

REM Host port where Nginx unified reverse proxy listens on the droplet
set WEB_PORT=8080
Expand Down
22 changes: 16 additions & 6 deletions deploy/configure-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# $5 WEB_PORT
# $6 TAVILY_API_KEY
# $7 DOMAIN
# $8 CF_TUNNEL_TOKEN
set -e

REMOTE_DIR="$1"; shift
Expand All @@ -23,16 +24,17 @@ PG_PASS="$3"
WEB_PORT="${4:-8080}"
TAVILY_KEY="$5"
DOMAIN="$6"
CF_TOKEN="$7"

# Helper to set or append a key=value in .env
# Helper to set or append a key=value in .env safely (handles '/', '+', '=' in tokens)
set_kv() {
key="$1"
val="$2"
if grep -q "^${key}=" .env; then
sed -i "s#^${key}=.*#${key}=${val}#" .env
else
echo "${key}=${val}" >> .env
if [ -f .env ]; then
grep -v "^${key}=" .env > .env.tmp || true
mv .env.tmp .env
fi
printf '%s=%s\n' "$key" "$val" >> .env
}

set_kv POSTGRES_USER "$PG_USER"
Expand Down Expand Up @@ -70,5 +72,13 @@ if [ -n "$DOMAIN" ]; then
set_kv PUBLIC_URL "https://$DOMAIN"
fi

if [ -n "$CF_TOKEN" ] && [ "$CF_TOKEN" != "xxx" ]; then
set_kv CF_TUNNEL_TOKEN "$CF_TOKEN"
set_kv CF_TUNNEL_ARG "run"
else
set_kv CF_TUNNEL_TOKEN ""
set_kv CF_TUNNEL_ARG "--url=http://web:80"
fi

echo '--- applied ---'
grep -E '^(POSTGRES_USER|POSTGRES_DB|WEB_PORT|FRONTEND_MODE|VITE_BACKEND_URL|PUBLIC_URL)=' .env || true
grep -E '^(POSTGRES_USER|POSTGRES_DB|WEB_PORT|FRONTEND_MODE|VITE_BACKEND_URL|PUBLIC_URL|CF_TUNNEL_ARG)=' .env || true
3 changes: 2 additions & 1 deletion deploy/demo/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ quick_pp/app/frontend/.svelte-kit/
quick_pp/app/frontend/.output/
quick_pp/app/frontend/build/

# Data, outputs, ML runs (very large)
# Data, outputs, ML runs, local dev reports (very large / local-only)
data/
mlruns/
uploads/
output/
outputs/
quick_pp/app/backend/static/reports/**
notebooks/**
!notebooks/data/01_raw/36_7-3.las
!notebooks/data/01_raw/formation_pressure_data.csv
Expand Down
Loading
Loading