salted-rails 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +65 -20
- data/init.sh +64 -0
- data/lib/salted-rails.rb +4 -6
- data/lib/salted-rails/capistrano_helper.rb +106 -0
- data/lib/salted-rails/cloud_vbguest_installer.rb +14 -0
- data/lib/salted-rails/config.rb +212 -0
- data/lib/salted-rails/helper_base.rb +90 -0
- data/lib/salted-rails/vagrant_helper.rb +159 -0
- data/lib/salted-rails/version.rb +3 -0
- data/lib/salted_rails_base.rb +6 -0
- data/pillar/capistrano/top.sls +1 -1
- data/pillar/common.sls +5 -0
- data/pillar/vagrant/top.sls +1 -1
- data/salt/bin/change_mirror.sh +29 -20
- data/salt/bin/fix_hostname.sh +6 -0
- data/salt/bin/provision +37 -0
- data/salt/capistrano/deploy_requirements.sls +5 -0
- data/salt/capistrano/minion +8 -4
- data/salt/capistrano/top.sls +1 -5
- data/salt/ci/cruisecontrolrb.sls +72 -0
- data/salt/ci/teamcity/etc/init.d/teamcity +17 -0
- data/salt/ci/teamcity/init.sls +58 -0
- data/salt/databases/client.sls +18 -0
- data/salt/{common.sls → databases/init.sls} +1 -16
- data/salt/databases/phpmyadmin/etc/nginx/{sites-available → admin.d}/phpmyadmin.conf +1 -1
- data/salt/databases/phpmyadmin/init.sls +2 -11
- data/salt/databases/server.sls +19 -0
- data/salt/editors/gvim.sls +5 -0
- data/salt/editors/rubymine.sls +51 -0
- data/salt/gui/init.sls +3 -0
- data/salt/gui/lxde.sls +5 -0
- data/salt/gui/x2go.sls +23 -0
- data/salt/lang/java/etc/profile.d/java.sh +2 -0
- data/salt/lang/java/init.sls +48 -0
- data/salt/lang/php/composer.sls +0 -3
- data/salt/lang/ruby.sls +3 -3
- data/salt/lang/ruby.sls.bak +3 -3
- data/salt/railsapp/gems.sls +16 -3
- data/salt/railsapp/init.sls +1 -0
- data/salt/railsapp/mysql_database.sls +11 -6
- data/salt/salt/minion/init.sls +19 -18
- data/salt/vagrant/minion +8 -4
- data/salt/vagrant/minion.sls +4 -5
- data/salt/vagrant/top.sls +32 -6
- data/salt/www/admin/etc/nginx/nginx.conf +53 -0
- data/salt/{databases/phpmyadmin → www/admin}/etc/nginx/sites-available/.gitignore +0 -0
- data/salt/www/admin/etc/nginx/sites-available/phpmyadmin.conf +7 -0
- data/salt/www/admin/init.sls +31 -0
- data/salt/www/nginx/init.sls +17 -4
- data/salt/www/users.sls +4 -0
- data/salted-rails.gemspec +1 -1
- metadata +30 -13
- data/lib/salted_rails/capistrano.rb +0 -8
- data/lib/salted_rails/vagrant_helper.rb +0 -169
- data/lib/salted_rails/version.rb +0 -5
- data/salt/capistrano.sls +0 -0
- data/salt/develop/init.sls +0 -3
- data/salt/echo_pillar.sls +0 -9
- data/salt/run-standalone +0 -3
- data/salt/vagrant.sls +0 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# /etc/init.d/teamcity - startup script for teamcity
|
3
|
+
export TEAMCITY_DATA_PATH="/var/TeamCity/.BuildServer"
|
4
|
+
. /etc/profile.d/java.sh
|
5
|
+
|
6
|
+
case $1 in
|
7
|
+
start)
|
8
|
+
start-stop-daemon --start -c www-data --exec /var/TeamCity/bin/runAll.sh start
|
9
|
+
;;
|
10
|
+
|
11
|
+
stop)
|
12
|
+
start-stop-daemon --start -c www-data --exec /var/TeamCity/bin/runAll.sh stop
|
13
|
+
;;
|
14
|
+
|
15
|
+
esac
|
16
|
+
|
17
|
+
exit 0
|
@@ -0,0 +1,58 @@
|
|
1
|
+
include:
|
2
|
+
- lang.java
|
3
|
+
- www.users
|
4
|
+
|
5
|
+
teamcity-download:
|
6
|
+
file.directory:
|
7
|
+
- name: /tmp/TeamCity
|
8
|
+
- makedirs: True
|
9
|
+
- user: www-data
|
10
|
+
- group: www-data
|
11
|
+
- require:
|
12
|
+
- sls: www.users
|
13
|
+
cmd.run:
|
14
|
+
- name: wget -c http://download.jetbrains.com/teamcity/TeamCity-{{ pillar['teamcity-version'] }}.tar.gz
|
15
|
+
- unless: test -d /var/TeamCity/bin
|
16
|
+
- cwd: /tmp
|
17
|
+
- user: www-data
|
18
|
+
- group: www-data
|
19
|
+
- require:
|
20
|
+
- file.directory: teamcity-download
|
21
|
+
|
22
|
+
teamcity-extract:
|
23
|
+
cmd.run:
|
24
|
+
- name: tar xfz /tmp/TeamCity-{{ pillar['teamcity-version'] }}.tar.gz
|
25
|
+
- cwd: /tmp/TeamCity
|
26
|
+
- user: www-data
|
27
|
+
- group: www-data
|
28
|
+
- require:
|
29
|
+
- cmd: teamcity-download
|
30
|
+
|
31
|
+
teamcity-install:
|
32
|
+
cmd.run:
|
33
|
+
- name: rm -rf /var/TeamCity && mv /tmp/TeamCity/* /var/TeamCity && rm -fr /tmp/TeamCity
|
34
|
+
- cwd: /tmp
|
35
|
+
- unless: test -d /var/TeamCity/bin
|
36
|
+
- require:
|
37
|
+
- cmd: teamcity-extract
|
38
|
+
|
39
|
+
teamcity-setup-service:
|
40
|
+
file.managed:
|
41
|
+
- name: {{ pillar['etc_dir'] }}/init.d/teamcity
|
42
|
+
- source: salt://ci/teamcity/etc/init.d/teamcity
|
43
|
+
- user: root
|
44
|
+
- group: root
|
45
|
+
- mode: 755
|
46
|
+
- require:
|
47
|
+
- cmd: teamcity-install
|
48
|
+
|
49
|
+
teamcity:
|
50
|
+
service:
|
51
|
+
- running
|
52
|
+
- enable: True
|
53
|
+
- reload: True
|
54
|
+
- watch:
|
55
|
+
- file: {{ pillar['etc_dir'] }}/init.d/teamcity
|
56
|
+
require:
|
57
|
+
- file: teamcity-setup-service
|
58
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
include:
|
3
|
+
# MySQL
|
4
|
+
{%- if ('mysql' in pillar['gems']) or ('mysql2' in pillar['gems']) %}
|
5
|
+
- databases.mysql.client
|
6
|
+
{%- endif %}
|
7
|
+
# PostgreSQL - TODO main alternative to mysql
|
8
|
+
# MongoDB - TODO Document database
|
9
|
+
# CouchDB - TODO json web distributed db
|
10
|
+
# Redis - TODO key value store
|
11
|
+
# Riak - TODO Distributed fault tolerant DB
|
12
|
+
# RabbitMQ - TODO message broker software
|
13
|
+
# Memcached - TODO Memory cache
|
14
|
+
# Cassandra - TODO distributed database management system
|
15
|
+
# Neo4J - TODO Graph database
|
16
|
+
# ElasticSearch - TODO search and analytics engine
|
17
|
+
# Kestrel - TODO light-weight persistent message queue
|
18
|
+
# SQLite3 - Included by default
|
@@ -1,9 +1,5 @@
|
|
1
|
+
|
1
2
|
include:
|
2
|
-
- apt.partner-sources
|
3
|
-
- apt.unwanted
|
4
|
-
- lang.ruby
|
5
|
-
- www.users
|
6
|
-
- www.nginx
|
7
3
|
# MySQL
|
8
4
|
{%- if ('mysql' in pillar['gems']) or ('mysql2' in pillar['gems']) %}
|
9
5
|
- databases.mysql
|
@@ -21,14 +17,3 @@ include:
|
|
21
17
|
# ElasticSearch - TODO search and analytics engine
|
22
18
|
# Kestrel - TODO light-weight persistent message queue
|
23
19
|
# SQLite3 - Included by default
|
24
|
-
- sysutils
|
25
|
-
- develop
|
26
|
-
- editors.vim
|
27
|
-
- sysutils.tmux
|
28
|
-
- railsapp
|
29
|
-
|
30
|
-
#- echo_pillar
|
31
|
-
|
32
|
-
# if GUI:
|
33
|
-
# www.chromium
|
34
|
-
|
@@ -9,19 +9,10 @@ phpmyadmin:
|
|
9
9
|
|
10
10
|
phpmyadmin_nginx:
|
11
11
|
file.managed:
|
12
|
-
- source: salt://databases/phpmyadmin/etc/nginx/
|
13
|
-
- name: {{ pillar['etc_dir'] }}nginx/
|
12
|
+
- source: salt://databases/phpmyadmin/etc/nginx/admin.d/phpmyadmin.conf
|
13
|
+
- name: {{ pillar['etc_dir'] }}nginx/admin.d/phpmyadmin.conf
|
14
14
|
- user: root
|
15
15
|
- group: root
|
16
16
|
- template: jinja
|
17
17
|
- mode: 644
|
18
|
-
host.present:
|
19
|
-
- name: phpmyadmin
|
20
|
-
- ip: 127.0.0.1
|
21
18
|
|
22
|
-
phpmyadmin_nginx-enable:
|
23
|
-
file.symlink:
|
24
|
-
- name: {{ pillar['etc_dir'] }}nginx/sites-enabled/phpmyadmin.conf
|
25
|
-
- target: {{ pillar['etc_dir'] }}nginx/sites-available/phpmyadmin.conf
|
26
|
-
- require:
|
27
|
-
- file: phpmyadmin_nginx
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
include:
|
3
|
+
# MySQL
|
4
|
+
{%- if ('mysql' in pillar['gems']) or ('mysql2' in pillar['gems']) %}
|
5
|
+
- databases.mysql.server
|
6
|
+
- databases.phpmyadmin
|
7
|
+
{%- endif %}
|
8
|
+
# PostgreSQL - TODO main alternative to mysql
|
9
|
+
# MongoDB - TODO Document database
|
10
|
+
# CouchDB - TODO json web distributed db
|
11
|
+
# Redis - TODO key value store
|
12
|
+
# Riak - TODO Distributed fault tolerant DB
|
13
|
+
# RabbitMQ - TODO message broker software
|
14
|
+
# Memcached - TODO Memory cache
|
15
|
+
# Cassandra - TODO distributed database management system
|
16
|
+
# Neo4J - TODO Graph database
|
17
|
+
# ElasticSearch - TODO search and analytics engine
|
18
|
+
# Kestrel - TODO light-weight persistent message queue
|
19
|
+
# SQLite3 - Included by default
|
@@ -0,0 +1,51 @@
|
|
1
|
+
include:
|
2
|
+
- lang.java
|
3
|
+
|
4
|
+
{{ pillar['homedir'] }}/local/tmp:
|
5
|
+
file.directory:
|
6
|
+
- makedirs: True
|
7
|
+
- clean: True
|
8
|
+
- user: {{ pillar['username'] }}
|
9
|
+
- group: {{ pillar['username'] }}
|
10
|
+
|
11
|
+
rubymine-download:
|
12
|
+
cmd.run:
|
13
|
+
- name: wget -c http://download.jetbrains.com/ruby/RubyMine-{{ pillar['rubymine-version'] }}.tar.gz
|
14
|
+
- cwd: {{ pillar['homedir'] }}/local
|
15
|
+
- user: {{ pillar['username'] }}
|
16
|
+
- group: {{ pillar['username'] }}
|
17
|
+
- unless: [ -d {{ pillar['homedir'] }}/local/RubyMine-{{ pillar['rubymine-version'] }} ]
|
18
|
+
- require:
|
19
|
+
- file.directory: {{ pillar['homedir'] }}/local/tmp
|
20
|
+
|
21
|
+
rubymine-extract:
|
22
|
+
cmd.run:
|
23
|
+
- name: tar xfz ../RubyMine-{{ pillar['rubymine-version'] }}.tar.gz
|
24
|
+
- cwd: {{ pillar['homedir'] }}/local/tmp
|
25
|
+
- user: {{ pillar['username'] }}
|
26
|
+
- group: {{ pillar['username'] }}
|
27
|
+
- unless: [ -d ../RubyMine-{{ pillar['rubymine-version'] }} ]
|
28
|
+
- require:
|
29
|
+
- cmd: rubymine-download
|
30
|
+
|
31
|
+
# The tar file contains extra version numbers in its top directory
|
32
|
+
rubymine-rename:
|
33
|
+
cmd.run:
|
34
|
+
- name: mv RubyMine-* ../RubyMine-{{ pillar['rubymine-version'] }}
|
35
|
+
- cwd: {{ pillar['homedir'] }}/local/tmp
|
36
|
+
- user: {{ pillar['username'] }}
|
37
|
+
- group: {{ pillar['username'] }}
|
38
|
+
- unless: [ -d ../RubyMine-{{ pillar['rubymine-version'] }} ]
|
39
|
+
- require:
|
40
|
+
- cmd: rubymine-extract
|
41
|
+
|
42
|
+
rubymine-adjust_profile:
|
43
|
+
file.append:
|
44
|
+
- name: {{ pillar['homedir'] }}/.profile
|
45
|
+
- user: {{ pillar['username'] }}
|
46
|
+
- group: {{ pillar['username'] }}
|
47
|
+
- text:
|
48
|
+
- export PATH="{{ pillar['homedir'] }}/RubyMine-{{ pillar['rubymine-version'] }}/bin:$PATH"
|
49
|
+
- require:
|
50
|
+
- cmd: rubymine-rename
|
51
|
+
|
data/salt/gui/init.sls
ADDED
data/salt/gui/lxde.sls
ADDED
data/salt/gui/x2go.sls
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
x2go:
|
2
|
+
pkgrepo.managed:
|
3
|
+
- humanname: X2Go PPA repository
|
4
|
+
- ppa: x2go/stable
|
5
|
+
pkg.installed:
|
6
|
+
- pkgs:
|
7
|
+
- x2goserver
|
8
|
+
- x2goserver-xsession
|
9
|
+
- require:
|
10
|
+
- pkgrepo: x2go
|
11
|
+
file.sed:
|
12
|
+
- name: /etc/ssh/sshd_config
|
13
|
+
- before: ^HostKey /etc/ssh/ssh_host_ecdsa_key
|
14
|
+
- after: "#HostKey /etc/ssh/ssh_host_ecdsa_key # not compatible with x2go"
|
15
|
+
- limit: ^HostKey
|
16
|
+
- require:
|
17
|
+
- pkg: x2go
|
18
|
+
|
19
|
+
ssh:
|
20
|
+
service.running:
|
21
|
+
- watch:
|
22
|
+
- file.sed: x2go
|
23
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#
|
2
|
+
# How to install automatically Oracle Java 7 under Salt Stack
|
3
|
+
#
|
4
|
+
# Thanks Oracle for complicating things :(
|
5
|
+
#
|
6
|
+
# 1. Create a java/ folder in your salt master
|
7
|
+
# 2. Paste this file in init.sls
|
8
|
+
# 3. salt '*' state.sls java
|
9
|
+
#
|
10
|
+
# Source:
|
11
|
+
# * https://github.com/log0ymxm/salt-jvm/blob/master/init.sls
|
12
|
+
# * http://architects.dzone.com/articles/puppet-installing-oracle-java
|
13
|
+
#
|
14
|
+
oracle-ppa:
|
15
|
+
pkgrepo.managed:
|
16
|
+
- humanname: WebUpd8 Oracle Java PPA repository
|
17
|
+
- ppa: webupd8team/java
|
18
|
+
|
19
|
+
oracle-license-select:
|
20
|
+
cmd.run:
|
21
|
+
- unless: which java
|
22
|
+
- name: '/bin/echo /usr/bin/debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections'
|
23
|
+
- require_in:
|
24
|
+
- pkg: oracle-java7-installer
|
25
|
+
- cmd: oracle-license-seen-lie
|
26
|
+
|
27
|
+
oracle-license-seen-lie:
|
28
|
+
cmd.run:
|
29
|
+
- name: '/bin/echo /usr/bin/debconf shared/accepted-oracle-license-v1-1 seen true | /usr/bin/debconf-set-selections'
|
30
|
+
- require_in:
|
31
|
+
- pkg: oracle-java7-installer
|
32
|
+
|
33
|
+
oracle-java7-installer:
|
34
|
+
pkg:
|
35
|
+
- installed
|
36
|
+
- require:
|
37
|
+
- pkgrepo: oracle-ppa
|
38
|
+
|
39
|
+
adjust_profile:
|
40
|
+
file.managed:
|
41
|
+
- name: /etc/profile.d/java.sh
|
42
|
+
- source: salt://lang/java/etc/profile.d/java.sh
|
43
|
+
- user: root
|
44
|
+
- group: root
|
45
|
+
- mode: 755
|
46
|
+
- require:
|
47
|
+
- pkg: oracle-java7-installer
|
48
|
+
|
data/salt/lang/php/composer.sls
CHANGED
data/salt/lang/ruby.sls
CHANGED
@@ -34,13 +34,13 @@ rbenv-deps:
|
|
34
34
|
|
35
35
|
ruby:
|
36
36
|
rbenv.installed:
|
37
|
-
- name: {{ pillar['
|
37
|
+
- name: {{ pillar['ruby_version'] }}
|
38
38
|
- default: True
|
39
39
|
- runas: {{ pillar['username'] }}
|
40
40
|
- require:
|
41
41
|
- pkg: rbenv-deps
|
42
42
|
|
43
|
-
adjust_profile:
|
43
|
+
rbenv-adjust_profile:
|
44
44
|
file.append:
|
45
45
|
- name: {{ pillar['homedir'] }}/.profile
|
46
46
|
- user: {{ pillar['username'] }}
|
@@ -57,4 +57,4 @@ base_gems:
|
|
57
57
|
- names:
|
58
58
|
- bundler
|
59
59
|
- require:
|
60
|
-
- file: adjust_profile
|
60
|
+
- file: rbenv-adjust_profile
|
data/salt/lang/ruby.sls.bak
CHANGED
@@ -73,7 +73,7 @@ adjust_profile:
|
|
73
73
|
#
|
74
74
|
|
75
75
|
# this is currently not working
|
76
|
-
# ruby-{{ pillar['
|
76
|
+
# ruby-{{ pillar['ruby_version'] }}:
|
77
77
|
# rbenv.installed:
|
78
78
|
# - default: True
|
79
79
|
# - require:
|
@@ -81,7 +81,7 @@ adjust_profile:
|
|
81
81
|
|
82
82
|
install_ruby:
|
83
83
|
cmd.run:
|
84
|
-
- name: {{ pillar['homedir'] }}/.rbenv/bin/rbenv install {{ pillar['
|
84
|
+
- name: {{ pillar['homedir'] }}/.rbenv/bin/rbenv install {{ pillar['ruby_version'] }}
|
85
85
|
- user: {{ pillar['username'] }}
|
86
86
|
- group: {{ pillar['username'] }}
|
87
87
|
- require:
|
@@ -97,7 +97,7 @@ rehash:
|
|
97
97
|
|
98
98
|
set-global:
|
99
99
|
cmd.run:
|
100
|
-
- name: {{ pillar['homedir'] }}/.rbenv/bin/rbenv global {{ pillar['
|
100
|
+
- name: {{ pillar['homedir'] }}/.rbenv/bin/rbenv global {{ pillar['ruby_version'] }}
|
101
101
|
- user: {{ pillar['username'] }}
|
102
102
|
- group: {{ pillar['username'] }}
|
103
103
|
- require:
|
data/salt/railsapp/gems.sls
CHANGED
@@ -1,17 +1,30 @@
|
|
1
1
|
include:
|
2
2
|
- lang.ruby
|
3
3
|
|
4
|
+
tmp_railsapp_gems:
|
5
|
+
file.directory:
|
6
|
+
- name: /tmp/railsapp_gems
|
7
|
+
- file_mode: 755
|
8
|
+
- user: {{ pillar['username'] }}
|
9
|
+
- group: {{ pillar['username'] }}
|
10
|
+
- makedirs: True
|
11
|
+
- clean: True
|
12
|
+
|
4
13
|
railsapp_gems:
|
5
14
|
file.recurse:
|
6
|
-
- source: salt://
|
7
|
-
- name: /tmp
|
15
|
+
- source: salt://files/
|
16
|
+
- name: /tmp/railsapp_gems
|
8
17
|
- file_mode: 644
|
9
18
|
- user: {{ pillar['username'] }}
|
19
|
+
- group: {{ pillar['username'] }}
|
20
|
+
- require:
|
21
|
+
- file.directory: tmp_railsapp_gems
|
10
22
|
cmd.run:
|
11
23
|
# Run twice if first fails (weirdness with installing ruby-debug)
|
12
24
|
- name: {{ pillar['homedir'] }}/.rbenv/shims/bundle install || {{ pillar['homedir'] }}/.rbenv/shims/bundle install
|
13
|
-
- cwd: /tmp
|
25
|
+
- cwd: /tmp/railsapp_gems
|
14
26
|
- user: {{ pillar['username'] }}
|
27
|
+
- group: {{ pillar['username'] }}
|
15
28
|
- require:
|
16
29
|
- file: railsapp_gems
|
17
30
|
- gem.installed: base_gems
|
data/salt/railsapp/init.sls
CHANGED
@@ -1,25 +1,30 @@
|
|
1
1
|
include:
|
2
2
|
- databases.mysql.server
|
3
3
|
|
4
|
+
{%- if ('development' in pillar['databases']) %}
|
5
|
+
|
4
6
|
database:
|
5
7
|
mysql_database.present:
|
6
8
|
- names:
|
7
|
-
- {{ pillar['
|
8
|
-
|
9
|
+
- {{ pillar['databases']['development']['database'] }}
|
10
|
+
{%- if ('test' in pillar['databases']) %}
|
11
|
+
- {{ pillar['databases']['test']['database'] }}
|
12
|
+
{%- endif %}
|
9
13
|
- require:
|
10
14
|
- service.running: mysql-server
|
11
15
|
- pkg: mysql-server
|
12
16
|
mysql_user:
|
13
17
|
- present
|
14
|
-
- name: {{ pillar['
|
15
|
-
- password: {{ pillar['
|
18
|
+
- name: {{ pillar['databases']['development']['username'] }}
|
19
|
+
- password: {{ pillar['databases']['development']['password'] }}
|
16
20
|
- require:
|
17
21
|
- mysql_database.present: database
|
18
22
|
mysql_grants.present:
|
19
|
-
- database: {{ pillar['
|
23
|
+
- database: {{ pillar['databases']['development']['username'] }}_%.*
|
20
24
|
- grant: ALL PRIVILEGES
|
21
|
-
- user: {{ pillar['
|
25
|
+
- user: {{ pillar['databases']['development']['username'] }}
|
22
26
|
- host: localhost
|
23
27
|
- require:
|
24
28
|
- mysql_user.present: database
|
25
29
|
|
30
|
+
{%- endif %}
|