infrataster 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{example/.rspec → .rspec} +0 -0
- data/CHANGELOG.md +10 -0
- data/README.md +27 -1
- data/Rakefile +52 -0
- data/infrataster.gemspec +5 -1
- data/lib/infrataster/contexts/base_context.rb +3 -3
- data/lib/infrataster/contexts/capybara_context.rb +2 -2
- data/lib/infrataster/contexts/http_context.rb +18 -6
- data/lib/infrataster/contexts/mysql_query_context.rb +1 -1
- data/lib/infrataster/contexts.rb +7 -7
- data/lib/infrataster/helpers/resource_helper.rb +24 -0
- data/lib/infrataster/helpers.rb +1 -1
- data/lib/infrataster/{types/base_type.rb → resources/base_resource.rb} +3 -3
- data/lib/infrataster/{types/capybara_type.rb → resources/capybara_resource.rb} +3 -3
- data/lib/infrataster/resources/http_resource.rb +42 -0
- data/lib/infrataster/{types/mysql_query_type.rb → resources/mysql_query_resource.rb} +3 -3
- data/lib/infrataster/{types/server_type.rb → resources/server_resource.rb} +2 -2
- data/lib/infrataster/resources.rb +5 -0
- data/lib/infrataster/rspec.rb +1 -1
- data/lib/infrataster/server.rb +26 -15
- data/lib/infrataster/version.rb +1 -1
- data/lib/infrataster.rb +6 -2
- data/spec/integration/http_spec.rb +44 -0
- data/{example/spec → spec/integration}/spec_helper.rb +3 -10
- data/spec/integration/vm/.gitignore +3 -0
- data/spec/integration/vm/Berksfile +2 -0
- data/spec/integration/vm/Vagrantfile +38 -0
- data/{example/sinatra_app → spec/integration/vm/app}/Gemfile +0 -1
- data/spec/integration/vm/app/app.rb +39 -0
- data/{example/sinatra_app → spec/integration/vm/app}/config.ru +0 -0
- data/spec/integration/vm/cookbooks/app/files/default/rackup.conf +3 -0
- data/spec/integration/vm/cookbooks/app/recipes/default.rb +35 -0
- data/spec/integration/vm/cookbooks/apt-mirror/recipes/default.rb +4 -0
- data/spec/integration/vm/cookbooks/proxy/files/default/index.html +1 -0
- data/spec/integration/vm/cookbooks/proxy/recipes/default.rb +22 -0
- data/spec/integration/vm/cookbooks/proxy/templates/default/integration-test.erb +65 -0
- data/spec/unit/lib/infrataster/server_spec.rb +49 -0
- data/spec/unit/spec_helper.rb +23 -0
- metadata +72 -29
- data/example/.gitignore +0 -4
- data/example/Berksfile +0 -2
- data/example/Gemfile +0 -8
- data/example/README.md +0 -13
- data/example/Vagrantfile +0 -81
- data/example/cookbooks/app/recipes/default.rb +0 -36
- data/example/cookbooks/db/files/default/my.cnf +0 -127
- data/example/cookbooks/db/recipes/default.rb +0 -14
- data/example/cookbooks/proxy/metadata.rb +0 -1
- data/example/cookbooks/proxy/recipes/default.rb +0 -26
- data/example/cookbooks/proxy/templates/default/app.erb +0 -13
- data/example/cookbooks/proxy/templates/default/static.erb +0 -14
- data/example/sinatra_app/.gitignore +0 -1
- data/example/sinatra_app/app.rb +0 -6
- data/example/spec/web_spec.rb +0 -64
- data/lib/infrataster/helpers/type_helper.rb +0 -24
- data/lib/infrataster/types/http_type.rb +0 -24
- data/lib/infrataster/types.rb +0 -5
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
get '/' do
|
5
|
+
result = {
|
6
|
+
'app' => 'sinatra',
|
7
|
+
'method' => 'GET',
|
8
|
+
'params' => params,
|
9
|
+
'headers' => RequestWrapper.new(request).headers,
|
10
|
+
}
|
11
|
+
|
12
|
+
result.to_json
|
13
|
+
end
|
14
|
+
|
15
|
+
post '/' do
|
16
|
+
result = {
|
17
|
+
'app' => 'sinatra',
|
18
|
+
'method' => 'POST',
|
19
|
+
'params' => params,
|
20
|
+
'headers' => RequestWrapper.new(request).headers,
|
21
|
+
}
|
22
|
+
|
23
|
+
result.to_json
|
24
|
+
end
|
25
|
+
|
26
|
+
class RequestWrapper
|
27
|
+
def initialize(request)
|
28
|
+
@request = request
|
29
|
+
end
|
30
|
+
|
31
|
+
def headers
|
32
|
+
headers = @request.env.select do |k, v|
|
33
|
+
k.start_with?('HTTP_')
|
34
|
+
end.map do |k, v|
|
35
|
+
[k[5..-1], v]
|
36
|
+
end
|
37
|
+
Hash[headers]
|
38
|
+
end
|
39
|
+
end
|
File without changes
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# install ruby and so on
|
2
|
+
package 'python-software-properties'
|
3
|
+
|
4
|
+
execute 'apt-add-repository ppa:brightbox/ruby-ng && apt-get update' do
|
5
|
+
not_if 'test -e /etc/apt/sources.list.d/brightbox-ruby-ng-precise.list'
|
6
|
+
end
|
7
|
+
|
8
|
+
package 'build-essential'
|
9
|
+
|
10
|
+
package 'ruby2.1'
|
11
|
+
|
12
|
+
package 'ruby2.1-dev'
|
13
|
+
|
14
|
+
execute 'gem install bundler' do
|
15
|
+
not_if "gem list | grep -q 'bundler '"
|
16
|
+
end
|
17
|
+
|
18
|
+
execute 'bundle install' do
|
19
|
+
cwd '/vagrant/app'
|
20
|
+
end
|
21
|
+
|
22
|
+
# supervisor
|
23
|
+
package 'supervisor'
|
24
|
+
|
25
|
+
execute 'reload supervisor' do
|
26
|
+
command 'supervisorctl reload'
|
27
|
+
action :nothing
|
28
|
+
end
|
29
|
+
|
30
|
+
cookbook_file '/etc/supervisor/conf.d/rackup.conf' do
|
31
|
+
notifies :run, 'execute[reload supervisor]'
|
32
|
+
end
|
33
|
+
|
34
|
+
execute 'supervisorctl restart rackup'
|
35
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
This is static site.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
package 'nginx'
|
2
|
+
|
3
|
+
service 'nginx' do
|
4
|
+
action :start
|
5
|
+
supports :restart => true
|
6
|
+
end
|
7
|
+
|
8
|
+
file '/etc/nginx/sites-enabled/default' do
|
9
|
+
action :delete
|
10
|
+
end
|
11
|
+
|
12
|
+
template '/etc/nginx/sites-available/integration-test'
|
13
|
+
|
14
|
+
link '/etc/nginx/sites-enabled/integration-test' do
|
15
|
+
to '/etc/nginx/sites-available/integration-test'
|
16
|
+
notifies :restart, 'service[nginx]'
|
17
|
+
end
|
18
|
+
|
19
|
+
cookbook_file '/usr/share/nginx/www/index.html' do
|
20
|
+
mode '0644'
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
server {
|
2
|
+
listen 80;
|
3
|
+
|
4
|
+
root /usr/share/nginx/www;
|
5
|
+
index index.html index.htm;
|
6
|
+
|
7
|
+
server_name static.example.com;
|
8
|
+
|
9
|
+
location / {
|
10
|
+
try_files $uri $uri/ /index.html;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
server {
|
15
|
+
listen 80;
|
16
|
+
|
17
|
+
root /usr/share/nginx/www;
|
18
|
+
index index.html index.htm;
|
19
|
+
|
20
|
+
server_name app.example.com;
|
21
|
+
|
22
|
+
location / {
|
23
|
+
proxy_pass http://<%= node['addresses']['app'] %>;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
# another virtual host using mix of IP-, name-, and port-based configuration
|
29
|
+
#
|
30
|
+
#server {
|
31
|
+
# listen 8000;
|
32
|
+
# listen somename:8080;
|
33
|
+
# server_name somename alias another.alias;
|
34
|
+
# root html;
|
35
|
+
# index index.html index.htm;
|
36
|
+
#
|
37
|
+
# location / {
|
38
|
+
# try_files $uri $uri/ /index.html;
|
39
|
+
# }
|
40
|
+
#}
|
41
|
+
|
42
|
+
|
43
|
+
# HTTPS server
|
44
|
+
#
|
45
|
+
#server {
|
46
|
+
# listen 443;
|
47
|
+
# server_name localhost;
|
48
|
+
#
|
49
|
+
# root html;
|
50
|
+
# index index.html index.htm;
|
51
|
+
#
|
52
|
+
# ssl on;
|
53
|
+
# ssl_certificate cert.pem;
|
54
|
+
# ssl_certificate_key cert.key;
|
55
|
+
#
|
56
|
+
# ssl_session_timeout 5m;
|
57
|
+
#
|
58
|
+
# ssl_protocols SSLv3 TLSv1;
|
59
|
+
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
|
60
|
+
# ssl_prefer_server_ciphers on;
|
61
|
+
#
|
62
|
+
# location / {
|
63
|
+
# try_files $uri $uri/ /index.html;
|
64
|
+
# }
|
65
|
+
#}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'unit/spec_helper'
|
2
|
+
|
3
|
+
module Infrataster
|
4
|
+
describe Server do
|
5
|
+
describe "self.define" do
|
6
|
+
it "adds a Server instance to defined_servers" do
|
7
|
+
described_class.define('name', 'address', {})
|
8
|
+
servers = described_class.defined_servers
|
9
|
+
expect(servers.size).to eq(1)
|
10
|
+
expect(servers[0].name).to eq('name')
|
11
|
+
expect(servers[0].address).to eq('address')
|
12
|
+
expect(servers[0].options).to eq({})
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "self.find_by_name" do
|
17
|
+
it "finds a server by name" do
|
18
|
+
described_class.define('name', 'address', {})
|
19
|
+
server = described_class.find_by_name('name')
|
20
|
+
expect(server.name).to eq('name')
|
21
|
+
expect(server.address).to eq('address')
|
22
|
+
expect(server.options).to eq({})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#from" do
|
27
|
+
it "returns 'from' server instance" do
|
28
|
+
described_class.define('proxy', 'address', {})
|
29
|
+
described_class.define('app', 'address', from: 'proxy')
|
30
|
+
app_server = described_class.find_by_name('app')
|
31
|
+
expect(app_server.from.name).to eq('proxy')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#ssh_gateway" do
|
36
|
+
it "returns gateway instance and proc for finalizing" do
|
37
|
+
server = Server.new('name', 'address', ssh: {host: 'host', user: 'user'})
|
38
|
+
|
39
|
+
gateway_mock = double
|
40
|
+
expect(gateway_mock).to receive(:shutdown!)
|
41
|
+
expect(Net::SSH::Gateway).to receive(:new).and_return(gateway_mock)
|
42
|
+
gateway, finalize_proc = server.ssh_gateway
|
43
|
+
finalize_proc.call
|
44
|
+
expect(gateway).to eq(gateway_mock)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'infrataster'
|
2
|
+
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
6
|
+
# loaded once.
|
7
|
+
#
|
8
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
11
|
+
config.run_all_when_everything_filtered = true
|
12
|
+
config.filter_run :focus
|
13
|
+
|
14
|
+
# Run specs in random order to surface order dependencies. If you find an
|
15
|
+
# order dependency and want to debug it, you can fix the order by providing
|
16
|
+
# the seed, which is printed after each run.
|
17
|
+
# --seed 1234
|
18
|
+
config.order = 'random'
|
19
|
+
|
20
|
+
config.before(:each) do
|
21
|
+
Infrataster::Server.clear_defined_servers
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infrataster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Arai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: faraday
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: bundler
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +150,20 @@ dependencies:
|
|
136
150
|
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: berkshelf
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 3.1.1
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 3.1.1
|
139
167
|
description:
|
140
168
|
email:
|
141
169
|
- ryota.arai@gmail.com
|
@@ -144,29 +172,12 @@ extensions: []
|
|
144
172
|
extra_rdoc_files: []
|
145
173
|
files:
|
146
174
|
- ".gitignore"
|
175
|
+
- ".rspec"
|
176
|
+
- CHANGELOG.md
|
147
177
|
- Gemfile
|
148
178
|
- LICENSE.txt
|
149
179
|
- README.md
|
150
180
|
- Rakefile
|
151
|
-
- example/.gitignore
|
152
|
-
- example/.rspec
|
153
|
-
- example/Berksfile
|
154
|
-
- example/Gemfile
|
155
|
-
- example/README.md
|
156
|
-
- example/Vagrantfile
|
157
|
-
- example/cookbooks/app/recipes/default.rb
|
158
|
-
- example/cookbooks/db/files/default/my.cnf
|
159
|
-
- example/cookbooks/db/recipes/default.rb
|
160
|
-
- example/cookbooks/proxy/metadata.rb
|
161
|
-
- example/cookbooks/proxy/recipes/default.rb
|
162
|
-
- example/cookbooks/proxy/templates/default/app.erb
|
163
|
-
- example/cookbooks/proxy/templates/default/static.erb
|
164
|
-
- example/sinatra_app/.gitignore
|
165
|
-
- example/sinatra_app/Gemfile
|
166
|
-
- example/sinatra_app/app.rb
|
167
|
-
- example/sinatra_app/config.ru
|
168
|
-
- example/spec/spec_helper.rb
|
169
|
-
- example/spec/web_spec.rb
|
170
181
|
- infrataster.gemspec
|
171
182
|
- lib/infrataster.rb
|
172
183
|
- lib/infrataster/browsermob_proxy.rb
|
@@ -176,17 +187,33 @@ files:
|
|
176
187
|
- lib/infrataster/contexts/http_context.rb
|
177
188
|
- lib/infrataster/contexts/mysql_query_context.rb
|
178
189
|
- lib/infrataster/helpers.rb
|
190
|
+
- lib/infrataster/helpers/resource_helper.rb
|
179
191
|
- lib/infrataster/helpers/rspec_helper.rb
|
180
|
-
- lib/infrataster/
|
192
|
+
- lib/infrataster/resources.rb
|
193
|
+
- lib/infrataster/resources/base_resource.rb
|
194
|
+
- lib/infrataster/resources/capybara_resource.rb
|
195
|
+
- lib/infrataster/resources/http_resource.rb
|
196
|
+
- lib/infrataster/resources/mysql_query_resource.rb
|
197
|
+
- lib/infrataster/resources/server_resource.rb
|
181
198
|
- lib/infrataster/rspec.rb
|
182
199
|
- lib/infrataster/server.rb
|
183
|
-
- lib/infrataster/types.rb
|
184
|
-
- lib/infrataster/types/base_type.rb
|
185
|
-
- lib/infrataster/types/capybara_type.rb
|
186
|
-
- lib/infrataster/types/http_type.rb
|
187
|
-
- lib/infrataster/types/mysql_query_type.rb
|
188
|
-
- lib/infrataster/types/server_type.rb
|
189
200
|
- lib/infrataster/version.rb
|
201
|
+
- spec/integration/http_spec.rb
|
202
|
+
- spec/integration/spec_helper.rb
|
203
|
+
- spec/integration/vm/.gitignore
|
204
|
+
- spec/integration/vm/Berksfile
|
205
|
+
- spec/integration/vm/Vagrantfile
|
206
|
+
- spec/integration/vm/app/Gemfile
|
207
|
+
- spec/integration/vm/app/app.rb
|
208
|
+
- spec/integration/vm/app/config.ru
|
209
|
+
- spec/integration/vm/cookbooks/app/files/default/rackup.conf
|
210
|
+
- spec/integration/vm/cookbooks/app/recipes/default.rb
|
211
|
+
- spec/integration/vm/cookbooks/apt-mirror/recipes/default.rb
|
212
|
+
- spec/integration/vm/cookbooks/proxy/files/default/index.html
|
213
|
+
- spec/integration/vm/cookbooks/proxy/recipes/default.rb
|
214
|
+
- spec/integration/vm/cookbooks/proxy/templates/default/integration-test.erb
|
215
|
+
- spec/unit/lib/infrataster/server_spec.rb
|
216
|
+
- spec/unit/spec_helper.rb
|
190
217
|
homepage: https://github.com/ryotarai/infrataster
|
191
218
|
licenses:
|
192
219
|
- MIT
|
@@ -211,4 +238,20 @@ rubygems_version: 2.2.2
|
|
211
238
|
signing_key:
|
212
239
|
specification_version: 4
|
213
240
|
summary: Infrastructure Behavior Testing Framework
|
214
|
-
test_files:
|
241
|
+
test_files:
|
242
|
+
- spec/integration/http_spec.rb
|
243
|
+
- spec/integration/spec_helper.rb
|
244
|
+
- spec/integration/vm/.gitignore
|
245
|
+
- spec/integration/vm/Berksfile
|
246
|
+
- spec/integration/vm/Vagrantfile
|
247
|
+
- spec/integration/vm/app/Gemfile
|
248
|
+
- spec/integration/vm/app/app.rb
|
249
|
+
- spec/integration/vm/app/config.ru
|
250
|
+
- spec/integration/vm/cookbooks/app/files/default/rackup.conf
|
251
|
+
- spec/integration/vm/cookbooks/app/recipes/default.rb
|
252
|
+
- spec/integration/vm/cookbooks/apt-mirror/recipes/default.rb
|
253
|
+
- spec/integration/vm/cookbooks/proxy/files/default/index.html
|
254
|
+
- spec/integration/vm/cookbooks/proxy/recipes/default.rb
|
255
|
+
- spec/integration/vm/cookbooks/proxy/templates/default/integration-test.erb
|
256
|
+
- spec/unit/lib/infrataster/server_spec.rb
|
257
|
+
- spec/unit/spec_helper.rb
|
data/example/.gitignore
DELETED
data/example/Berksfile
DELETED
data/example/Gemfile
DELETED
data/example/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# Infrataster Example
|
2
|
-
|
3
|
-
```
|
4
|
-
$ cd example
|
5
|
-
$ wget https://s3-us-west-1.amazonaws.com/lightbody-bmp/browsermob-proxy-2.0-beta-9-bin.zip
|
6
|
-
$ unzip browsermob-proxy-2.0-beta-9-bin.zip
|
7
|
-
$ mv browsermob-proxy-2.0-beta-9 vendor/browsermob
|
8
|
-
$ bundle install
|
9
|
-
$ bundle exec berks vendor vendor/cookbooks
|
10
|
-
$ vagrant up
|
11
|
-
$ bundle exec rspec
|
12
|
-
```
|
13
|
-
|
data/example/Vagrantfile
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
# -*- mode: ruby -*-
|
2
|
-
# vi: set ft=ruby :
|
3
|
-
|
4
|
-
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
5
|
-
VAGRANTFILE_API_VERSION = "2"
|
6
|
-
|
7
|
-
COOKBOOK_PATH = ['./cookbooks', './vendor/cookbooks']
|
8
|
-
APP_IP = "172.16.33.11"
|
9
|
-
|
10
|
-
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
11
|
-
config.vm.box = "hashicorp/precise64"
|
12
|
-
|
13
|
-
config.vm.define :proxy do |c|
|
14
|
-
c.vm.network "private_network", ip: "192.168.33.10"
|
15
|
-
c.vm.network "private_network", ip: "172.16.33.10", virtualbox__intnet: "infrataster-example"
|
16
|
-
|
17
|
-
c.vm.provision "chef_solo" do |chef|
|
18
|
-
chef.cookbooks_path = COOKBOOK_PATH
|
19
|
-
chef.add_recipe "proxy"
|
20
|
-
chef.json = {'app_ip' => APP_IP}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
config.vm.define :app do |c|
|
25
|
-
c.vm.network "private_network", ip: APP_IP, virtualbox__intnet: "infrataster-example"
|
26
|
-
|
27
|
-
c.vm.provision "chef_solo" do |chef|
|
28
|
-
chef.cookbooks_path = COOKBOOK_PATH
|
29
|
-
chef.add_recipe "app"
|
30
|
-
chef.json = {}
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
config.vm.define :db do |c|
|
35
|
-
c.vm.network "private_network", ip: '172.16.33.12', virtualbox__intnet: "infrataster-example"
|
36
|
-
|
37
|
-
c.vm.provision "chef_solo" do |chef|
|
38
|
-
chef.cookbooks_path = COOKBOOK_PATH
|
39
|
-
chef.add_recipe "db"
|
40
|
-
chef.json = {'app_ip' => APP_IP}
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# Enable provisioning with chef solo, specifying a cookbooks path, roles
|
45
|
-
# path, and data_bags path (all relative to this Vagrantfile), and adding
|
46
|
-
# some recipes and/or roles.
|
47
|
-
#
|
48
|
-
# config.vm.provision "chef_solo" do |chef|
|
49
|
-
# chef.cookbooks_path = "../my-recipes/cookbooks"
|
50
|
-
# chef.roles_path = "../my-recipes/roles"
|
51
|
-
# chef.data_bags_path = "../my-recipes/data_bags"
|
52
|
-
# chef.add_recipe "mysql"
|
53
|
-
# chef.add_role "web"
|
54
|
-
#
|
55
|
-
# # You may also specify custom JSON attributes:
|
56
|
-
# chef.json = { :mysql_password => "foo" }
|
57
|
-
# end
|
58
|
-
|
59
|
-
# Enable provisioning with chef server, specifying the chef server URL,
|
60
|
-
# and the path to the validation key (relative to this Vagrantfile).
|
61
|
-
#
|
62
|
-
# The Opscode Platform uses HTTPS. Substitute your organization for
|
63
|
-
# ORGNAME in the URL and validation key.
|
64
|
-
#
|
65
|
-
# If you have your own Chef Server, use the appropriate URL, which may be
|
66
|
-
# HTTP instead of HTTPS depending on your configuration. Also change the
|
67
|
-
# validation key to validation.pem.
|
68
|
-
#
|
69
|
-
# config.vm.provision "chef_client" do |chef|
|
70
|
-
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
|
71
|
-
# chef.validation_key_path = "ORGNAME-validator.pem"
|
72
|
-
# end
|
73
|
-
#
|
74
|
-
# If you're using the Opscode platform, your validator client is
|
75
|
-
# ORGNAME-validator, replacing ORGNAME with your organization name.
|
76
|
-
#
|
77
|
-
# If you have your own Chef Server, the default validation client name is
|
78
|
-
# chef-validator, unless you changed the configuration.
|
79
|
-
#
|
80
|
-
# chef.validation_client_name = "ORGNAME-validator"
|
81
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
include_recipe 'apt'
|
2
|
-
|
3
|
-
package 'python-software-properties' do
|
4
|
-
action :install
|
5
|
-
end
|
6
|
-
|
7
|
-
execute 'apt-add-repository ppa:brightbox/ruby-ng && apt-get update'
|
8
|
-
|
9
|
-
package 'build-essential' do
|
10
|
-
action :install
|
11
|
-
end
|
12
|
-
|
13
|
-
package 'ruby2.1' do
|
14
|
-
action :install
|
15
|
-
end
|
16
|
-
|
17
|
-
package 'ruby2.1-dev' do
|
18
|
-
action :install
|
19
|
-
end
|
20
|
-
|
21
|
-
execute 'gem install bundler' do
|
22
|
-
not_if "gem list | grep -q 'bundler '"
|
23
|
-
end
|
24
|
-
|
25
|
-
execute 'bundle install' do
|
26
|
-
cwd '/vagrant/sinatra_app'
|
27
|
-
end
|
28
|
-
|
29
|
-
execute "kill $(cat /tmp/thin.pid) && sleep 2" do
|
30
|
-
only_if "test -e /tmp/thin.pid"
|
31
|
-
end
|
32
|
-
|
33
|
-
execute "bundle exec thin start --pid /tmp/thin.pid --daemonize --port 80" do
|
34
|
-
cwd '/vagrant/sinatra_app'
|
35
|
-
end
|
36
|
-
|
@@ -1,127 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# The MySQL database server configuration file.
|
3
|
-
#
|
4
|
-
# You can copy this to one of:
|
5
|
-
# - "/etc/mysql/my.cnf" to set global options,
|
6
|
-
# - "~/.my.cnf" to set user-specific options.
|
7
|
-
#
|
8
|
-
# One can use all long options that the program supports.
|
9
|
-
# Run program with --help to get a list of available options and with
|
10
|
-
# --print-defaults to see which it would actually understand and use.
|
11
|
-
#
|
12
|
-
# For explanations see
|
13
|
-
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
|
14
|
-
|
15
|
-
# This will be passed to all mysql clients
|
16
|
-
# It has been reported that passwords should be enclosed with ticks/quotes
|
17
|
-
# escpecially if they contain "#" chars...
|
18
|
-
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
|
19
|
-
[client]
|
20
|
-
port = 3306
|
21
|
-
socket = /var/run/mysqld/mysqld.sock
|
22
|
-
|
23
|
-
# Here is entries for some specific programs
|
24
|
-
# The following values assume you have at least 32M ram
|
25
|
-
|
26
|
-
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
|
27
|
-
[mysqld_safe]
|
28
|
-
socket = /var/run/mysqld/mysqld.sock
|
29
|
-
nice = 0
|
30
|
-
|
31
|
-
[mysqld]
|
32
|
-
#
|
33
|
-
# * Basic Settings
|
34
|
-
#
|
35
|
-
user = mysql
|
36
|
-
pid-file = /var/run/mysqld/mysqld.pid
|
37
|
-
socket = /var/run/mysqld/mysqld.sock
|
38
|
-
port = 3306
|
39
|
-
basedir = /usr
|
40
|
-
datadir = /var/lib/mysql
|
41
|
-
tmpdir = /tmp
|
42
|
-
lc-messages-dir = /usr/share/mysql
|
43
|
-
skip-external-locking
|
44
|
-
#
|
45
|
-
# Instead of skip-networking the default is now to listen only on
|
46
|
-
# localhost which is more compatible and is not less secure.
|
47
|
-
bind-address = 0.0.0.0
|
48
|
-
#
|
49
|
-
# * Fine Tuning
|
50
|
-
#
|
51
|
-
key_buffer = 16M
|
52
|
-
max_allowed_packet = 16M
|
53
|
-
thread_stack = 192K
|
54
|
-
thread_cache_size = 8
|
55
|
-
# This replaces the startup script and checks MyISAM tables if needed
|
56
|
-
# the first time they are touched
|
57
|
-
myisam-recover = BACKUP
|
58
|
-
#max_connections = 100
|
59
|
-
#table_cache = 64
|
60
|
-
#thread_concurrency = 10
|
61
|
-
#
|
62
|
-
# * Query Cache Configuration
|
63
|
-
#
|
64
|
-
query_cache_limit = 1M
|
65
|
-
query_cache_size = 16M
|
66
|
-
#
|
67
|
-
# * Logging and Replication
|
68
|
-
#
|
69
|
-
# Both location gets rotated by the cronjob.
|
70
|
-
# Be aware that this log type is a performance killer.
|
71
|
-
# As of 5.1 you can enable the log at runtime!
|
72
|
-
#general_log_file = /var/log/mysql/mysql.log
|
73
|
-
#general_log = 1
|
74
|
-
#
|
75
|
-
# Error log - should be very few entries.
|
76
|
-
#
|
77
|
-
log_error = /var/log/mysql/error.log
|
78
|
-
#
|
79
|
-
# Here you can see queries with especially long duration
|
80
|
-
#log_slow_queries = /var/log/mysql/mysql-slow.log
|
81
|
-
#long_query_time = 2
|
82
|
-
#log-queries-not-using-indexes
|
83
|
-
#
|
84
|
-
# The following can be used as easy to replay backup logs or for replication.
|
85
|
-
# note: if you are setting up a replication slave, see README.Debian about
|
86
|
-
# other settings you may need to change.
|
87
|
-
#server-id = 1
|
88
|
-
#log_bin = /var/log/mysql/mysql-bin.log
|
89
|
-
expire_logs_days = 10
|
90
|
-
max_binlog_size = 100M
|
91
|
-
#binlog_do_db = include_database_name
|
92
|
-
#binlog_ignore_db = include_database_name
|
93
|
-
#
|
94
|
-
# * InnoDB
|
95
|
-
#
|
96
|
-
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
|
97
|
-
# Read the manual for more InnoDB related options. There are many!
|
98
|
-
#
|
99
|
-
# * Security Features
|
100
|
-
#
|
101
|
-
# Read the manual, too, if you want chroot!
|
102
|
-
# chroot = /var/lib/mysql/
|
103
|
-
#
|
104
|
-
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
|
105
|
-
#
|
106
|
-
# ssl-ca=/etc/mysql/cacert.pem
|
107
|
-
# ssl-cert=/etc/mysql/server-cert.pem
|
108
|
-
# ssl-key=/etc/mysql/server-key.pem
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
[mysqldump]
|
113
|
-
quick
|
114
|
-
quote-names
|
115
|
-
max_allowed_packet = 16M
|
116
|
-
|
117
|
-
[mysql]
|
118
|
-
#no-auto-rehash # faster start of mysql but no tab completition
|
119
|
-
|
120
|
-
[isamchk]
|
121
|
-
key_buffer = 16M
|
122
|
-
|
123
|
-
#
|
124
|
-
# * IMPORTANT: Additional settings that can override those from this file!
|
125
|
-
# The files must end with '.cnf', otherwise they'll be ignored.
|
126
|
-
#
|
127
|
-
!includedir /etc/mysql/conf.d/
|