role: user

content: How do I deploy a new version of the application?


role: assistant

content:
Here's the deployment process:
1. Run tests: pytest
2. Build Docker image: docker build -t app:latest .
3. Push to registry: docker push registry.example.com/app:latest
4. Update production: ssh prod 'cd /app && docker-compose pull && docker-compose up -d'
5. Verify: curl https://app.example.com/health


content: What if tests fail?


content:
If tests fail:
1. Check the error logs: pytest -v
2. Fix the failing tests
3. Re-run tests: pytest
4. If still failing, check recent changes: git log --oneline -10
5. Consider reverting: git revert HEAD


content: What if the Docker build fails?


content:
If Docker build fails:
1. Check Dockerfile syntax: docker build --no-cache -t app:latest .
2. Check for missing dependencies: cat requirements.txt
3. Check disk space: df -h
4. Clean up Docker: docker system prune -f
5. Try building with verbose output: docker build --progress=plain -t app:latest .


content: What if the push to registry fails?


content:
If push to registry fails:
1. Check registry credentials: docker login registry.example.com
2. Check registry space: curl https://registry.example.com/v2/_catalog
3. Check image size: docker images app:latest
4. Try tagging with version: docker tag app:latest registry.example.com/app:v1.0.0
5. Push with version tag: docker push registry.example.com/app:v1.0.0


content: What if the production update fails?


content:
If production update fails:
1. Check SSH connection: ssh prod 'echo connected'
2. Check disk space on prod: ssh prod 'df -h'
3. Check Docker status: ssh prod 'docker ps -a'
4. Check logs: ssh prod 'docker-compose logs --tail=100'
5. Rollback: ssh prod 'cd /app && git checkout HEAD~1 && docker-compose up -d'