linux_provision 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.linux_provision.json +3 -3
- data/CHANGES +4 -0
- data/Gemfile +8 -5
- data/Gemfile.lock +57 -9
- data/README.md +129 -35
- data/Vagrantfile +1 -1
- data/demo/.ruby-gemset +1 -0
- data/demo/.ruby-version +1 -0
- data/demo/Dockerfile +107 -0
- data/demo/Gemfile +7 -0
- data/demo/Gemfile.lock +45 -0
- data/demo/Rakefile +7 -0
- data/demo/app.rb +29 -0
- data/demo/bin/start-server.sh +7 -0
- data/demo/config.ru +3 -0
- data/demo/db/migrate/20140610203958_create_notes.rb +14 -0
- data/demo/db/migrate/20140610204302_add_notes.rb +7 -0
- data/demo/db/schema.rb +26 -0
- data/demo/db_setup.rb +11 -0
- data/demo/note.rb +2 -0
- data/demo/supervisord.conf +8 -0
- data/demo/views/index.erb +10 -0
- data/demo/views/layout.erb +8 -0
- data/demo/views/new.erb +12 -0
- data/demo/views/note.erb +3 -0
- data/docker/postgres/Dockerfile +61 -0
- data/docker/postgres/bin/create_db.sh +14 -0
- data/docker/sshd/Dockerfile +28 -0
- data/docker/supervisord/Dockerfile +28 -0
- data/docker/supervisord/supervisord.conf +8 -0
- data/lib/linux_provision/generic_provision.rb +28 -19
- data/lib/linux_provision/linux_provision.rb +7 -165
- data/lib/linux_provision/linux_provision_scripts.sh +65 -21
- data/lib/linux_provision/version.rb +1 -1
- data/presentation/virtualization/01-vagrant/slides.md +381 -0
- data/presentation/virtualization/02-provision/slides.md +400 -0
- data/presentation/virtualization/03-docker/slides.md +208 -0
- data/presentation/virtualization/04-conclusion/slides.md +36 -0
- data/presentation/virtualization/default.css +59 -0
- data/presentation/virtualization/default.tpl +2 -0
- data/presentation/virtualization/images/chef.jpg +0 -0
- data/presentation/virtualization/images/provisioning.jpg +0 -0
- data/presentation/virtualization/images/vagrant.jpg +0 -0
- data/presentation/virtualization/showoff.json +23 -0
- data/presentation/virtualization/simple.tpl +2 -0
- data/spec/linux_install_spec.rb +9 -2
- data/spec/linux_provision_spec.rb +1 -1
- data/stats/viewstats.json +1 -0
- data/thor/demo_scripts.sh +34 -0
- data/thor/docker.thor +31 -0
- data/thor/linux_install.thor +17 -115
- metadata +40 -2
@@ -0,0 +1,36 @@
|
|
1
|
+
!SLIDE title-and_content transition=cover
|
2
|
+
|
3
|
+
# Links
|
4
|
+
|
5
|
+
* [VirtualBox - *https://www.virtualbox.org/wiki/Downloads*](https://www.virtualbox.org/wiki/Downloads)
|
6
|
+
* [Vagrant - *http://www.vagrantup.com*](http://www.vagrantup.com)
|
7
|
+
* [Chef - *http://www.opscode.com*](http://www.opscode.com)
|
8
|
+
* [Chef Wiki - *http://wiki.opscode.com/display/chef/Home*](http://wiki.opscode.com/display/chef/Home)
|
9
|
+
* [Chef Public Cookbooks - *https://github.com/opscode-cookbooks*](https://github.com/opscode-cookbooks)
|
10
|
+
* [Setup multiple servers easily with Chef - *http://www.synbioz.com/blog/setup_multiple_servers_easily_with_chef*](http://www.synbioz.com/blog/setup_multiple_servers_easily_with_chef)
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
!SLIDE title-and-content transition=cover
|
15
|
+
|
16
|
+
# Links (continued)
|
17
|
+
|
18
|
+
* [OS X Workstation Management With Chef - *http://jtimberman.housepub.org/blog/2012/07/29/os-x-workstation-management-with-chef*](http://jtimberman.housepub.org/blog/2012/07/29/os-x-workstation-management-with-chef)
|
19
|
+
* [Puppet - *http://puppetlabs.com*](http://puppetlabs.com)
|
20
|
+
* [Getting Started with Chef Server - *http://leopard.in.ua*](http://leopard.in.ua)
|
21
|
+
* [Vagrant+Puppet presentation - *https://github.com/crohr/vagrant-presentation*](https://github.com/crohr/vagrant-presentation)
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
!SLIDE content transition=cover
|
26
|
+
|
27
|
+
>
|
28
|
+
|
29
|
+
* Thank You!
|
30
|
+
* Hola!
|
31
|
+
* Спасибо!
|
32
|
+
* 谢谢!
|
33
|
+
* Toda!
|
34
|
+
|
35
|
+
* Questions?
|
36
|
+
* Suggestions?
|
@@ -0,0 +1,59 @@
|
|
1
|
+
/* custom css and js files included at the top level of your presentation will
|
2
|
+
* will be included in your presentation */
|
3
|
+
|
4
|
+
/*.body {*/
|
5
|
+
/*color: red;*/
|
6
|
+
/*}*/
|
7
|
+
|
8
|
+
/*.title-slide h1 {*/
|
9
|
+
/*color: red;*/
|
10
|
+
/*}*/
|
11
|
+
|
12
|
+
.content {
|
13
|
+
color: black;
|
14
|
+
font-family: helvetica, arial;
|
15
|
+
font-size: 10px;
|
16
|
+
}
|
17
|
+
|
18
|
+
h1, h2 {
|
19
|
+
color: rgb(79, 180, 226);
|
20
|
+
font-family: Georgia;
|
21
|
+
}
|
22
|
+
/*.content::after {*/
|
23
|
+
/*position: absolute;*/
|
24
|
+
/*right: 120px;*/
|
25
|
+
/*bottom: 120px;*/
|
26
|
+
/*content: url(jay_small.png);*/
|
27
|
+
/*}*/
|
28
|
+
|
29
|
+
/*#preso, .slide {*/
|
30
|
+
/*background-color: #DDD;*/
|
31
|
+
/*width: 1500px;*/
|
32
|
+
/*height: 1024px;*/
|
33
|
+
/*}*/
|
34
|
+
|
35
|
+
/*#footer {*/
|
36
|
+
/*width: 1500px;*/
|
37
|
+
/*}*/
|
38
|
+
|
39
|
+
/*.slide .content h1 {*/
|
40
|
+
/*align: left;*/
|
41
|
+
/*font-size: 40px;*/
|
42
|
+
/*font-weight: bold;*/
|
43
|
+
/*}*/
|
44
|
+
|
45
|
+
/*#intro .content > ul {*/
|
46
|
+
/*padding-top: 150px;*/
|
47
|
+
/*list-style: none outside none;*/
|
48
|
+
/*}*/
|
49
|
+
|
50
|
+
/*.slide .content ul li {*/
|
51
|
+
/*text-align: left;*/
|
52
|
+
/*padding: 5px;*/
|
53
|
+
/*font-size: 30px;*/
|
54
|
+
/*list-style: inherit;*/
|
55
|
+
/*}*/
|
56
|
+
|
57
|
+
/*.slide .content p {*/
|
58
|
+
/*margin: 0;*/
|
59
|
+
/*}*/
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"name": "Virtualization for your next ruby project",
|
3
|
+
"description": "Virtualization for your next ruby project",
|
4
|
+
"author": "Alexander Shvets",
|
5
|
+
"templates" : {
|
6
|
+
"special" : "simple.tpl"
|
7
|
+
},
|
8
|
+
"pause_msg": "Paused !!!",
|
9
|
+
"markdown" : "redcarpet",
|
10
|
+
"redcarpet": {
|
11
|
+
"fenced_code_blocks": true,
|
12
|
+
"autolink": true,
|
13
|
+
"smartypants": true,
|
14
|
+
"gh_blockcode": true,
|
15
|
+
"lax_spacing": true
|
16
|
+
},
|
17
|
+
"sections": [
|
18
|
+
// {"section":"01-vagrant"},
|
19
|
+
// {"section":"02-provision"},
|
20
|
+
{"section":"03-docker"}
|
21
|
+
// {"section":"04-conclusion"}
|
22
|
+
]
|
23
|
+
}
|
data/spec/linux_install_spec.rb
CHANGED
@@ -3,13 +3,20 @@ require File.expand_path('spec_helper', File.dirname(__FILE__))
|
|
3
3
|
require 'thor'
|
4
4
|
load 'thor/linux_install.thor'
|
5
5
|
|
6
|
-
|
6
|
+
require "thor/runner"
|
7
|
+
# $thor_runner = true
|
8
|
+
|
9
|
+
# rdebug-ide --port 1234 --dispatcher-port 26162 -- /Users/ashvets/.rvm/gems/ruby-1.9.3-p545@linux_provision/bin/rdebug-ide /Users/ashvets/Dropbox/alex/work/projects/linux_provision/Thorfile linux_install:test
|
7
10
|
|
8
11
|
describe LinuxInstall do
|
9
12
|
|
10
13
|
describe "#test" do
|
11
14
|
it "calls test method" do
|
12
|
-
subject.test
|
15
|
+
#subject.test
|
16
|
+
args = ARGV
|
17
|
+
args = ['linux_install:test']
|
18
|
+
|
19
|
+
Thor::Runner.start(args)
|
13
20
|
end
|
14
21
|
end
|
15
22
|
end
|
@@ -3,7 +3,7 @@ require File.expand_path('spec_helper', File.dirname(__FILE__))
|
|
3
3
|
require 'linux_provision/linux_provision'
|
4
4
|
|
5
5
|
describe LinuxProvision do
|
6
|
-
|
6
|
+
subject { LinuxProvision.new ".linux_provision.json", ["thor/demo_scripts.sh"] }
|
7
7
|
|
8
8
|
describe "#test" do
|
9
9
|
it "calls test method" do
|
@@ -0,0 +1 @@
|
|
1
|
+
{}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
##############################
|
4
|
+
[project]
|
5
|
+
# Installs demo sinatra project
|
6
|
+
|
7
|
+
USER_HOME="#{node.home}"
|
8
|
+
|
9
|
+
APP_HOME="#{project.home}"
|
10
|
+
|
11
|
+
cd $APP_HOME
|
12
|
+
|
13
|
+
source $USER_HOME/.rvm/scripts/rvm
|
14
|
+
|
15
|
+
rvm use #{project.ruby_version}@#{project.gemset}
|
16
|
+
|
17
|
+
bundle
|
18
|
+
|
19
|
+
rake db:migrate
|
20
|
+
|
21
|
+
|
22
|
+
##############################
|
23
|
+
[rackup]
|
24
|
+
# Starts sinatra demo application
|
25
|
+
|
26
|
+
USER_HOME="#{node.home}"
|
27
|
+
|
28
|
+
APP_HOME="#{project.home}"
|
29
|
+
|
30
|
+
cd $APP_HOME
|
31
|
+
|
32
|
+
source $USER_HOME/.rvm/scripts/rvm
|
33
|
+
|
34
|
+
rackup
|
data/thor/docker.thor
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
$: << File.expand_path(File.dirname(__FILE__) + '/../lib')
|
2
|
+
|
3
|
+
class Docker < Thor
|
4
|
+
desc "execute", "execute"
|
5
|
+
def execute *params
|
6
|
+
ENV['DOCKER_HOST'] = "tcp://192.168.59.103:2375"
|
7
|
+
|
8
|
+
exec *params
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "all", "all"
|
12
|
+
def all
|
13
|
+
# Build containers from Dockerfiles
|
14
|
+
execute <<-CODE
|
15
|
+
# Reset
|
16
|
+
# execute "docker stop $(docker ps -a -q)"
|
17
|
+
# execute "docker rm $(docker ps -a -q)"
|
18
|
+
|
19
|
+
# Build containers
|
20
|
+
# docker build -t postgres docker/postgres
|
21
|
+
docker build -t demo demo
|
22
|
+
|
23
|
+
# Run and link the containers
|
24
|
+
# docker run -d -p 5432:5432 --name postgres postgres:latest
|
25
|
+
|
26
|
+
# docker run --rm --name demo demo:latest /bin/bash -l -c "rake db:migrate"
|
27
|
+
# docker run --rm -p 22 -p 9292:9292 --name demo demo:latest /bin/bash -l -c "rackup"
|
28
|
+
# docker run -d -p 9292:9292 --name demo demo:latest /bin/bash -l -c "rackup"
|
29
|
+
CODE
|
30
|
+
end
|
31
|
+
end
|
data/thor/linux_install.thor
CHANGED
@@ -3,17 +3,10 @@ $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
|
|
3
3
|
require 'linux_provision/linux_provision'
|
4
4
|
|
5
5
|
class LinuxInstall < Thor
|
6
|
-
|
6
|
+
@installer = LinuxProvision.new self, ".linux_provision.json", [File.expand_path("demo_scripts.sh", File.dirname(__FILE__))]
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
super *params
|
12
|
-
end
|
13
|
-
|
14
|
-
desc "test", "test"
|
15
|
-
def test
|
16
|
-
installer.test
|
8
|
+
class << self
|
9
|
+
attr_reader :installer
|
17
10
|
end
|
18
11
|
|
19
12
|
desc "all", "Installs all required packages"
|
@@ -33,117 +26,26 @@ class LinuxInstall < Thor
|
|
33
26
|
invoke :postgres_create_user
|
34
27
|
invoke :postgres_create_schemas
|
35
28
|
|
36
|
-
invoke :mysql_create_user
|
37
|
-
invoke :mysql_create_schemas
|
29
|
+
# invoke :mysql_create_user
|
30
|
+
# invoke :mysql_create_schemas
|
38
31
|
|
39
32
|
# invoke :selenium
|
40
33
|
|
41
|
-
invoke :project
|
34
|
+
# invoke :project
|
42
35
|
end
|
43
36
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
# invoke :postgres_create_schemas
|
48
|
-
# end
|
49
|
-
#
|
50
|
-
# desc "postgres_drop", "Drops postgres project schemas"
|
51
|
-
# def postgres_drop
|
52
|
-
# installer.postgres_drop env["app_user"], env["app_schemas"]
|
53
|
-
# end
|
54
|
-
#
|
55
|
-
# desc "mysql_create", "Initializes mysql"
|
56
|
-
# def mysql_create
|
57
|
-
# invoke :mysql_create_user
|
58
|
-
# invoke :mysql_create_schemas
|
59
|
-
# end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
def method_missing(method, *args, &block)
|
64
|
-
installer.send(method, *args, &block)
|
37
|
+
desc "postgres_create_schemas", "Initializes postgres schemas"
|
38
|
+
def postgres_create_schemas
|
39
|
+
LinuxInstall.installer.postgres_create_schemas
|
65
40
|
end
|
66
41
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
# desc "rvm", "Installs rvm"
|
73
|
-
# def rvm
|
74
|
-
# installer.rvm_install
|
75
|
-
# end
|
76
|
-
|
77
|
-
# desc "npm", "Installs npm"
|
78
|
-
# def npm
|
79
|
-
# installer.npm_install
|
80
|
-
# end
|
81
|
-
|
82
|
-
# desc "qt", "Installs qt"
|
83
|
-
# def qt
|
84
|
-
# installer.qt_install
|
85
|
-
# end
|
86
|
-
|
87
|
-
# desc "mysql", "Installs mysql server"
|
88
|
-
# def mysql
|
89
|
-
# installer.mysql_install
|
90
|
-
# end
|
91
|
-
|
92
|
-
# desc "mysql_restart", "Restarts mysql server"
|
93
|
-
# def mysql_restart
|
94
|
-
# installer.mysql_restart
|
95
|
-
# end
|
96
|
-
#
|
97
|
-
# desc "postgres", "Installs postgres server"
|
98
|
-
# def postgres
|
99
|
-
# installer.postgres_install
|
100
|
-
# end
|
101
|
-
#
|
102
|
-
# desc "postgres_restart", "Restarts postgres server"
|
103
|
-
# def postgres_restart
|
104
|
-
# installer.postgres_restart
|
105
|
-
# end
|
106
|
-
#
|
107
|
-
# desc "postgres_stop", "Stop postgres server"
|
108
|
-
# def postgres_stop
|
109
|
-
# installer.postgres_stop
|
110
|
-
# end
|
111
|
-
#
|
112
|
-
# desc "postgres_start", "Start postgres server"
|
113
|
-
# def postgres_start
|
114
|
-
# installer.postgres_start
|
115
|
-
# end
|
116
|
-
#
|
117
|
-
# desc "ruby", "Installs ruby"
|
118
|
-
# def ruby
|
119
|
-
# installer.ruby_install
|
120
|
-
# end
|
121
|
-
#
|
122
|
-
# desc "jenkins", "Installs jenkins server"
|
123
|
-
# def jenkins
|
124
|
-
# installer.jenkins_install
|
125
|
-
# end
|
126
|
-
#
|
127
|
-
# desc "jenkins_restart", "Restart jenkins server"
|
128
|
-
# def jenkins_restart
|
129
|
-
# installer.jenkins_restart
|
130
|
-
# end
|
131
|
-
#
|
132
|
-
# desc "selenium", "Installs selenium server"
|
133
|
-
# def selenium
|
134
|
-
# installer.selenium_install
|
135
|
-
# end
|
136
|
-
#
|
137
|
-
# desc "selenium_restart", "Restarts selenium server"
|
138
|
-
# def selenium_restart
|
139
|
-
# installer.selenium_restart
|
140
|
-
# end
|
141
|
-
|
142
|
-
#
|
143
|
-
# desc "postgres_test", "Test postgres schemas"
|
144
|
-
# def postgres_test
|
145
|
-
# installer.postgres_test env["app_user"]
|
146
|
-
# end
|
147
|
-
#
|
42
|
+
desc "postgres_drop_schemas", "Drops postgres schemas"
|
43
|
+
def postgres_drop_schemas
|
44
|
+
LinuxInstall.installer.postgres_drop_schemas
|
45
|
+
end
|
148
46
|
|
47
|
+
desc "mysql_create_schemas", "Initializes mysql schemas"
|
48
|
+
def mysql_create_schemas
|
49
|
+
LinuxInstall.installer.mysql_create_schemas
|
50
|
+
end
|
149
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linux_provision
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Shvets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: text-interpolator
|
@@ -120,6 +120,30 @@ files:
|
|
120
120
|
- Rakefile
|
121
121
|
- Thorfile
|
122
122
|
- Vagrantfile
|
123
|
+
- demo/.ruby-gemset
|
124
|
+
- demo/.ruby-version
|
125
|
+
- demo/Dockerfile
|
126
|
+
- demo/Gemfile
|
127
|
+
- demo/Gemfile.lock
|
128
|
+
- demo/Rakefile
|
129
|
+
- demo/app.rb
|
130
|
+
- demo/bin/start-server.sh
|
131
|
+
- demo/config.ru
|
132
|
+
- demo/db/migrate/20140610203958_create_notes.rb
|
133
|
+
- demo/db/migrate/20140610204302_add_notes.rb
|
134
|
+
- demo/db/schema.rb
|
135
|
+
- demo/db_setup.rb
|
136
|
+
- demo/note.rb
|
137
|
+
- demo/supervisord.conf
|
138
|
+
- demo/views/index.erb
|
139
|
+
- demo/views/layout.erb
|
140
|
+
- demo/views/new.erb
|
141
|
+
- demo/views/note.erb
|
142
|
+
- docker/postgres/Dockerfile
|
143
|
+
- docker/postgres/bin/create_db.sh
|
144
|
+
- docker/sshd/Dockerfile
|
145
|
+
- docker/supervisord/Dockerfile
|
146
|
+
- docker/supervisord/supervisord.conf
|
123
147
|
- lib/linux_provision.rb
|
124
148
|
- lib/linux_provision/generic_provision.rb
|
125
149
|
- lib/linux_provision/linux_provision.rb
|
@@ -127,9 +151,23 @@ files:
|
|
127
151
|
- lib/linux_provision/version.rb
|
128
152
|
- linux_provision.gemspec
|
129
153
|
- linux_provision.gemspec.erb
|
154
|
+
- presentation/virtualization/01-vagrant/slides.md
|
155
|
+
- presentation/virtualization/02-provision/slides.md
|
156
|
+
- presentation/virtualization/03-docker/slides.md
|
157
|
+
- presentation/virtualization/04-conclusion/slides.md
|
158
|
+
- presentation/virtualization/default.css
|
159
|
+
- presentation/virtualization/default.tpl
|
160
|
+
- presentation/virtualization/images/chef.jpg
|
161
|
+
- presentation/virtualization/images/provisioning.jpg
|
162
|
+
- presentation/virtualization/images/vagrant.jpg
|
163
|
+
- presentation/virtualization/showoff.json
|
164
|
+
- presentation/virtualization/simple.tpl
|
130
165
|
- spec/linux_install_spec.rb
|
131
166
|
- spec/linux_provision_spec.rb
|
132
167
|
- spec/spec_helper.rb
|
168
|
+
- stats/viewstats.json
|
169
|
+
- thor/demo_scripts.sh
|
170
|
+
- thor/docker.thor
|
133
171
|
- thor/linux_install.thor
|
134
172
|
homepage: http://github.com/shvets/linux_provision
|
135
173
|
licenses:
|