Run local code on a Heroku production instance

Multi tool use
Run local code on a Heroku production instance
Is it possible for me to run something like:
RAILS_ENV=production heroku run Item.remove_dupes
where the code is local on my machine but it is run on my production Heroku instance? (ie not having pushed code to production via GitHub).
1 Answer
1
You can use Heroku console
$ heroku run console
Edit
Heroku console will automatically run in production mode
heroku run ...
@timpone perhaps you're after this: devcenter.heroku.com/articles/heroku-local
– Lukasz Muzyka
Aug 30 '16 at 1:08
that's about running locally, I want local code to be run on production. Correct me if I'm wrong?
– timpone
Aug 30 '16 at 1:13
well this is why I thought you want to use console. You can execute the code directly against production code. Drawback - you need to write the code in the console. if you want to run rake tasks to clean your database and you need very complex logic that can not be written in the console you may want to connect to production database (although I have never done it with heroku) and execute code locally
– Lukasz Muzyka
Aug 30 '16 at 1:31
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
thx - just to be clear, I'd like to run code that is local (ie not on production and that hasn't been deployed) against my production instance. I am pretty sure running
heroku run ...
basically sends the command to the heroku server and runs it locally there. I'm doubting what I do can be done.– timpone
Aug 30 '16 at 1:01