salted-rails 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/README.md +7 -0
  2. data/lib/salted-rails/config.rb +71 -55
  3. data/lib/salted-rails/helper_base.rb +15 -0
  4. data/lib/salted-rails/vagrant_helper.rb +15 -9
  5. data/lib/salted-rails/version.rb +1 -1
  6. data/pillar/capistrano/top.sls +1 -1
  7. data/pillar/common.sls +1 -8
  8. data/pillar/vagrant/top.sls +1 -1
  9. data/salt/apt/load_packages.sls +5 -0
  10. data/salt/apt/update_packages.sls +5 -0
  11. data/salt/bin/change_mirror.sh +10 -6
  12. data/salt/bin/misc_fixes.sh +26 -0
  13. data/salt/bin/provision +40 -3
  14. data/salt/ci/cruisecontrolrb.sls +17 -11
  15. data/salt/ci/teamcity/etc/init.d/teamcity +4 -4
  16. data/salt/ci/teamcity/init.sls +18 -18
  17. data/salt/crons/init.sls +2 -2
  18. data/salt/databases/init.sls +45 -14
  19. data/salt/databases/mysql/client.sls +1 -1
  20. data/salt/databases/mysql/common.sls +3 -3
  21. data/salt/databases/mysql/server.sls +1 -1
  22. data/salt/databases/packages.sls +47 -0
  23. data/salt/databases/phpmyadmin/etc/nginx/admin.d/phpmyadmin.conf +10 -7
  24. data/salt/databases/postgresql/client.sls +5 -0
  25. data/salt/databases/postgresql/init.sls +10 -0
  26. data/salt/databases/sqlite3.sls +6 -0
  27. data/salt/databases/sqlitebrowser.sls +4 -0
  28. data/salt/editors/gvim.sls +5 -1
  29. data/salt/editors/rubymine.sls +16 -16
  30. data/salt/editors/vim/init.sls +71 -2
  31. data/salt/editors/vim/vimrc +8 -1
  32. data/salt/gui/desktop.sls +9 -0
  33. data/salt/gui/x2go.sls +5 -0
  34. data/salt/lang/jenv.sls +64 -0
  35. data/salt/lang/php/etc/php5/fpm/pool.d/www.conf +2 -2
  36. data/salt/lang/phpenv.sls +82 -0
  37. data/salt/lang/rbenv.sls +115 -0
  38. data/salt/lang/ruby.sls +24 -37
  39. data/salt/munin/nginx.sls +3 -1
  40. data/salt/munin/node.sls +2 -1
  41. data/salt/munin/php5-fpm.sls +3 -1
  42. data/salt/net/hosts.sls +9 -0
  43. data/salt/net/ntp.sls +6 -0
  44. data/salt/net/ufw.sls +8 -0
  45. data/salt/railsapp/gems.sls +5 -3
  46. data/salt/railsapp/init.sls +6 -2
  47. data/salt/scm/bazaar.sls +10 -0
  48. data/salt/scm/git/gitconfig +42 -0
  49. data/salt/scm/git/init.sls +21 -0
  50. data/salt/scm/init.sls +5 -0
  51. data/salt/scm/mercurial.sls +10 -0
  52. data/salt/scm/subversion.sls +6 -0
  53. data/salt/{vagrant/top.sls → top.sls} +24 -9
  54. data/salt/utils/file.sls +19 -0
  55. data/salt/utils/html.sls +5 -0
  56. data/salt/utils/init.sls +6 -0
  57. data/salt/{sysutils → utils}/net.sls +4 -0
  58. data/salt/{sysutils → utils}/status.sls +0 -0
  59. data/salt/utils/tmux/home/tmux-dev +7 -0
  60. data/salt/utils/tmux/home/tmux.conf +89 -0
  61. data/salt/utils/tmux/init.sls +32 -0
  62. data/salt/vagrant/minion.sls +1 -1
  63. data/salt/www/chromium.sls +5 -0
  64. data/salt/www/nginx/etc/nginx/admin.d/doc.conf +7 -0
  65. data/salt/www/nginx/etc/nginx/admin.d/nginx_status.conf +7 -0
  66. data/salt/www/nginx/etc/nginx/sites-available/.gitignore +3 -0
  67. data/salt/www/nginx/etc/nginx/sites-available/admin.conf +47 -0
  68. data/salt/www/nginx/init.sls +102 -16
  69. data/salt/www/nginx/srv/www/admin/favicon.ico +0 -0
  70. data/salt/www/nginx/srv/www/admin/favicon.png +0 -0
  71. data/salt/www/nginx/srv/www/admin/index.php +67 -0
  72. data/salt/www/nginx/srv/www/admin/phpinfo.php +3 -0
  73. data/salt/www/nginx/srv/www/admin/robots.txt +2 -0
  74. data/salt/www/users.sls +0 -9
  75. metadata +41 -20
  76. data/salt/bin/fix_hostname.sh +0 -6
  77. data/salt/capistrano/deploy_requirements.sls +0 -5
  78. data/salt/capistrano/top.sls +0 -4
  79. data/salt/databases/client.sls +0 -18
  80. data/salt/databases/server.sls +0 -19
  81. data/salt/gui/init.sls +0 -3
  82. data/salt/lang/ruby.sls.bak +0 -106
  83. data/salt/lang/system_ruby.sls +0 -43
  84. data/salt/sysutils/file.sls +0 -8
  85. data/salt/sysutils/init.sls +0 -5
  86. data/salt/sysutils/tmux.sls +0 -3
  87. data/salt/www/admin/etc/nginx/nginx.conf +0 -53
  88. data/salt/www/admin/etc/nginx/sites-available/.gitignore +0 -3
  89. data/salt/www/admin/etc/nginx/sites-available/phpmyadmin.conf +0 -7
  90. data/salt/www/admin/init.sls +0 -31
@@ -0,0 +1,6 @@
1
+
2
+ ntp:
3
+ pkg.installed:
4
+ - pkgs:
5
+ - ntp
6
+ - ntpdate
@@ -0,0 +1,8 @@
1
+
2
+ ufw:
3
+ pkg.installed:
4
+ - pkgs:
5
+ - ufw
6
+ {%- if 'gui' in pillar['roles'] %}
7
+ - gufw
8
+ {%- endif %}
@@ -1,5 +1,5 @@
1
1
  include:
2
- - lang.ruby
2
+ - lang.rbenv
3
3
 
4
4
  tmp_railsapp_gems:
5
5
  file.directory:
@@ -9,6 +9,8 @@ tmp_railsapp_gems:
9
9
  - group: {{ pillar['username'] }}
10
10
  - makedirs: True
11
11
  - clean: True
12
+ - require:
13
+ - sls: lang.rbenv
12
14
 
13
15
  railsapp_gems:
14
16
  file.recurse:
@@ -17,15 +19,15 @@ railsapp_gems:
17
19
  - file_mode: 644
18
20
  - user: {{ pillar['username'] }}
19
21
  - group: {{ pillar['username'] }}
22
+ - exclude_pat: '.*swp'
20
23
  - require:
21
24
  - file.directory: tmp_railsapp_gems
22
25
  cmd.run:
23
26
  # Run twice if first fails (weirdness with installing ruby-debug)
24
- - name: {{ pillar['homedir'] }}/.rbenv/shims/bundle install || {{ pillar['homedir'] }}/.rbenv/shims/bundle install
27
+ - name: bundle install || bundle install
25
28
  - cwd: /tmp/railsapp_gems
26
29
  - user: {{ pillar['username'] }}
27
30
  - group: {{ pillar['username'] }}
28
31
  - require:
29
32
  - file: railsapp_gems
30
- - gem.installed: base_gems
31
33
 
@@ -1,7 +1,11 @@
1
1
  include:
2
- - databases
2
+ - databases.packages
3
3
  - railsapp.packages
4
+ {%- if ('app' in pillar['roles']) %}
5
+ {%- if 'ruby' in pillar['versions'] %}
4
6
  - railsapp.gems
5
- {%- if ('mysql' in pillar['gems']) or ('mysql2' in pillar['gems']) %}
7
+ {%- endif %}
8
+ {%- endif %}
9
+ {%- if ('mysql' in pillar['roles']) %}
6
10
  - railsapp.mysql_database
7
11
  {%- endif %}
@@ -0,0 +1,10 @@
1
+
2
+ bazaar:
3
+ pkg.installed:
4
+ - pkgs:
5
+ - bzr
6
+ - bzrtools
7
+ {%- if 'gui' in pillar['roles'] %}
8
+ - qbzr
9
+ - bzr-explorer
10
+ {%- endif %}
@@ -0,0 +1,42 @@
1
+ [core]
2
+ autocrlf=input
3
+ safecrlf=true
4
+ # Thanks to http://git.or.cz/gitwiki/Aliases
5
+ [alias]
6
+ ci = commit
7
+ co = checkout
8
+ st = status
9
+ br = branch
10
+ me = merge
11
+ # usage: git chmod +x file,...
12
+ chmod=update-index --chmod
13
+ staged = diff --cached
14
+ unstaged = diff
15
+ both = diff HEAD
16
+ oneline = log --oneline
17
+ abbrev = rev-parse --short
18
+ nmm = branch -a --no-merged master
19
+ nmr = branch -a --no-merged release_candidate
20
+ nme = branch -a --no-merged edge
21
+ merge-no-ff = merge --no-ff
22
+ edit-unmerged = "!fgit() { git ls-files --unmerged | cut -f2 | sort -u ; }; gvim `fgit`"
23
+ add-unmerged = "!fgit() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `fgit`"
24
+ [color]
25
+ branch = auto
26
+ diff = auto
27
+ interactive = auto
28
+ status = auto
29
+ [log]
30
+ decorate = short
31
+ [gui]
32
+ spellingdictionary = en_GB
33
+ [push]
34
+ # later versions have simple - push only the current branch to the one that git pull would pull from (use --all for all branches when pulling or pushing)
35
+ # git on LTS ubuntu doesn't have it
36
+ default = matching
37
+ [merge]
38
+ # Show what we are changing from as well as the two options
39
+ conflictstyle = diff3
40
+ [diff]
41
+ # match on unique lines first so we are less likely to get weird diffs matching lines with just braces etc
42
+ algorithm = patience
@@ -0,0 +1,21 @@
1
+ git:
2
+ pkg.installed:
3
+ - pkgs:
4
+ - git
5
+ {%- if 'gui' in pillar['roles'] %}
6
+ - git-gui
7
+ - gitk
8
+ - qgit
9
+ {%- endif %}
10
+ file.managed:
11
+ - source: salt://scm/git/gitconfig
12
+ - name: {{ pillar['homedir'] }}/.gitconfig
13
+ - user: {{ pillar['username'] }}
14
+ - group: {{ pillar['username'] }}
15
+ - template: jinja
16
+ - replace: false
17
+ - mode: 644
18
+ - require:
19
+ - pkg: git
20
+
21
+ # consider git-web, but may need to force www.nginx to make sure apache doesnt get loaded
@@ -0,0 +1,5 @@
1
+ include:
2
+ - scm.bazaar
3
+ - scm.git
4
+ - scm.mercurial
5
+ - scm.subversion
@@ -0,0 +1,10 @@
1
+
2
+ mercurial:
3
+ pkg.installed:
4
+ - pkgs:
5
+ - mercurial
6
+ - mercurial-git
7
+ {%- if 'gui' in pillar['roles'] %}
8
+ - qct
9
+ - hgview
10
+ {%- endif %}
@@ -0,0 +1,6 @@
1
+
2
+ subversion:
3
+ pkg.installed:
4
+ - pkgs:
5
+ - subversion
6
+ - subversion-tools
@@ -1,17 +1,29 @@
1
1
  base:
2
2
  '*':
3
3
  - apt.partner-sources
4
- - vagrant.minion
5
4
  - apt.unwanted
5
+ - apt.load_packages
6
+ - vagrant.minion
6
7
  - www.users
7
- - sysutils
8
- - capistrano/deploy_requirements
8
+ - utils
9
+ - crons
10
+ - net.hosts
11
+ - net.ntp
12
+ - net.ufw
13
+ - scm
9
14
  - editors.vim
10
- - sysutils.tmux
11
- {%- if 'app' in pillar['roles'] %}
12
- - databases.client
13
15
  - lang.ruby
16
+ {%- if ('ruby' in pillar['versions']) %}
17
+ - lang.rbenv
14
18
  - railsapp
19
+ {%- endif %}
20
+ - lang.php
21
+ {%- if ('php' in pillar['versions']) %}
22
+ - lang.phpenv
23
+ {%- endif %}
24
+ #- lang.java # - require if we load jenv or java programs
25
+ {%- if ('java' in pillar['versions']) %}
26
+ - lang.jenv
15
27
  {%- endif %}
16
28
  {%- if 'web' in pillar['roles'] %}
17
29
  - www.nginx
@@ -20,13 +32,16 @@ base:
20
32
  - databases
21
33
  {%- endif %}
22
34
  {%- if 'gui' in pillar['roles'] %}
23
- - gui.lxde
35
+ # lxde
36
+ - gui.desktop
24
37
  - gui.x2go
25
38
  - editors.gvim
26
- - editors.rubymine
27
39
  - www.chromium
28
40
  {%- endif %}
29
- {%- if 'teamcity' in pillar['roles'] %}
41
+ {%- if 'rubymine' in pillar['versions'] %}
42
+ - editors.rubymine
43
+ {%- endif %}
44
+ {%- if 'teamcity' in pillar['versions'] %}
30
45
  - ci.teamcity
31
46
  {%- endif %}
32
47
  {%- if 'cruisecontrolrb' in pillar['roles'] %}
@@ -0,0 +1,19 @@
1
+ # Optional packages
2
+ file:
3
+ pkg.installed:
4
+ - pkgs:
5
+ - gzip
6
+ - unzip
7
+ - saidar
8
+ - less
9
+ - meld
10
+ - p7zip
11
+ - p7zip-full
12
+ {%- if 'gui' in pillar['roles'] %}
13
+ - pinta
14
+ {%- endif %}
15
+ - unrar-free
16
+ # Available only in later ubuntu releases?
17
+ #- p7zip-rar
18
+ #- rar
19
+ #- unrar
@@ -0,0 +1,5 @@
1
+ # Optional packages
2
+ html:
3
+ pkg.installed:
4
+ - pkgs:
5
+ - tidy
@@ -0,0 +1,6 @@
1
+ include:
2
+ - utils.file
3
+ - utils.html
4
+ - utils.net
5
+ - utils.status
6
+ - utils.tmux
@@ -7,3 +7,7 @@ net:
7
7
  - lynx-cur
8
8
  - wget
9
9
  - curl
10
+ {%- if 'gui' in pillar['roles'] %}
11
+ - filezilla
12
+ {%- endif %}
13
+
File without changes
@@ -0,0 +1,7 @@
1
+ # Setup dev environment ...
2
+ selectp -t 0 # select the first (0) pane
3
+ splitw -h -p 50 # split it into two halves
4
+
5
+ selectp -t 1 # select the new, second (1) pane
6
+ splitw -v -p 50 # split it into two halves
7
+ selectp -t 0 # go back to the first pane
@@ -0,0 +1,89 @@
1
+ # Thanks http://lukaszwrobel.pl/blog/tmux-tutorial-split-terminal-windows-easily
2
+
3
+ # ctrl-A for commads
4
+ unbind C-b
5
+ set -g prefix C-a
6
+
7
+ # Alt-arrow for switching panes
8
+ bind -n M-Left select-pane -L
9
+ bind -n M-Right select-pane -R
10
+ bind -n M-Up select-pane -U
11
+ bind -n M-Down select-pane -D
12
+
13
+ # Highlight active windows
14
+ setw -g monitor-activity on
15
+ set -g visual-activity on
16
+
17
+ # highlight current windows (with yello)
18
+ set-window-option -g window-status-current-bg yellow
19
+
20
+ # ctrl-b D - use dev layout
21
+ bind D source-file ~/.tmux/dev
22
+
23
+ # Thanks http://justinlilly.com/dotfiles/tmux.html
24
+ set -g base-index 1
25
+
26
+ set -g history-limit 100000
27
+
28
+ unbind r
29
+ bind-key r source-file ~/.tmux.conf
30
+ unbind S
31
+ bind-key S command-prompt -p ssh: "new-window -n %1 'ssh %1'"
32
+ unbind |
33
+ bind-key | split-window -h
34
+ unbind _
35
+ bind-key _ split-window -v
36
+
37
+ setw -g aggressive-resize on
38
+
39
+ set-option -g bell-action any
40
+ set-option -g visual-bell off
41
+
42
+ set-option -g set-titles on
43
+ set-option -g set-titles-string '#H:#S.#I.#P #W #T' # window number,program name, active(or not)
44
+
45
+ #setw -g mode-mouse on
46
+ #set-option -g mouse-select-pane on
47
+
48
+ # Thanks
49
+ # http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/
50
+
51
+ set -g mode-mouse on
52
+ set -g mouse-resize-pane on
53
+ set -g mouse-select-pane on
54
+ set -g mouse-select-window on
55
+
56
+ # Toggle mouse on with ^B m
57
+ bind m \
58
+ set -g mode-mouse on \;\
59
+ set -g mouse-resize-pane on \;\
60
+ set -g mouse-select-pane on \;\
61
+ set -g mouse-select-window on \;\
62
+ display 'Mouse: ON'
63
+
64
+ # Toggle mouse off with ^B M
65
+ bind M \
66
+ set -g mode-mouse off \;\
67
+ set -g mouse-resize-pane off \;\
68
+ set -g mouse-select-pane off \;\
69
+ set -g mouse-select-window off \;\
70
+ display 'Mouse: OFF'
71
+
72
+ unbind +
73
+ bind + \
74
+ new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \;\
75
+ swap-pane -s tmux-zoom.0 \;\
76
+ select-window -t tmux-zoom
77
+
78
+ unbind -
79
+ bind - \
80
+ last-window \;\
81
+ swap-pane -s tmux-zoom.0 \;\
82
+ kill-window -t tmux-zoom
83
+
84
+
85
+ # Thanks http://jasonwryan.com/blog/2011/06/07/copy-and-paste-in-tmux/
86
+
87
+ unbind p
88
+ bind p paste-buffer
89
+
@@ -0,0 +1,32 @@
1
+ tmux:
2
+ pkg:
3
+ - installed
4
+ file.directory:
5
+ - name: {{ pillar['homedir'] }}/.tmux
6
+ - user: {{ pillar['username'] }}
7
+ - group: {{ pillar['username'] }}
8
+ - mode: 755
9
+ - require_in:
10
+ - pkg: tmux
11
+
12
+ tmux-conf:
13
+ file.managed:
14
+ - name: {{ pillar['homedir'] }}/.tmux.conf
15
+ - source: salt://utils/tmux/home/tmux.conf
16
+ - user: {{ pillar['username'] }}
17
+ - group: {{ pillar['username'] }}
18
+ #- template: jinja
19
+ - mode: 644
20
+ - require:
21
+ - pkg: tmux
22
+
23
+ tmux-dev:
24
+ file.managed:
25
+ - name: {{ pillar['homedir'] }}/.tmux/dev
26
+ - source: salt://utils/tmux/home/tmux-dev
27
+ - user: {{ pillar['username'] }}
28
+ - group: {{ pillar['username'] }}
29
+ #- template: jinja
30
+ - mode: 644
31
+ - require:
32
+ - file.directory: tmux
@@ -1,5 +1,5 @@
1
1
  minion:
2
- file.provision:
2
+ file.managed:
3
3
  - source: salt://vagrant/minion
4
4
  - name: /etc/salt/minion
5
5
  - mode: 644
@@ -1,6 +1,11 @@
1
+ include:
2
+ - gui.desktop
3
+
1
4
  chromium-browser:
2
5
  pkg.installed:
3
6
  - names:
4
7
  - chromium-browser
5
8
  - chromium-codecs-ffmpeg
6
9
  - chromium-codecs-ffmpeg-extra
10
+ - require:
11
+ - sls: gui.desktop
@@ -0,0 +1,7 @@
1
+
2
+ location /doc/ {
3
+ alias /usr/share/doc/;
4
+ autoindex on;
5
+ #allow 127.0.0.1;
6
+ #deny all;
7
+ }
@@ -0,0 +1,7 @@
1
+ location /nginx_status {
2
+ # copied from http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/
3
+ stub_status on;
4
+ access_log off;
5
+ #allow 127.0.0.0/8;
6
+ #deny all;
7
+ }
@@ -0,0 +1,3 @@
1
+ *
2
+ !.gitignore
3
+ !admin.conf