Troubleshooting
Deployment didn't go as planned? Here are common issues and fixes.
Deployment Failures
"Health check failed"
This is the most common error. It means your app container started, but Mushak couldn't verify it was ready.
Fixes:
- Wrong Port: Does your app listen on port 3000 but Mushak is checking 8080? Set
internal_portinmushak.yaml. - Slow Startup: Does your app take >30s to boot? Increase
health_timeoutinmushak.yaml. - Crash on Boot: SSH into the server and check docker logs:bash
ssh user@server docker ps -a docker logs <container_id>
"Connection refused" or "ssh: unable to authenticate"
This usually means SSH authentication failed.
Common causes:
- No SSH key in agent: Mushak tries SSH agent first. Add your key:
ssh-add ~/.ssh/id_ed25519(orid_rsa) - Wrong key path: Specify explicitly:
mushak init --key ~/.ssh/id_ed25519 - Key not on server: Ensure your public key is in
~/.ssh/authorized_keyson the server - Test SSH directly:
ssh user@server- if this works, Mushak should work too
Priority of SSH keys:
- SSH agent (if available)
- Key specified via
--keyflag - Default:
~/.ssh/id_rsa
"env file not found" or missing environment variables
Your docker-compose.yml references .env.prod but deployment fails.
Fix:
- Upload environment file:
mushak env push(auto-detects.env.prodor.env) - Set individual variables:
mushak env set DATABASE_PASSWORD=secret - During init: Mushak will prompt to upload if it detects a local env file
- During deploy: Mushak will prompt to upload if server has no env file
Priority of environment files:
.env.prodon server (/var/www/<app>/.env.prod).envon server (/var/www/<app>/.env)- Not found - deployment may fail if docker-compose requires it
Wrong service detected for docker-compose
Mushak is trying to expose postgres instead of your web service.
Fix:
- Rename service: Include "web" in the name (e.g.,
web,webapp,web-server) - Use mushak.yaml: Create a
mushak.yamlfile with:yamlservice_name: your-service-name internal_port: 3000
Service detection priority:
- Services with "web" in the name
- First service defined in docker-compose.yml
- Override with
service_namein mushak.yaml
Database restarting on every deploy
By default, Mushak automatically detects infrastructure services (databases, caches) and keeps them running across deployments. Only application services are restarted.
Automatically detected infrastructure:
- postgres, mysql, mariadb, mongodb, timescale
- redis, memcached
- rabbitmq, elasticsearch
If your database still restarts:
- Check if it uses a recognized infrastructure image (e.g.,
image: postgres:16) - If using a custom image, add it to
mushak.yaml:yamlpersistent_services: - my-database - custom-cache
Runtime Issues
502 Bad Gateway
You deploy successfully, but see a 502 error in the browser.
Cause: The container crashed after the health check passed, or Caddy can't reach it. Fix: Check Caddy logs and Docker logs on the server.
sudo journalctl -u caddy -fDebugging Tips
Mushak provides several commands to debug your deployment:
View logs
mushak logs # View container logs
mushak logs -f # Follow logs in real-time
mushak logs -n 500 # Show last 500 linesAccess container shell
mushak shell # Opens interactive shell in your app containerManual debugging on server
- SSH into your server:
ssh user@server - Run
docker psto see running containers - Run
docker exec -it <container_name> /bin/shto get a shell inside your running app - Check environment:
cat /var/www/<app>/.env.prod