squirrelworks

DevOps > Deployment Pipelines (Part 3)

Pipeline Optimization, Web-Root Migration, & Dependency Remediation

Following the initial deployment of our server-side Git hook architecture, we shifted focus toward operational velocity, production path transparency, and codebase consolidation. Here is how we implemented custom terminal aliases, redirected the post-receive hook to target the true public web root, synced cross-environment database schemas, and remediated legacy DOM bugs.

Git Bash Aliases Direct Root Checkout DOM & Dependency Fixes
bash — pipeline optimization
$ ga
$ gc "refactor: root checkout"
$ gp
remote: Synchronizing public_html...
OK: Deployment complete.

1. Accelerating Local Workflow Momentum with Custom Shell Aliases

During high-frequency deployment sprints, repeatedly typing multi-word commands slows momentum. To streamline local staging, committing, and pushing, we configured custom shell aliases inside our workstation's Git Bash profile (~/.bashrc).

Alias Underlying Command Operational Purpose
gs git status Instant audit of modified, untracked, or staged assets.
ga git add . Stages all local changes across the repository in a single stroke.
gc "msg" git commit -m "msg" Creates concise, immutable version control snapshots.
gp git push sandbox-remote main Triggers encrypted SSH transport and executes remote deployment hooks.
# Sub-second deployment sequence via aliases
ga && gc "feat: refactor navigation dependencies and root paths" && gp

2. Web-Root Direct Checkout & Hook Reconfiguration

Initially, our post-receive hook deployed files into an isolated subfolder (/public_html/sandbox-repo/). While effective for initial testing, this left live production URLs looking awkward (squirrelworks.dev/sandbox-repo/page.php). To establish a clean user experience, we updated the hook script in ~/repo/sandbox-repo.git/hooks/post-receive to check out files directly into /public_html/.

#!/bin/bash
# Reconfigured post-receive hook pointing directly to public_html
git --work-tree=/home/squirrel/public_html --git-dir=/home/squirrel/repo/sandbox-repo.git checkout -f main

This path correction achieved two structural advantages:

  • Transparent Domain Routing: Assets now serve directly from root (squirrelworks.dev/page.php) without exposing subdirectory implementation details.
  • Full Site Migration Initiative: Spurred a major migration sprint, running ~140 legacy pages through local Git tracking to ensure uniform version control across the entire web platform.

3. Resolving Dependency Traps & Syntax Cascades

Rapidly migrating legacy files into a live environment exposed several hidden dependency edge-cases and subtle syntax bugs that manual FTP transfers had previously masked.

Tech Fact Icon
Key Architectural Remedies
  • Global Connection Instantiation ($conn): Fixed quiet PHP execution halts on landing queries by centralizing createConnChinook() within mainfunctions.php, ensuring valid database resource handles across all including pages.
  • CSS Stylesheet Consolidation: Removed card outline artifacts on landing page carousels caused by multiple competing carousel stylesheets being linked concurrently in the HTML header.
  • DOM Link Bleed Remediation: Resolved a layout bug where footer category headings lost yellow styling and acted as hyperlinks. The root cause was unclosed anchor tags (</a>) around image elements inside preceding carousel slides, causing the browser parser to extend links down into the footer.

4. Database Schema Alignment & Cross-Environment Parity

While Git manages application source code, database structures require separate synchronization. Diverged schemas between local MySQL (XAMPP) and production MySQL (KnownHost) triggered unexpected runtime errors during testing.

A prime example occurred when loading squirrel-landing.php locally: the production table had been upgraded with an articleHardDate column for precise sorting, while the local table lacked it, throwing an unhandled SQL exception (Unknown column 'articleHardDate' in 'order clause').

-- Aligning local MySQL schema with production release
ALTER TABLE blogarticle ADD COLUMN articleHardDate DATE NULL;

Aligning table structures and standardizing environment detection inside mainfunctions.php established seamless database compatibility across both local development and live production.

5. Decoupling Web-Server Rules & Repository Hygiene

Local development and live production have opposing web-server requirements. Local XAMPP needs open directory browsing (Options +Indexes) for rapid file navigation, whereas live production requires strict access controls (Options -Indexes) and default landing page redirects.

To prevent local server rules from overwriting production security during Git pushes, we decoupled the server configuration file from version control:

# Untrack .htaccess from version control manifest
git rm --cached .htaccess
echo ".htaccess" >> .gitignore
git add .gitignore && git commit -m "chore: untrack htaccess for environment isolation"

Untracking .htaccess ensures that production maintains its locked-down cPanel security rules, while local workstations retain sortable file browsing without risk of cross-environment overwrite.

6. Local Apache VirtualHost Alignment for Root-Relative Path Parity

Enforcing root-relative URL pathing (href="/git-setup3.php") is standard practice on production to ensure links resolve cleanly from the domain root regardless of subdirectory depth. However, on local XAMPP setups, running out of a subfolder (localhost/sandbox-repo/) breaks root-relative links because Apache evaluates / as C:\xampp\htdocs\ instead of the repository root.

Rather than introducing fragile code edits or stripping leading slashes prior to Git pushes, we updated Apache's local VirtualHost configuration (httpd-vhosts.conf) to map http://localhost/ directly to the repository directory:

# Mapping local Apache root directly to workspace repository
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/sandbox-repo"
    ServerName localhost
    <Directory "C:/xampp/htdocs/sandbox-repo">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

This environment alignment delivers two core developer benefits:

  • Zero Path Friction: Root-relative navigation links, CSS imports, and JS includes resolve identically on http://localhost/ and https://squirrelworks.dev/ without environment-specific hacks.
  • Deployment Integrity: Eliminates the risk of committing broken relative paths or staging temporary path fixes during Git deployment pushes.
Series Continuity & Sign-off

Refactoring our Git pipeline transformed a basic file transfer mechanism into a robust, enterprise-grade deployment engine. By combining post-receive hook automation with proper repository hygiene and cross-environment database alignment, site updates are now published with absolute precision and sub-second latency.



Accessibility
 --overview

API
 --REST best practices
 --REST demo
 --REST vs RPC
 --Wikipedia API

Blockchain
 --overview

Blog
 --The 'Brute Force' Mistake
 --The Bezosian Protocol: Eliminating Learned Helplessness
 --The Humility Protocol: Reality Over Reputation
 --The Jobsian Protocol: Systems Analysis as a War on Entropy
 --The Jordan Framework: Engineering a Competitive Edge
 --Time Management as an Operational System: The Tracy Framework
 --Tracy on Goals: Vector Alignment & Execution

Cloud
 --AWS overview

CSS/HTML
 --Admissions Portal Simulation Lab
 --Bootstrap carousel
 --Grid demo
 --markdown demo

DevOps
 --Agile Principles
 --DevOps overview
 --Drupal, containerized
 --Prometheus & Grafana
 --RKE2: Deploying the Rancher Kubernetes Engine

Encoding
 --Overview

Ergonomics
 --Desk configuration
 --Device fleet
 --Input device array
 --keystroke mechanics
 --Phones & RSI

ERP
 --Anthology overview
 --Ellucian Banner
 --Higher Ed ERP Simulation Lab
 --PeopleSoft Campus Solutions
 --PESC standards
 --Slate data model

Git
 --Authoring & Deploying the Post-Receive Hook
 --Pipeline Optimization, Web-Root Migration, & Dependency Remediation
 --syntax overview
 --troubleshooting libcrypto

Hardware
 --Device fleet
 --Electricity fundamentals
 --Homelab diagram

Identity & Access
 --Deploying Entra Connect
 --Foundations
 --OIDC Integration
 --Provisioning Okta Dev Tenant

Java
 --Fundamentals

Javascript
 --Advanced Interaction: jQuery & UI Frameworks
 --input prompt demo
 --misc demo
 --Time and Date functions
 --Vue demo

Linux
 --Auditing the live interface state using ethtool
 --grep demo
 --HCI and Proxmox
 --Persistent Infrastructure Telemetry: TMUX
 --Proxmox install
 --xammp ftp server

Mail flow
 --DKIM, SPF, DMARC
 --MAPI

Microsoft
 --AZ-800: Administering Windows Server Hybrid Core Infrastructure
 --BAT scripting
 --Group Policy
 --IIS
 --robocopy
 --Server 2022 setup - Virtualbox

Misc
 --Applications
 --Computer Science Foundations
 --Field Notes: RainPoint Bluetooth Hose Timer
 --Protocols, TLS & Distributed Scale
 --regex
 --Resources
 --Runtimes, ASTs & Data Structures
 --Sustainable Computing
 --Terminology
 --Tribute to Computer Scientists

Networks
 --BGP Peering & Security Hardening Lab
 --CCNA Lammle Study Guide
 --Cisco 1921/K9 router
 --NGFW vs. Legacy
 --routing protocols
 --throughput calculations

PHP/SQL
 --Cookies
 --database interaction
 --demo, OSI Layers quiz
 --Foreign key constraint demo
 --fundamentals
 --MySQL and PHPmyAdmin setup
 --pagination
 --security
 --session variables
 --SQL fundamentals
 --structures
 --Tables display

Python
 --fundamentals

Security
 --Kerberos: Protocol Architecture
 --NTP Overview
 --Overview- GRC (Governance, Risk, and Compliance)
 --Security Blog
 --SSH fundamentals

Serialization
 --JSON demo
 --YAML demo