To make things easier, create a script containing the lines you want to run, make it executable and put it in your application directory, and after you deploy you can run:
fly ssh console -C /app/console
Replace /app/console with the name of your script.