sglebs / ndeploy

Utility to deploy N microservices to N PaaS
2 stars 0 forks source link

Simulate Procfile support under OpenShift #6

Closed sglebs closed 8 years ago

sglebs commented 8 years ago

Unlike Heroku or dokku, OpenShift is a pain to support multiple command-lines for the same codebase. Example: WEB and CELERYD.

web: newrelic-admin run-program gunicorn -c gunicorn_config.py -w $WEB_WORKER_COUNT -k gevent --threads 50 --worker-connections $GUNICORN_WORKER_CONNECTIONS --timeout 29 --keep-alive 1 --backlog $GUNICORN_BACKLOG --log-syslog --log-syslog-prefix GUNICORN --log-level $LOGLEVEL --log-file=- --access-logfile=- restserver:application
celeryd: celery -A utils.celerydispatch worker --loglevel=debug --autoscale=5,1 -E
sglebs commented 8 years ago

This is how OpenShift chooses what to do for a Python app:

https://github.com/openshift/s2i-python/blob/master/3.3/s2i/bin/run

In other words, you can override env var APP_FILE , pointing at the file you need to run. So, for Python you can do it manually by including multiple .py files and tweaking APP_FILE.

sglebs commented 8 years ago

In order to support a Procfile i a generic manner, perhaps the RUN phase could be overridden? See https://docs.openshift.org/latest/dev_guide/builds.html#override-builder-image-scripts and https://docs.openshift.org/latest/creating_images/s2i.html#s2i-scripts

sglebs commented 8 years ago

Maybe our deployment script can add an extra synthetic file/script at the project's /s2i/bin/run which has the cmd-line in the Procfile? We would loop the lines in the Profile and, for each non-commented line, create an app under OpenShift and inject the cmd-line run script.