Table of Contents
- Debugging Navbar Display Issue Between Docker Compose and Kubernetes
- Check if output.css exists in the container
- View first 50 lines to verify it has content
- Download CSS from Docker Compose
- Download CSS from Kubernetes (replace with your domain)
- Compare the files
Debugging Navbar Display Issue Between Docker Compose and Kubernetes
Issue Description
The navbar appears differently between Docker Compose (local) and Kubernetes environments:
- Kubernetes: Shows hamburger menu correctly
- Docker Compose: Shows expanded navigation links instead of hamburger menu
- Both environments should show "Blueberry IDP" text next to the logo
Quick Diagnosis Steps
1. Check the Debug Endpoint
Visit the UI debug endpoint in both environments to compare viewport and responsive behavior:
Docker Compose:
http://localhost:8001/api/health/ui-debug
Kubernetes:
https://your-kubernetes-domain/api/health/ui-debug
Take screenshots or note:
- Window width (in pixels)
- Current responsive breakpoint
- Whether it shows "Mobile Layout" or "Desktop Layout"
2. Clear Browser Cache
The issue might be caused by cached CSS. Try:
1. Hard refresh: Cmd+Shift+R
(Mac) or Ctrl+Shift+R
(Windows/Linux)
2. Open in incognito/private browsing mode
3. Clear browser cache completely for both domains
3. Verify CSS Loading
Open browser DevTools (F12) and check:
1. Network tab: Look for output.css
- is it loading? What's the status code?
2. Console tab: Any JavaScript errors preventing Alpine.js from working?
3. Elements tab: Inspect the navbar and check if Tailwind classes are applied
Detailed Investigation
Check CSS File Integrity
- Verify CSS is up-to-date in Docker container:
# Check if output.css exists in the container
docker exec blueberry-app ls -la /app/blueberry/static/css/output.css
# View first 50 lines to verify it has content
docker exec blueberry-app head -50 /app/blueberry/static/css/output.css
- Compare CSS between environments:
# Download CSS from Docker Compose
curl -o todo/docker-output.css http://localhost:8001/static/css/output.css
# Download CSS from Kubernetes (replace with your domain)
curl -o todo/k8s-output.css https://your-kubernetes-domain/static/css/output.css
# Compare the files
diff todo/docker-output.css todo/k8s-output.css
Verify Responsive Breakpoints
The navbar uses Tailwind's md:
breakpoint (768px):
- < 768px: Mobile layout with hamburger menu
- ≥ 768px: Desktop layout with full navigation
- Test at different viewport widths:
- Resize browser window to exactly 767px wide (should show hamburger)
- Resize to 768px wide (should show full nav)
-
Use browser DevTools device emulation to test mobile sizes
-
Check computed styles in DevTools:
- Inspect the mobile navbar div:
<div class="md:hidden flex items-center justify-between">
- Inspect the desktop navbar div:
<div class="hidden md:flex items-center justify-between">
- Verify which one has
display: none
vsdisplay: flex
JavaScript and Alpine.js Verification
- Check Alpine.js is loading:
// Run in browser console
console.log('Alpine version:', Alpine.version);
console.log('Alpine initialized:', !!window.Alpine);
- Test Alpine.js functionality:
// Check if mobile menu state works
document.querySelector('[x-data*="mobileMenuOpen"]').__x.$data.mobileMenuOpen = true;
// This should show the mobile menu if Alpine is working
Container and Build Verification
- Rebuild CSS locally:
# Rebuild CSS to ensure it's current
npm run build-css
# Check if it changed
git status blueberry/static/css/output.css
- Rebuild Docker image:
# Force rebuild without cache
docker-compose build --no-cache app
# Restart the container
docker-compose up -d app
- Check Docker logs for errors:
docker-compose logs -f app
Network and Proxy Issues
- Check response headers:
- In DevTools Network tab, click on
output.css
- Check
Cache-Control
header - Check
Content-Type
istext/css
-
Note any proxy-related headers
-
Test direct container access:
# Bypass any proxy by accessing container directly
docker exec -it blueberry-app curl -I http://localhost:8000/static/css/output.css
Common Fixes
Fix 1: Force CSS Refresh
- Update the version in
pyproject.toml
or whereverapp_version
is defined - This will change the CSS URL query parameter and force a refresh
Fix 2: Manual CSS Rebuild
# Ensure you have the latest templates
git pull
# Rebuild CSS
npm install
npm run build-css
# Restart Docker Compose
docker-compose down
docker-compose up -d
Fix 3: Check for CSS Overrides
Look for any custom CSS that might be overriding Tailwind's responsive utilities:
# Search for custom CSS files
find . -name "*.css" -not -path "./node_modules/*" -not -name "output.css"
# Search for inline styles in templates
grep -r "style=" blueberry/templates/
Fix 4: Verify Kubernetes Deployment
# Check if the latest image is deployed
kubectl describe deployment blueberry -n blueberry | grep Image
# Force a rollout restart
kubectl rollout restart deployment blueberry -n blueberry
# Check pod logs
kubectl logs -f deployment/blueberry -n blueberry
Prevention
- Add CSS build to CI/CD:
- Ensure
npm run build-css
runs during Docker image build -
Verify the Dockerfile includes the built CSS
-
Implement CSS versioning:
- Use content hashing for CSS filename
-
Or use git commit hash in query parameter
-
Add visual regression tests:
- Screenshot key pages in CI
- Compare against baseline images
Still Not Working?
If the issue persists after all these checks:
- Document findings:
- Screenshot of Docker Compose navbar
- Screenshot of Kubernetes navbar
- Browser console errors (if any)
- Network tab showing CSS loading
-
Output from the debug endpoint
-
Check for environment-specific configurations:
- Compare environment variables between environments
- Check if there are any nginx/ingress rules affecting static files
-
Verify GKE ingress configuration
-
Test in production mode locally:
# Run the production Docker image locally
docker run -p 8002:8000 \
-e DEBUG=false \
-e OTHER_ENV_VARS=... \
your-registry/blueberry:latest
This will help determine if it's a build issue or environment-specific configuration.