Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. jcigar@dev:/usr/local/etc/salt/states/webapps/files/ > more supervise.jinja
  2. #!/bin/sh
  3.  
  4. {% if cfg.venv.lang == 'ruby' -%}
  5. exec setuidgid {{ cfg.user }} \
  6. /bin/sh -c '
  7. {% block export -%}
  8. export RBENV_ROOT="{{ cfg.venv.full_path }}"
  9. {% if 'rails' in cfg.use -%}
  10. export RAILS_ENV="{{ cfg.deploy.env }}"
  11. {%- endif %}
  12. {%- endblock %}
  13. eval "$(rbenv init -)"
  14. rbenv shell {{ cfg.venv.ruby_version }}
  15. cd {{ cfg.repo.clone_dir }}
  16. {%- if cfg.deploy.env == 'production' %}
  17. bundle exec
  18. {%- endif -%}
  19. {% if 'unicorn' in cfg.use -%}
  20. {{ cfg.unicorn.bin }} -E {{ cfg.deploy.env }} -c {{ cfg.unicorn_config._fullpath }} --path {{ cfg.deploy.prefix }}
  21. {%- elif 'thin' in cfg.use -%}
  22. {{ cfg.thin.bin }} -c {{ cfg.repo.clone_dir }} -a {{ cfg.deploy.host }} -e {{ cfg.deploy.env }} -p {{ cfg.deploy.port }} --prefix {{ cfg.deploy.prefix }} start
  23. {%- endif %}'
  24. {% elif cfg.venv.lang == 'python' -%}
  25. cd {{ cfg.repo.clone_dir }}
  26. exec setuidgid {{ cfg.user }} \
  27. {% if 'pylons' in cfg.use -%}
  28. /bin/sh -c ". {{ cfg.venv.activate }} && {{ cfg.pylons.bin }} {{ cfg.paste_deploy._fullpath }}"
  29. {% elif 'pyramid' in cfg.use -%}
  30. /bin/sh -c ". {{ cfg.venv.activate }} && {{ cfg.pyramid.bin }} {{ cfg.paste_deploy._fullpath }}"
  31. {% elif 'django' and 'gunicorn' in cfg.use -%}
  32. /bin/sh -c '. {{ cfg.venv.activate }} && {{ cfg.gunicorn.bin }} -b "{{ cfg.deploy.host }}:{{ cfg.deploy.port }}" --error-logfile "{{ cfg.gunicorn.error_log_file }}" -k {{ cfg.gunicorn.worker_class }} --max-requests 10000 --threads {{ cfg.deploy.threads }} --workers {{ cfg.deploy.proc }} --chdir "{{ cfg.repo.clone_dir }}" --backlog {{ cfg.deploy.backlog }} {% for ek, ev in cfg.deploy.env_vars.items() %}-e {{ ek }}="{{ ev }}" {% endfor -%} {{ cfg.django.config.app_module }}'
  33. {%- endif %}
  34. {%- endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement