Skip to content

Instantly share code, notes, and snippets.

@johtso
Created October 24, 2014 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johtso/b2904034b3a3c84d5fae to your computer and use it in GitHub Desktop.
Save johtso/b2904034b3a3c84d5fae to your computer and use it in GitHub Desktop.
# [DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/monolith_apps/monolith/init.sls:
include:
- python
- supervisor
- ssh_known_hosts
- users
- nginx
monolith_user:
group.present:
- name: monolith
user.present:
- name: monolith
- home: /apps/monolith
- createhome: False
- groups:
- monolith
- require:
- group: monolith
file.directory:
- name: /apps/monolith
- user: monolith
- group: monolith
- makedirs: True
- require:
- user: monolith
ssh_auth.present:
- name: ssh-rsa ...
- user: monolith
- enc: ssh-rsa
- require:
- user: monolith
monolith_virtualenv:
virtualenv.managed:
- name: /apps/monolith/venv
- user: monolith
- require:
- sls: python
- user: monolith_user
- file: monolith_user
pip.installed:
- name: pip==6.0.dev1
- index_url: ...
- bin_env: /apps/monolith/venv
- user: monolith
- require:
- sls: python
- virtualenv: monolith_virtualenv
monolith_code:
git.latest:
- name: ...
- rev: staging
- target: /apps/monolith/code
- force: True
- identity: /home/ubuntu/.ssh/id_rsa
- require:
- file: monolith_user
- sls: ssh_known_hosts
- sls: users
monolith_dependencies:
pip.installed:
- requirements: /apps/monolith/code/requirements/requirements.pip
- bin_env: /apps/monolith/venv
- user: monolith
- require:
- sls: python
- virtualenv: monolith_virtualenv
- git: monolith_code
- pip: monolith_virtualenv
- pkg: monolith_dependencies
pkg.installed:
- pkgs:
- libpq-dev
- libevent-dev
- libxslt1-dev
- libxml2-dev
- zlib1g-dev
- libyaml-dev
monolith_supervisor:
file.managed:
- name: /etc/supervisor/conf.d/monolith.conf
- template: jinja
- source: salt://monolith_apps/monolith/files/supervisor.conf
- context:
user: monolith
home: /apps/monolith
virtualenv_path: /apps/monolith/venv
code_dir: /apps/monolith/code
gunicorn_conf: '/apps/monolith/gunicorn.conf'
- require:
- sls: supervisor
supervisord.running:
- name: 'monolith:'
- update: True
- user: root
- watch:
- file: monolith_supervisor
- git: monolith_code
- pip: monolith_dependencies
- require:
- sls: supervisor
- file: monolith_supervisor
- git: monolith_code
- pip: monolith_dependencies
monolith_collectstatic:
module.wait:
- name: django.collectstatic
- settings_module: ...
- pythonpath: /apps/monolith/code
- bin_env: /apps/monolith/venv
- clear: True
- watch:
- git: monolith_code
- require:
- pip: monolith_dependencies
- file: monolith_collectstatic
file.directory:
- name: /apps/monolith/code/static-collected
- user: monolith
- require:
- git: monolith_code
monolith_migrate:
module.wait:
- name: django.syncdb
- settings_module: ...
- pythonpath: /apps/monolith/code
- bin_env: /apps/monolith/venv
- watch:
- git: monolith_code
- require:
- pip: monolith_dependencies
monolith_gunicorn_conf:
file.managed:
- name: /apps/monolith/gunicorn.conf
- template: jinja
- source: salt://monolith_apps/monolith/files/gunicorn.conf
- require:
- file: monolith_user
monolith_nginx:
file.managed:
- name: /etc/nginx/conf.d/monolith.conf
- source: salt://monolith_apps/monolith/files/nginx.conf
- template: jinja
- context:
code_dir: /apps/monolith/code
- require:
- sls: nginx
# Static compilation stuff
monolith_nodejs:
pkg.installed:
- pkgs:
- nodejs
- nodejs-legacy
- npm
monolith_requirejs:
npm.installed:
- name: requirejs
- require:
- pkg: monolith_nodejs
monolith_ruby_ppa:
pkgrepo.managed:
- ppa: brightbox/ruby-ng
monolith_ruby:
pkg.installed:
- pkgs:
- ruby2.1
- ruby2.1-dev
- require:
- pkgrepo: monolith_ruby_ppa
monolith_compass:
gem.installed:
- name: compass
- require:
- pkg: monolith_ruby
monolith_build_sass:
cmd.wait:
- name: compass compile
- cwd: /apps/monolith/code/webapp/static/webapp
- watch:
- git: monolith_code
- require:
- gem: monolith_compass
- watch_in:
- module: monolith_collectstatic
- require:
- gem: monolith_compass
monolith_build_js:
cmd.wait:
- name: r.js -o /apps/monolith/code/webapp/static/webapp/js/build/webapp.build.js
- watch:
- git: monolith_code
- watch_in:
- module: monolith_collectstatic
- require:
- npm: monolith_requirejs
monolith_cron:
file.managed:
- name: /apps/monolith/cron/cron.sh
- template: jinja
- makedirs: True
- context:
virtualenv_path: /apps/monolith/venv
code_dir: /apps/monolith/code
- require:
- user: monolith_user
cron.present:
- identifier: cron
- name: "..."
- user: monolith
- minute: 0
- hour: 0
- require:
- file: monolith_cron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment