gliderlabs / herokuish

Utility for emulating Heroku build and runtime tasks in containers
MIT License
1.44k stars 152 forks source link

Not able to run the Procfile process runner with user /bin/herokuish #1147

Open siva-vasipalli opened 6 months ago

siva-vasipalli commented 6 months ago

We are working on the custom ruby code execution on the rails application deploying using the Heroku build-pack. We are not able to get the expected result when we execute the below command.

/bin/herokuish procfile start runner -e $RAILS_ENV /tmp/script-$BUILD_NUMBER

Below is the Procfile entry for the runner

# access the rails runner
runner: bundle exec rails runner

we are getting the below response

+ /bin/herokuish procfile start runner -e development /tmp/script-194
Usage:
  rails runner [options] [<'Some.ruby(code)'> | <filename.rb> | -]

Options:
  -e, [--environment=ENVIRONMENT]  # Specifies the environment to run this runner under (test/development/production).

Examples:

Run `puts Rails.env` after loading the app:

  rails runner 'puts Rails.env'

Run the Ruby file located at `path/to/filename.rb` after loading the app:

  rails runner path/to/filename.rb

Run the Ruby script read from stdin after loading the app:
  rails runner -

You can also use the runner command as a shebang line for your executables:

  #!/usr/bin/env /app/rails runner

  Product.all.each { |p| p.price *= 2 ; p.save! }
josegonzalez commented 6 months ago

Are you running this outside of the docker image setup?

siva-vasipalli commented 6 months ago

Are you running this outside of the docker image setup? @josegonzalez ....we are running the command inside of the container shell , that was created by the Jenkins Pod template.

josegonzalez commented 6 months ago

I'm not actually sure you can combine a process start with extra arguments. You might need to just run the bundle exec thing directly.

siva-vasipalli commented 6 months ago

@josegonzalez you mean to say...we should not include a Procfile runner process with extra arguments. We have tried running directly executing the command bundle exec rails runner also and no luck.

josegonzalez commented 6 months ago

If you need to start arbitrary commands in the herokuish environment, start them via /exec. You could maybe set that as the entrypoint of your built image and be fine.