Git Product home page Git Product logo

heroku-run's Introduction

heroku-run Circle CI

License

Heroku CLI plugin to run one-off dyno processes.

heroku logs

display recent log output

USAGE
  $ heroku logs

OPTIONS
  -a, --app=app        (required) app to run command against
  -d, --dyno=dyno      dyno to limit filter by
  -n, --num=num        number of lines to display
  -r, --remote=remote  git remote of app to use
  -s, --source=source  log source to limit filter by
  -t, --tail           continually stream logs
  --force-colors       force use of colors (even on non-tty output)

DESCRIPTION
  disable colors with --no-color, HEROKU_LOGS_COLOR=0, or HEROKU_COLOR=0


EXAMPLES
  $ heroku logs
  2012-01-01T12:00:00+00:00 heroku[api]: Config add EXAMPLE by [email protected]
  2012-01-01T12:00:01+00:00 heroku[api]: Release v1 created by [email protected]

heroku run

run a one-off process inside a heroku dyno

USAGE
  $ heroku run

OPTIONS
  -a, --app=app        (required) app to run command against
  -e, --env=env        environment variables to set (use ';' to split multiple vars)
  -r, --remote=remote  git remote of app to use
  -s, --size=size      dyno size
  -x, --exit-code      passthrough the exit code of the remote command
  --no-notify          disables notification when dyno is up (alternatively use HEROKU_NOTIFICATIONS=0)
  --no-tty             force the command to not run in a tty
  --type=type          process type

DESCRIPTION
  Shows a notification if the dyno takes more than 20 seconds to start.

EXAMPLES
  $ heroku run bash
  Running bash on app.... up, run.1
  ~ $

  $ heroku run -s hobby -- myscript.sh -a arg1 -s arg2
  Running myscript.sh -a arg1 -s arg2 on app.... up, run.1

heroku run:detached

run a detached dyno, where output is sent to your logs

USAGE
  $ heroku run:detached

OPTIONS
  -a, --app=app        (required) app to run command against
  -e, --env=env        environment variables to set (use ';' to split multiple vars)
  -r, --remote=remote  git remote of app to use
  -s, --size=size      dyno size
  -t, --tail           stream logs from the dyno
  --type=type          process type

EXAMPLES
  $ heroku run:detached ls
  Running ls on app [detached]... up, run.1
  Run heroku logs -a app -p run.1 to view the output.

heroku-run's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

heroku-run's Issues

heroku local:run no longer accepting flags as arguments

I think this must have been related to the 3.0.0 release, but this command no longer works:

$ make start
heroku local:run ./node_modules/.bin/nodemon --ignore ./lib ./bin/api

  error: unknown option `--ignore'

run is getting tripped up by the flags passed to nodemon. And using -- doesn't seem to work to delimit flags either.

Error message on heroku run due to bad dyno type could be clearer

If I try to heroku run on a new app with a dyno running, I get an error about Free dyno limits, but no indication on how to fix it:

maciek@mothra:~/code/aux/newts-poc$ heroku run init
Running init on newts-testing... !!!
 ▸    Cannot run more than 1 Free size dynos.

It'd be great if this could link to the dyno type documentation or generally give more hints as to how to resolve the issue.

Stuck on heroku-run is updating...

heroku-cli/6.15.5-1f03166 (darwin-x64) node-v9.3.0

Plugin heroku-run is updating...
Plugin heroku-run is updating... ⣷
Plugin heroku-run is updating... ⣽

undefined in run:inside output

Running bash on ⬢ foo-bar ... up, web.1 (undefined)

The problem is that we use dyno.size but it is not defined for the run inside endpoint that we hit, we either need to add to the serializer in API or pull in the CLI.

Using exit-code adds semicolon in. Breaks scripts

When ever I call the run command passing in -x (or --exit-code). It appears to add a semicolon which does not seem to be parsed correctly over in the dyno.

Getting:

heroku run -x -a myApp --type=worker -- node test.js
Running node test.js on ⬢ MyApp... up, worker.3465 (Private-M)
 ▸    Warning: Dynos can take up to a few minutes to be provisioned in Private Spaces.
module.js:549
    throw err;
    ^

Error: Cannot find module '/home/test.js;'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
 ▸    No exit code returned

Or even better:

heroku run -x -a myApp --type=worker bash                                   
Running bash on ⬢ myApp... up, worker.6364 (Private-M)
 ▸    Warning: Dynos can take up to a few minutes to be provisioned in Private Spaces.
FATA exec: "bash;": executable file not found in $PATH 
 ▸    No exit code returned

Double quotes are not handled properly when in args with spaces

@dickeyxxx When I was reviewing #9 I noticed a bug in the buildCommand method here

arg = `"${arg}"`;
. If someone passes in an arg with spaces and double quotes, the quotes no longer balance when passed in.

-> % heroku run echo 'foo " bar'
--> POST /apps/app/dynos
--> {"command":"echo \"foo \" bar\"","attach":true,"env":{"TERM":"xterm-256color","COLUMNS":157,"LINES":81}}
Running echo "foo " bar" on app... <-- 201 Created
<-- 
up, run.2196
bash: -c: line 0: unexpected EOF while looking for matching `"'
bash: -c: line 1: syntax error: unexpected end of file

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The push permission to the Git repository is required.

semantic-release cannot push the version tag to the branch master on remote Git repository.

Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment.


Good luck with your project ✨

Your semantic-release bot 📦🚀

heroku run -x doesn't work slug apps in Private Spaces

It seems that ssh transmit doesn't have the code to detect the exit code like rendezvous does. This results the run -x command failing to capture the exit status ( is substituted for \uFFFF):

Private Spaces app

$ heroku run -x -a daigo-dango-tokyo false; echo $?
Running false on ⬢ daigo-dango-tokyo... provisioning, run.6499 (Private-M)
 ▸    Warning: Dynos can take up to a few minutes to be provisioned in Private
 ▸    Spaces.
〓 heroku-command-exit-status 1
0

Common Runtime app

$ heroku run -x -a daigo-dango false; echo $?
Running false on ⬢ daigo-dango... up, run.8789 (Hobby)
 ▸    Process exited with code 1
1

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The push permission to the Git repository is required.

semantic-release cannot push the version tag to the branch master on remote Git repository.

Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment.


Good luck with your project ✨

Your semantic-release bot 📦🚀

heroku run hangs on crashed dynos

If the dyno crashes before it can be attached, heroku run hangs waiting for attachment that never happens.

Steps to Reproduce:

  1. Create a bad slug (e.g. put some crap in file, but not in tgz format)
  2. Create a release from the slug
  3. Launch a one-off with the slug. Hangs like this:
$ heroku run bash -a app-crash
Running bash on ⬢ app-crash... ⢿ connecting, run.2057

If you look in the logs, you can see it immediately completed (i.e. crashed):

2016-08-16T23:49:09.524773+00:00 heroku[api]: Starting process with command `bash` by [email protected]
2016-08-16T23:49:09.890177+00:00 heroku[run.2057]: State changed from starting to complete

I suggest that we poll in the background for the dyno status and error out early if the dyno is gone. A simple timeout on the connect would probably not work because of Private Space boot times, and we'd want this to fail faster than that.

Commands which are accepted by the normal heroku run break with this plugin

All cases I tried are done with a Symfony2 PHP project. To reproduce it, you can deploy this demo app: https://github.com/dzuelke/symfony-standard-heroku
The app/console file is an executable PHP script with a shebang to find the PHP executable.

heroku run 'app/console' works fine with and without the --exit-code option.
However, using a command with arguments breaks when using the plugin:

heroku run 'app/console list' works fine, while heroku run 'app/console list' --exit-code will break.

Note that the heroku-exit-status for the v3 handled this (before it stopped working because of changes in the heroku CLI): https://github.com/glenngillen/heroku-exit-status

error message for run:inside with invalid dyno name is unclear

h run:inside -a retrodot-production rails c
Running c on ⬢ retrodot-production... !
 ▸    rails must be "up" before you can use run:inside. Please try again later.

My error here was in failing to specify a dyno to run inside. It interpreted "rails" as a dyno name. It looks like it's telling me "rails isn't up", which almost makes me think my production app is down or something! Kind of scary for a user.

I'm thinking a clearer error here would be something like: "rails" isn't the name of a running dyno in this app or "rails" isn't a dyno type in this app.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.