Some checks failed
Build & Deploy KLZ Cables / build-and-deploy (push) Failing after 1m32s
3.9 KiB
3.9 KiB
Deployment Guide
This document describes the deployment setup for KLZ Cables website.
Automatic Deployment (Gitea Actions)
The project uses Gitea Actions for CI/CD. On every push to the main branch:
- Build: Docker image is built with platform
linux/arm64 - Push: Image is pushed to
registry.infra.mintel.me/mintel/klz-cables.com:latest - Deploy: SSH connection to production server pulls and restarts containers
Workflow File
Location: .gitea/workflows/deploy.yml
Required Secrets
Configure these in your Gitea repository settings:
REGISTRY_USER- Docker registry usernameREGISTRY_PASS- Docker registry passwordALPHA_SSH_KEY- SSH private key for deployment userNEXT_PUBLIC_UMAMI_WEBSITE_ID- Umami analytics website IDNEXT_PUBLIC_UMAMI_SCRIPT_URL- Umami analytics script URLSENTRY_DSN- Sentry/GlitchTip DSN for error tracking
Manual Deployment
If you need to deploy manually:
On the Production Server
# SSH into the server
ssh deploy@alpha.mintel.me
# Navigate to the project directory
cd /home/deploy/sites/klz-cables.com
# Pull the latest image
docker compose pull
# Restart containers
docker compose up -d --force-recreate --remove-orphans
# Clean up old images
docker image prune -f
Troubleshooting
Workflow Not Triggering
- Check Gitea Actions is enabled in repository settings
- Verify the workflow file syntax
- Check runner availability with label
docker
Build Failures
- Check build logs in Gitea Actions tab
- Verify all secrets are configured correctly
- Ensure Dockerfile is valid
Deployment Failures
- Verify SSH key has correct permissions (600)
- Check deploy user has Docker permissions
- Verify registry credentials are correct
- Check server disk space:
df -h
Container Issues
# Check container status
docker compose ps
# View logs
docker compose logs -f app
docker compose logs -f varnish
# Check health
docker compose exec app wget -O- http://localhost:3000/health
Architecture
Client
↓
Traefik (TLS termination, routing)
↓
Varnish (HTTP caching)
↓
Next.js App (port 3000)
Services
- app: Next.js application
- varnish: HTTP cache layer
- traefik: Reverse proxy (external network)
Domains
klz-cables.com- Productionwww.klz-cables.com- Production (www)staging.klz-cables.com- Staging
Environment Variables
Build-time (in Dockerfile/Workflow)
NEXT_PUBLIC_UMAMI_WEBSITE_IDNEXT_PUBLIC_UMAMI_SCRIPT_URLNEXT_PUBLIC_SENTRY_DSN
Runtime (in docker-compose.yml)
SENTRY_DSNREDIS_URLREDIS_KEY_PREFIX
Monitoring
Health Checks
- App:
https://klz-cables.com/health - Varnish: Configured in docker-compose.yml
Logs
# Application logs
docker compose logs -f app
# Varnish logs
docker compose logs -f varnish
# All logs
docker compose logs -f
Analytics
- Umami: Configured via environment variables
- Sentry/GlitchTip: Error tracking
Rollback
To rollback to a previous version:
# On the server
cd /home/deploy/sites/klz-cables.com
# Pull a specific version (if tagged)
docker pull registry.infra.mintel.me/mintel/klz-cables.com:TAG
# Or rebuild from a specific commit
# (requires access to the repository on the server)
# Restart with the older image
docker compose up -d --force-recreate
Performance
Cache Invalidation
Varnish caches static assets. To clear cache:
docker compose exec varnish varnishadm "ban req.url ~ ."
Cache Configuration
Edit varnish/default.vcl and restart:
docker compose restart varnish
Security
- All secrets are stored in Gitea repository settings
- SSH key is injected at deployment time
- Registry credentials are not stored in the repository
- Deploy webhook requires secret token
Support
For issues or questions:
- Check logs first
- Review this documentation
- Contact the development team