kopia lustrzana https://github.com/piku/piku
Added "preflight" worker
rodzic
7eae80a795
commit
23159ddde8
|
@ -21,6 +21,7 @@ An app is simply a `git` repository with some additional files on the top level,
|
|||
* `wsgi` workers, in the format `dotted.module:entry_point` (Python-only)
|
||||
* `web` workers, which can be anything that honors the `PORT` environment variable
|
||||
* `static` workers, which simply mount the first argument as the root static path
|
||||
* `preflight` which is a special "worker" that is run once _before_ the app is deployed _and_ installing deps (can be useful for cleanups).
|
||||
* `release` which is a special worker that is run once when the app is deployed, after installing deps (can be useful for build steps).
|
||||
* `cron` workers, which require a simplified `cron` expression preceding the command to be run (e.g. `cron: */5 * * * * python batch.py` to run a batch every 5 minutes)
|
||||
* `worker` processes, which are standalone workers and can have arbitrary names
|
||||
|
|
8
piku.py
8
piku.py
|
@ -385,6 +385,13 @@ def do_deploy(app, deltas={}, newrev=None):
|
|||
workers = parse_procfile(procfile)
|
||||
if workers and len(workers) > 0:
|
||||
settings = {}
|
||||
if "preflight" in workers:
|
||||
echo("-----> Running preflight.", fg='green')
|
||||
retval = call(workers["preflight"], cwd=app_path, env=settings, shell=True)
|
||||
if retval:
|
||||
echo("-----> Exiting due to preflight command error value: {}".format(retval))
|
||||
exit(retval)
|
||||
workers.pop("preflight", None)
|
||||
if exists(join(app_path, 'requirements.txt')) and found_app("Python"):
|
||||
settings.update(deploy_python(app, deltas))
|
||||
elif exists(join(app_path, 'Gemfile')) and found_app("Ruby Application") and check_requirements(['ruby', 'gem', 'bundle']):
|
||||
|
@ -687,6 +694,7 @@ def spawn_app(app, deltas={}):
|
|||
app_path = join(APP_ROOT, app)
|
||||
procfile = join(app_path, 'Procfile')
|
||||
workers = parse_procfile(procfile)
|
||||
workers.pop("preflight", None)
|
||||
workers.pop("release", None)
|
||||
ordinals = defaultdict(lambda: 1)
|
||||
worker_count = {k: 1 for k in workers.keys()}
|
||||
|
|
Ładowanie…
Reference in New Issue