# INS Landing Page Single landing page for Infinity Networks Security with a lead form. Leads are stored in a SQLite file; there is no admin UI, leads are exported manually. - `public/index.html`: the page (content from infinitynetworks.com.my) - `server.js`: serves the page and `POST /api/leads`, Node 22 built-ins only, no npm dependencies ## Run locally Requires Node 22.13 or newer. ```bash npm start # http://localhost:3000, database at ./data/leads.db npm test ``` Environment: `PORT` (default `3000`), `DB_PATH` (default `./data/leads.db`). ## Docker ```bash docker build -t ins-landing-page . docker run -p 3000:3000 -v ins-leads:/data ins-landing-page ``` ## Kubernetes (microk8s) `k8s/` deploys everything into namespace `ins-landing-page`, the same way as dynamic-qr: - `40-app.yaml`: Longhorn PVC (1 Gi, ReadWriteOnce) mounted at `/data`, Service, and Deployment. The Deployment runs **1 replica** with `strategy: Recreate`, because SQLite has a single writer. It runs as uid 1000 with a read-only root filesystem. - `50-gateway.yaml`: - A Let's Encrypt Certificate and a Traefik Gateway for `ins-landing.containerverse.dev`. - HTTP redirects to HTTPS. - `POST /api/leads` goes through the `lead-rate-limit` middleware: 5 per minute per visitor, burst 5, keyed on the Cloudflare visitor IP. - `60-network-policy.yaml`: denies all ingress except Traefik to port 3000, and Traefik to cert-manager's HTTP-01 solver. Prerequisite: DNS for `ins-landing.containerverse.dev` points at the cluster through Cloudflare, like the other `containerverse.dev` hosts. First install, on the microk8s host (`k` = `microk8s kubectl`): k apply -f k8s/00-namespace.yaml k -n ins-landing-page create secret docker-registry regcred \ --docker-server=gitea.containerverse.dev --docker-username= --docker-password= k apply -f k8s/ k -n ins-landing-page rollout status deployment/ins-landing-page Updates: every push to `main` runs the tests and builds `gitea.containerverse.dev/solvway/ins-landing-page:ins-landing-page-prd-latest`. CI then runs `./krrd.sh ins-landing-page ins-landing-page` on the deploy host. Manifest changes are applied by hand (`k apply -f k8s/`). CI needs the same repository secrets as dynamic-qr: `PACKAGE_USER`, `PACKAGE_RW_KEY`, `DRONECICD_SSH_*`, `TELEGRAM_*` and, optionally, `MICROSOFT_TEAMS_WEBHOOK_URL`. They come from the `solvway` org once the repo is transferred there. ## Exporting leads To CSV, from the running pod: ```bash microk8s kubectl -n ins-landing-page exec deploy/ins-landing-page -- node --disable-warning=ExperimentalWarning -e " const {DatabaseSync}=require('node:sqlite'); const rows=new DatabaseSync(process.env.DB_PATH,{readOnly:true}).prepare('SELECT * FROM leads ORDER BY id').all(); const q=v=>v==null?'':'\"'+String(v).replace(/^[=+\-@]/,\"'\$&\").replace(/\"/g,'\"\"')+'\"'; if(rows.length)console.log(Object.keys(rows[0]).join(',')); for(const r of rows)console.log(Object.values(r).map(q).join(',')); " > leads.csv ``` Prefer the CSV export above. The database runs in WAL mode, so copying only `leads.db` can miss the newest leads; if you copy the file, copy `leads.db-wal` with it. Columns: `id, created_at (UTC), name, email, phone, company, service, referrer, utm_source, utm_medium, utm_campaign`. Leads contain personal data (PDPA). Keep exported files out of shared drives and delete them when done.