Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 18th, 2012  |  syntax: None  |  size: 1.57 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. $ cat application/django.sls
  2. # Use a macro:
  3. # https://gist.github.com/2149546
  4.  
  5. # Don't include this in the top.sls, otherwise it will be run every time
  6. # highstate it scalled.
  7. # Do instead:
  8. # salt -G role:appserver state.sls application.django
  9. # salt-call state.sls some.statefile
  10.  
  11. {% set proj_name = 'reader.fm' %}
  12. {% set github_repo = 'git@github.com:bakodo/audiolyzer.git' %}
  13. {% set timestamp = salt['cmd.run']('date +%Y%m%d%H%M%S') %}
  14. {% set deploy_path = '/var/django/reader.fm/revisions' %}
  15. {% set id_rsa_deploy = '/home/django/.ssh/id_rsa_deploy_audiolyzer' %}
  16.  
  17. git:
  18.     pkg:
  19.         - installed
  20.         - name: git-core
  21.  
  22.  
  23. django:
  24.     user:
  25.         - present
  26.         - fullname: Django
  27.         - password:
  28.         - shell: /bin/bash
  29.         - home: /home/django # TODO: creates home dir owned by root:root
  30.         # - groups:
  31.            # - django
  32.            # - www-data
  33.  
  34. # create deploy dir
  35. {{ deploy_path }}:
  36.     file:
  37.         - directory
  38.         - makedirs: True
  39.         - user: django
  40.  
  41. # manage ssh deploy key
  42. {{ id_rsa_deploy }}:
  43.     file:
  44.         - managed
  45.         - source: salt://application/files/id_rsa_deploy_audiolyzer
  46.         - makedirs: True
  47.         - user: django
  48.         - group: django
  49.         - mode: 600
  50.        
  51. # lower our standards
  52. # TODO: do this on ~/.ssh/config
  53. echo "    StrictHostKeyChecking no" >> /etc/ssh/ssh_config:
  54.     cmd:
  55.         - run
  56.  
  57. # clone git repo
  58. git clone git@github:bakodo/audiolyzer.git {{ deploy_path }}/{{ timestamp }}:
  59.     cmd:
  60.         - run
  61.         - user: django
  62.  
  63.  
  64. # set up virtualenv