Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only allow whitelisted commands to be run #967

Merged
merged 5 commits into from
Aug 10, 2016
Merged

Conversation

ejholmes
Copy link
Contributor

@ejholmes ejholmes commented Aug 9, 2016

This is a spike into #966, which adds a configuration option to Empire to require commands to be whitelisted for emp run to work.

If a command is not whitelisted, emp run will have this behavior:

$ emp run migrate
error: command not whitelisted: migrate

To whitelist a command, you add it to the Procfile:

migrate: bundle exec rake db:migrate:up

It's recommended that you use the extended Procfile and set the noservice: true flag to prevent it from being scaled up (and it won't create any AWS resources).

migrate:
  command: bundle exec rake db:migrate:up
  noservice: true

In this initial spike, it allows any command in the Procfile to be run. For example, if you use the new scheduled tasks, you can spin up a one off of the scheduled task easily like so:

scheduled-job:
  command: ./bin/do-work
  cron: * * * * * *
$ emp run scheduled-job
doing work

Any extra arguments will be appended to the command provided in the procfile. For example:

migrate:
  command: ./bin/migrate
  noservice: true
exec bundle exec rake db:migrate:$1
$ emp run migrate up

TODO

  • Tests

@phobologic
Copy link
Contributor

👍 positional args would be awesome.

@ejholmes ejholmes merged commit f5aa4a8 into master Aug 10, 2016
@ejholmes ejholmes deleted the whitelist-commands branch August 10, 2016 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants