# logship-template-2 (VM 113) — clean LogShip golden VM

Built 2026-07-26 from a PBS backup of VM 105 (logship-production,
snapshot 2026-07-25T16:00Z). Production was never touched.

## What this VM is
Full LogShip stack, data-free: iDempiere (:8443, REST via nginx /api/v1),
PostgreSQL 17 (idempiere 178 MB / strapi), Nuxt frontend (:3001), Strapi
(:1337, media via nginx :80), PostgREST (:3000), ES 9 + Kibana + sync
(docker, 127.0.0.1 only). IP 192.168.12.66 via Proxmox cloud-init.

## What was removed / changed vs production
- All transactional data of client 1000000: orders, invoices, shipments,
  payments, accounting posts, stock, requests, logs, attachments.
- All 15 customer orgs — only org 1000000 (LogYou) remains.
- All business partners/products except config-referenced ones
  (3 partners, 18 billing products). Staff users + roles kept,
  passwords identical to production at clone time.
- Strapi content + uploads wiped (admin login + API tokens kept).
- ES indices rebuilt empty. DocumentNo sequences reset.
- root crontab REMOVED (backup: /root/crontab.production.bak).
- postfix disabled. Web-push/chat runtime DBs cleared.
- /opt/erp-nuxt-frontend/.env NEUTRALIZED: LARAVEL, Sentry, DHL/DPD/
  Sendcloud/Amazon/JTL credentials, Synology, VAPID/FCM keys blanked;
  STRAPIPUBLIC/WEBAUTHN point at 192.168.12.66; fresh
  CREDENTIAL_ENCRYPTION_KEY. GardenWorld demo client untouched.

## Turning a clone of this template into a real instance

ONE COMMAND on prox2 (staged at /root/clone-logship-instance.sh, source in
repo reference/template-cleanup/) — clones, sets IP, boots, rebrands:

    /root/clone-logship-instance.sh <NEWID> <IP> "<ClientName>" \
        ["<OrgName>"] ["<CompanyLegalName>"] [--name x] [--memory MB] [--cores N]

It performs steps 1–2 below; 3–7 stay manual per instance.

1. prox2: qm clone 113 <ID> --name <name> --full; qm set <ID>
   --ipconfig0 ip=<IP>/24,gw=192.168.12.1; start.
2. Rebrand the tenant (client/org/linked partner/warehouse/roles +
   .env COMPANYNAME — the template says "LogYou" everywhere):
     /root/template-cleanup/04-set-instance-identity.sh \
       "<ClientName>" "<OrgName>" "<CompanyLegalName>"
   (--dry-run first to preview; restarts iDempiere + frontend itself.
   Staff users/emails stay — replace them in the app.)
3. Fill /opt/erp-nuxt-frontend/.env: endpoints + credentials as needed;
   pm2 restart erpfrontend --update-env.
4. Rotate the iDempiere REST secret (idempiere.properties) — the cloned
   one matches production, so prod tokens would work here (and IDEMPIERETOKEN
   in .env must then be re-issued).
5. Re-enable wanted cron jobs from /root/crontab.production.bak.
6. Create orgs/partners/products via the app (Initial Org Setup).
7. If mail is needed: systemctl enable --now postfix + iDempiere SMTP config.

## Cleanup tooling
/root/template-cleanup/ (also in ERP repo reference/template-cleanup/):
re-runnable on a fresh prod clone: 00-defuse.sh -> 03-neutralize-env.sh
-> run-cleanup.sh. All scripts refuse to run on production (guarded).
