ZALEAHUB — CPANEL DEPLOYMENT
===========================

Application root: website_zaleahub
Application URL: https://arkkdigital.com/zaleahub
Python: 3.12
Startup file: passenger_wsgi.py
Entry point: application

This package is for the standalone ZaleaHub application only. Do not upload
it to the main ArkK Digital application or change the main application's
Passenger file, dependencies, database, or environment variables.

REQUIRED ENVIRONMENT VARIABLES (ZaleaHub Python app only)
- ZALEAHUB_SECRET_KEY: unique random secret, at least 32 characters
- ZALEAHUB_DB_USER
- ZALEAHUB_DB_PASSWORD
- ZALEAHUB_DB_HOST
- ZALEAHUB_DB_NAME
- ZALEAHUB_PUBLIC_URL=https://arkkdigital.com/zaleahub
- ZALEAHUB_ADMIN_EMAIL
- ZALEAHUB_MAIL_HOST
- ZALEAHUB_MAIL_PORT=587
- ZALEAHUB_MAIL_USERNAME
- ZALEAHUB_MAIL_PASSWORD
- ZALEAHUB_MAIL_USE_TLS=true
- ZALEAHUB_MAIL_FROM: verified sender address

Google OAuth remains optional:
- ZALEAHUB_GOOGLE_CLIENT_ID
- ZALEAHUB_GOOGLE_CLIENT_SECRET

SMTP is now required for readiness because registration verification and
password recovery depend on outbound email. Use your hosting provider's SMTP
hostname, port, credentials, and a sender address authorized by that provider.
Do not put credentials in source files or upload .env files.

SAFE UPDATE PROCEDURE — EXISTING DATABASE
1. Back up the ZaleaHub database and the private QR archive directory.
2. Upload the contents of this package into website_zaleahub. Preserve cPanel's
   public/, tmp/, .htaccess, and any hosting-generated files. Do not delete
   instance/private/qr_archives/.
3. Activate the existing ZaleaHub Python 3.12 virtual environment.
4. Install dependencies:
   pip install -r requirements.txt
5. Apply the additive migration:
   flask --app 'zaleahub:create_app' db upgrade
6. Restart the ZaleaHub Python application.
7. Verify:
   https://arkkdigital.com/zaleahub/health/ready
   It must return status=ok, database=ok, email=configured.

IMPORTANT:
- Do NOT run init-db on the existing production database.
- Do NOT run db stamp, db init, db migrate, or db downgrade.
- The included migration adds one verification flag and two authentication
  tables. Existing users are marked verified so they retain access. Existing
  QR codes, redemptions, loyalty milestones, and admin records are untouched.
- Keep a database backup until smoke tests pass.
- Do not merge PR #14 or deploy to production until explicitly approved.

SMOKE TESTS
1. Register with a test email; verify the email arrives and its link works.
2. Sign in before verification; access must be denied with a resend path.
3. Sign in after verification; dashboard and QR history must load.
4. Request a password reset; generic confirmation must not reveal whether an
   account exists. Link must expire and work only once.
5. Submit five incorrect passwords for a test account/IP; further attempts
   must be temporarily blocked. Verify a successful login after lock expiry.
6. Test Google OAuth if enabled.
7. Test QR redemption and duplicate QR protection; verify admin QR archive
   generation/download remains unchanged.
