Debugging a running Discourse on DigitalOcean

I’m having some issues with uploading images and wanted to try to debug the upload_controller.rb. How do I do that? Can I add debug print statements? I’ve never done anything with Ruby, so I’m a beginner there.

Can I debug on a running Discourse image on DigitalOcean?

The best way is by running a local dev instance.

But if the bug only shows on production, you can:

ssh root@ip
cd /var/discourse
./launcher enter app
vim app/controllers/uploads_controller.rb
sv restart unicorn
tail log/unicorn.stdout.log # or log/unicorn.stderr.log or log/production.log