Skip to content
prod e051e98
Browse

7 · Optional tooling

Objective — add optional power-ups only where they fill a real gap: Atlas schema management, a database GUI (Bytebase), Redis caching via Herd Pro, and a right-sized debug-tools stack. None block launch; each has a free fallback.

Everything here is optional — the phase is complete without it. Add a tool only when it fills a real gap for your project, and prefer the free fallback if you don’t already own the paid service.

Atlas gives clean schema exports and cross-environment diffs (it’s the preferred exporter on page 5). The CLI is free; Atlas Cloud’s visual diffs and CI checks need a license.

  1. Install the CLI and sign in. The CLI install is terminal-runnable; the atlas login browser sign-in is a 👤 step if you want Cloud features.

    Terminal window
    atlas version 2>/dev/null || brew install ariga/tap/atlas
    atlas login && atlas whoami
    # Expected: a version, then your Atlas identity after the browser login
    • ✅ The Atlas CLI is installed (and signed in if you use Cloud).
  2. Point it at the local DB via an env var — keep secrets out of atlas.hcl — and gitignore the env files.

    Terminal window
    echo 'ATLAS_LOCAL_URL="mysql://root:@127.0.0.1:3306/[PROJECT_NAME]_local"' > .env.atlas
    grep -q '^\.env\.atlas$' .gitignore || printf '.env.atlas\n' >> .gitignore
    grep -q '^\.envrc$' .gitignore || printf '.envrc\n' >> .gitignore
    # Expected: .env.atlas written and both env files added to .gitignore
    • ✅ Atlas reads the DB URL from a gitignored env file.

2. Bytebase — database GUI & review workflow

Section titled “2. Bytebase — database GUI & review workflow”

Bytebase adds a web UI for schema management, SQL review, and approval workflows across staging/production. It’s a heavier setup (~60–90 min) and only worth it for teams running frequent reviewed schema changes.

  1. Stand up the workspace and connect your instances.
    • Create a free workspace at hub.bytebase.com.

    • Add your staging and production instances (whitelist Bytebase’s egress IP in Remote MySQL first).

    • Create a project, transfer the databases in, sync schemas, and attach an SQL-review policy.

    • ✅ Bytebase is connected to your instances with a review policy attached.

Redis replaces file-based cache/sessions/queues — 2–3× faster page loads, instant sessions. Not required for launch, and easy to add post-deploy. Local dev uses Herd Pro’s built-in Redis; staging/production use Upstash (configured in Phase 4/5).

  1. Start the Herd Redis service, then confirm it answers.

    Terminal window
    redis-cli ping # expect PONG
    # Expected: PONG
    • redis-cli ping returns PONG.
  2. Require Predis — pin the platform PHP first if the server runs older PHP.

    Terminal window
    SERVER_PHP_VERSION="<php-version-from-host>"
    composer config platform.php "$SERVER_PHP_VERSION" # writes a permanent committed pin into composer.json; log it in _CUSTOMIZATIONS.md
    composer require predis/predis
    # Expected: Predis resolves to a server-compatible version and installs
    • ✅ Predis is installed against the server’s PHP version.
  3. Wire local .env to the Herd Redis (no password, localhost).

    CACHE_DRIVER=redis
    SESSION_DRIVER=redis
    QUEUE_CONNECTION=redis
    REDIS_CLIENT=predis
    REDIS_HOST=127.0.0.1
    REDIS_PASSWORD=null # leave unquoted — null is a literal token; "null" breaks auth (exception to the double-quote-secrets rule)
    REDIS_PORT=6379
    REDIS_PREFIX=[PROJECT_NAME]_local_
    • .env points cache/session/queue at the local Redis.
  4. Verify through tinker, then commit the lock-file change.

    Terminal window
    php artisan config:clear && php artisan cache:clear
    php artisan tinker --execute="Cache::put('t','Redis works!',60); echo Cache::get('t');"
    git add composer.json composer.lock && git commit -m "Add Redis cache support via Predis"
    # Expected: "Redis works!" prints, then the lock-file commit is created
    • ✅ Tinker returns Redis works! and the lock change is committed.

Prepare (don’t populate) the Upstash placeholders in your .env.staging / .env.production templates for the deploy phase.

If you’re not on Herd Pro, any of these gives you the same local Redis:

4. Debug tools — install only what fills a gap

Section titled “4. Debug tools — install only what fills a gap”

Shipping without a request/query inspector is guesswork — but many CodeCanyon apps already ship barryvdh/laravel-debugbar. Installing Telescope on top creates competing toolbars and double-captures queries. Check first.

  1. Check what’s already present.

    Terminal window
    grep -c '"name": "barryvdh/laravel-debugbar"' composer.lock
    grep -c '"name": "laravel/telescope"' composer.lock
    # Expected: a 0/1 count for each — tells you what's already installed
    • ✅ The inspectors already in composer.lock are known.
  2. Add at most one, based on what’s present.

    Already presentAction
    debugbar onlyKeep it — you have request/query visibility. Don’t add Telescope.
    Telescope onlyKeep it.
    NeitherAdd one — debugbar for a quick bottom-bar, Telescope for a richer dashboard.
    • ✅ Exactly one request/query inspector is active — no duplicates.

Do not mark this step done until every box below is checked.

  • 🔀 Per-tool decision made — installed where it adds value, or skipped with the free fallback noted.
  • 🔀 Redis (if added)redis-cli pingPONG and tinker returns "Redis works!".
  • 🤖 No duplicate inspectors — not both debugbar and Telescope.
  • 🤖 Phase 3 complete — local environment installed, verified, committed, and secured.