Troubleshooting
Common issues and how to fix them. If you're stuck, start here.
Connection Issues
"Permission denied (publickey)"
This means SSH can't authenticate with your server. Here's how to fix it:
-
Verify your public key is on the server
SSH into your server manually and check:
cat ~/.ssh/authorized_keysYour public key should be listed there.
-
Verify your private key in Ship It Squirrel
Make sure you pasted the entire private key, including the
-----BEGINand-----ENDlines. -
Check the SSH user
For new DigitalOcean droplets, the user is
root. After provisioning, Ship It Squirrel creates adeployuser.
"Connection refused" or "Connection timed out"
The server isn't accepting connections. Check:
- Is the server running? Check your DigitalOcean dashboard
- Is the IP address correct? Typos happen!
- Is SSH running? If you can access the DigitalOcean console, run:
systemctl status ssh - Is the firewall blocking port 22? Run:
ufw statusto check
"Host key verification failed"
This usually happens if you've reinstalled the server. The SSH fingerprint changed and your computer is being cautious.
Remove the old key from your known_hosts:
ssh-keygen -R YOUR_SERVER_IP
Provisioning Issues
Provisioning seems stuck
Provisioning installs a lot of software and can take 5-10 minutes. If it's been longer:
- Check the server status in your dashboard
- Try SSHing into the server manually to see if it's responsive
- Check the Rails logs for any error messages
"E: Unable to locate package"
The package manager's cache is out of date. SSH into your server and run:
apt update && apt upgrade -y
Then try provisioning again.
Ruby installation failed
This is usually a memory issue on smaller droplets. Make sure you have at least 2GB of RAM. If you're on a 1GB droplet, you can add swap space:
fallocate -l 2G /swapfile chmod 600 /swapfile mkswap /swapfile swapon /swapfile echo '/swapfile none swap sw 0 0' >> /etc/fstab
Deployment Issues
"bundle install" failed
Common causes:
- Missing native dependencies - Some gems need system libraries. Check the error message for which library is missing.
- Out of memory - Try adding swap space (see above)
- Bundler version mismatch - SSH in and run:
gem install bundler
"rails assets:precompile" failed
Asset compilation can fail for several reasons:
- Node.js/Yarn issues - Make sure
yarn installcompleted successfully - Missing environment variables - Some assets need
RAILS_ENV=productionand a validSECRET_KEY_BASE - Out of memory - Asset compilation is memory-intensive. Consider a larger droplet or add swap.
"rails db:migrate" failed
Database migration issues:
- Database doesn't exist - Run
rails db:createfirst - Permission denied - Check your
DATABASE_URLhas the right credentials - Migration error - Check the specific error message. You may need to fix the migration and redeploy.
App deployed but shows "502 Bad Gateway"
This means Caddy is running but can't reach your Rails app. Check if Puma is running:
systemctl status yourapp-puma
If it's not running, check the logs:
journalctl -u yourapp-puma -n 50
App shows old version after deploy
The current symlink might not have updated. Check it:
ls -la /var/www/yourapp/current
If it points to an old release, you can manually update it:
cd /var/www/yourapp ln -sfn releases/LATEST_RELEASE_FOLDER current systemctl restart yourapp-puma
Rails Credentials Issues
"ActiveSupport::MessageEncryptor::InvalidMessage"
Your Rails master key doesn't match your credentials file. Make sure:
- You're using the production key, not the development one
- The key in Ship It Squirrel matches
config/credentials/production.key - Your
config/credentials/production.yml.encfile exists and is committed to git
To check your key:
cat config/credentials/production.key
"Missing encryption key"
Rails can't find your master key. Either:
- Add the key to Ship It Squirrel (App settings > Rails Master Key)
- Or set the
RAILS_MASTER_KEYenvironment variable
SSL/HTTPS Issues
"Your connection is not private"
Caddy should automatically get SSL certificates, but it needs:
- A real domain - Not an IP address
- DNS pointing to your server - The domain must resolve to your server's IP
- Ports 80 and 443 open - Check your firewall:
ufw status
Check Caddy's logs:
journalctl -u caddy -n 50
Still Stuck?
Getting more information
SSH into your server and check these logs:
# Rails app logs journalctl -u yourapp-puma -f # Caddy (web server) logs journalctl -u caddy -f # PostgreSQL logs journalctl -u postgresql -f # System logs journalctl -f
Common debugging commands
# Check disk space df -h # Check memory free -m # Check running processes htop # Check what's listening on ports ss -tlnp # Check systemd services systemctl list-units --type=service --state=running
Pro tip: Use verbose SSH
When debugging connection issues, add -v (or -vv for more detail) to your SSH command:
ssh -v root@YOUR_SERVER_IP