Skip to content

Instantly share code, notes, and snippets.

@eduardschaeli
Last active December 30, 2015 03:19
Show Gist options
  • Save eduardschaeli/7768601 to your computer and use it in GitHub Desktop.
Save eduardschaeli/7768601 to your computer and use it in GitHub Desktop.
Example config to run single processes in docker, managed by supervisord. This probably isn't the "right" way to do it, I haven't found a better solution online though. Keep in mind: Supervisor wants non-daemonized processes, which is why we run them with the -i flag. If you are running something like mysqld, be sure to use the pidproxy applicat…
# Example config to run single processes in docker, managed by
# supervisord.
#
# This probably isn't the "right" way to do it, I haven't
# found a better solution online though. Keep in mind, supervisor
# wants non-daemonized processes, which is why we run them with the
# -i flag. If you are running something like mysqld, be sure to use
# the pidproxy application as described here:
# http://supervisord.org/subprocess.html?highlight=pidproxy#pidproxy-program
#
# Add this file to /etc/supervisor/conf.d/whatever.conf
[program:mongodb]
# runs mongodb in interactive mode with a terminal, mpas ports and folders
# docker run -i -t -p HOST_PORT:GUEST_PORT -v HOST_FOLDER_MONGO_DATA:GUEST_FOLDER_MONGO_DATA mongodb /usr/bin/mongod --dbpath =GUEST_FOLDER_MONGO_DATA
command=/usr/bin/docker run -i -t -p 27017:27017 -v /data/locomotive-mongo:/mongo mongodb /usr/bin/mongod --dbpath=/mongo
stdout_logfile=/var/log/supervisor/wt-mongo.log
redirect_stderr=true
[program:locomotive-cms]
# runs a rails app with unicorn
# docker run -i -t -p HOST_PORT:GUEST_PORT -v HOST_FOLDER_RAILS_APP:GUEST_FOLDER_RAILS_APP /bin/bash --login -c '(cd GUEST_FOLDER_RAILS_APP && bundle exec unicorn_rails -E production)'
#
# alternative command without unicorn:
# command=/usr/bin/docker run -i -t -p 80:8080 -v /data/rails_apps/ws-locomotive:/rails-app wt/locomotive-engine /bin/bash --login -c '(cd /rails-app && bundle rails s)'
command=/usr/bin/docker run -i -t -p 80:8080 -v /data/rails_apps/ws-locomotive:/rails-app wt/locomotive-engine /bin/bash --login -c '(cd /rails-app && bundle exec unicorn_rails -E production)'
stdout_logfile=/var/log/supervisor/wt-locomotive.log
redirect_stderr=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment