itamae 1.9.11 → 1.9.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +39 -0
- data/CHANGELOG.md +19 -1
- data/Gemfile +0 -3
- data/README.md +1 -1
- data/Rakefile +12 -24
- data/itamae.gemspec +12 -3
- data/lib/itamae/backend.rb +11 -0
- data/lib/itamae/cli.rb +11 -0
- data/lib/itamae/ext/specinfra.rb +10 -0
- data/lib/itamae/runner.rb +1 -1
- data/lib/itamae/version.rb +1 -1
- data/spec/integration/default_spec.rb +28 -18
- data/spec/integration/recipes/default.rb +2 -2
- data/spec/integration/spec_helper.rb +5 -31
- metadata +13 -9
- data/ci/destroy_old_droplets.rb +0 -22
- data/spec/integration/Vagrantfile +0 -37
- data/wercker.yml +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8d9449b41e179eee46bdba56f3c099d58c652d48116f7927f7cc12fcf6d0f015
|
4
|
+
data.tar.gz: 63f4dd7419342509efa326830783d421d97c1295074c231b7f8de854fab47f87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1925e7d871bc4622c9c10ce086d735e203093a3b533a348cff643912aa9798cc26561a46cc4e6b9245b1c5ccfa93199b9e8df4c9e3a0a4b2f258c9297c79ef5
|
7
|
+
data.tar.gz: 18649f349ddb64abfb85215a00ea56b9aeca3ee809916853aa3f10a461e2dbfe0acc2bd5ca9b1bed077c64aa634b3e6277d8cc54015d51e31bd49a1afdb3abc2
|
data/.travis.yml
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
language: ruby
|
2
|
+
sudo: required
|
3
|
+
services:
|
4
|
+
- docker
|
5
|
+
rvm:
|
6
|
+
- 2.3
|
7
|
+
- 2.4
|
8
|
+
- 2.5
|
9
|
+
- ruby-head
|
10
|
+
bundler_args: "--jobs=4 --retry=3"
|
11
|
+
cache:
|
12
|
+
bundler: true
|
13
|
+
directories:
|
14
|
+
- $HOME/docker
|
15
|
+
|
16
|
+
before_cache:
|
17
|
+
# Save tagged docker images
|
18
|
+
- >
|
19
|
+
mkdir -p $HOME/docker && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}'
|
20
|
+
| xargs -n 2 -t sh -c 'test -e $HOME/docker/$1.tar.gz || docker save $0 | gzip -2 > $HOME/docker/$1.tar.gz'
|
21
|
+
|
22
|
+
before_install:
|
23
|
+
- gem update --system --no-document
|
24
|
+
- gem install bundler --no-document
|
25
|
+
# Load cached docker images
|
26
|
+
- if [[ -d $HOME/docker ]]; then ls $HOME/docker/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi
|
27
|
+
|
28
|
+
script:
|
29
|
+
- bundle exec rake spec
|
30
|
+
notifications:
|
31
|
+
email: false
|
32
|
+
slack:
|
33
|
+
secure: PcecHsVS6lw89K5PllW8xFlzu0d04p6lYfxlUZL0/yp9flAczElJME4RshSMSkbnu5e2Iw8KUA2xB1jkAzDo9qYoXveaKyjkFUOb1ZxYIVxzzfoDDwUNTMmSoyjZjvbeBUcpxxmxy6nXa3zS+gA2ohqWhS9WTTlTqyM5RriDjZ8=
|
34
|
+
matrix:
|
35
|
+
allow_failures:
|
36
|
+
- rvm: ruby-head
|
37
|
+
branches:
|
38
|
+
only:
|
39
|
+
- master
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## Unreleased
|
2
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.9.12...master)
|
3
|
+
|
4
|
+
## v1.9.12
|
5
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.9.11...v1.9.12)
|
6
|
+
|
7
|
+
Features
|
8
|
+
|
9
|
+
- [jail backend: add support of FreeBSD Jail (`itamae jail`)](https://github.com/itamae-kitchen/itamae/pull/249)
|
10
|
+
|
11
|
+
Bugfixes
|
12
|
+
|
13
|
+
- [docker backend: Fixed edit action of file resource doesn't work with docker backend](https://github.com/itamae-kitchen/itamae/pull/257)
|
14
|
+
|
15
|
+
Improvements
|
16
|
+
|
17
|
+
- [Print '(dry-run)' first in dry-run mode](https://github.com/itamae-kitchen/itamae/pull/252)
|
18
|
+
|
1
19
|
## v1.9.11
|
2
20
|
|
3
21
|
Features
|
@@ -451,7 +469,7 @@ Feature
|
|
451
469
|
|
452
470
|
Improvements
|
453
471
|
|
454
|
-
- `source :auto` accepts a template without .erb
|
472
|
+
- `source :auto` accepts a template without .erb extension. (by @ryotarai)
|
455
473
|
|
456
474
|
## v1.1.21
|
457
475
|
|
data/Gemfile
CHANGED
@@ -3,9 +3,6 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in itamae.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem 'vagrant', github: 'ryotarai/vagrant', branch: 'latest-bundler'
|
7
|
-
gem 'vagrant-digitalocean'
|
8
|
-
|
9
6
|
path = Pathname.new("Gemfile.local")
|
10
7
|
eval(path.read) if path.exist?
|
11
8
|
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# [![](https://raw.githubusercontent.com/itamae-kitchen/itamae-logos/master/small/FA-Itamae-horizontal-01-180x72.png)](https://github.com/itamae-kitchen/itamae)
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/itamae.svg)](http://badge.fury.io/rb/itamae) [![Code Climate](https://codeclimate.com/github/ryotarai/itamae/badges/gpa.svg)](https://codeclimate.com/github/ryotarai/itamae) [![
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/itamae.svg)](http://badge.fury.io/rb/itamae) [![Code Climate](https://codeclimate.com/github/ryotarai/itamae/badges/gpa.svg)](https://codeclimate.com/github/ryotarai/itamae) [![Build Status](https://travis-ci.org/itamae-kitchen/itamae.svg?branch=master)](https://travis-ci.org/itamae-kitchen/itamae) [![Slack](https://img.shields.io/badge/slack-join-blue.svg)](https://itamae-slackin.herokuapp.com/)
|
4
4
|
|
5
5
|
Simple and lightweight configuration management tool inspired by Chef.
|
6
6
|
|
data/Rakefile
CHANGED
@@ -3,8 +3,6 @@ require 'rspec/core/rake_task'
|
|
3
3
|
require 'tempfile'
|
4
4
|
require 'net/ssh'
|
5
5
|
|
6
|
-
vagrant_bin = 'vagrant'
|
7
|
-
|
8
6
|
desc 'Run unit and integration specs.'
|
9
7
|
task :spec => ['spec:unit', 'spec:integration:all']
|
10
8
|
|
@@ -15,30 +13,22 @@ namespace :spec do
|
|
15
13
|
end
|
16
14
|
|
17
15
|
namespace :integration do
|
18
|
-
targets = []
|
19
|
-
status = `cd spec/integration && #{vagrant_bin} status`
|
20
|
-
unless $?.exitstatus == 0
|
21
|
-
raise "vagrant status failed.\n#{status}"
|
22
|
-
end
|
23
|
-
|
24
|
-
status.split("\n\n")[1].each_line do |line|
|
25
|
-
targets << line.match(/^[^ ]+/)[0]
|
26
|
-
end
|
16
|
+
targets = ["ubuntu:trusty"]
|
27
17
|
|
28
18
|
task :all => targets
|
29
19
|
|
30
20
|
targets.each do |target|
|
31
21
|
desc "Run provision and specs to #{target}"
|
32
|
-
task target => ["provision:#{target}", "serverspec:#{target}"]
|
22
|
+
task target => ["docker:#{target}", "provision:#{target}", "serverspec:#{target}"]
|
33
23
|
|
34
|
-
namespace :
|
24
|
+
namespace :docker do
|
35
25
|
task target do
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
system env, "#{vagrant_bin} ssh-config #{target} > #{config.path}"
|
40
|
-
options = Net::SSH::Config.for(target, [config.path])
|
26
|
+
sh "docker run --privileged -d --name itamae #{target} /sbin/init"
|
27
|
+
end
|
28
|
+
end
|
41
29
|
|
30
|
+
namespace :provision do
|
31
|
+
task target do
|
42
32
|
suites = [
|
43
33
|
[
|
44
34
|
"spec/integration/recipes/default.rb",
|
@@ -51,13 +41,11 @@ namespace :spec do
|
|
51
41
|
],
|
52
42
|
]
|
53
43
|
suites.each do |suite|
|
54
|
-
cmd = %w!bundle exec bin/itamae
|
55
|
-
cmd << "-h" << options[:host_name]
|
56
|
-
cmd << "-u" << options[:user]
|
57
|
-
cmd << "-p" << options[:port].to_s
|
58
|
-
cmd << "-i" << options[:keys].first
|
44
|
+
cmd = %w!bundle exec bin/itamae docker!
|
59
45
|
cmd << "-l" << (ENV['LOG_LEVEL'] || 'debug')
|
60
46
|
cmd << "-j" << "spec/integration/recipes/node.json"
|
47
|
+
cmd << "--container" << "itamae"
|
48
|
+
cmd << "--tag" << "itamae:latest"
|
61
49
|
cmd += suite
|
62
50
|
|
63
51
|
p cmd
|
@@ -71,7 +59,7 @@ namespace :spec do
|
|
71
59
|
namespace :serverspec do
|
72
60
|
desc "Run serverspec tests to #{target}"
|
73
61
|
RSpec::Core::RakeTask.new(target.to_sym) do |t|
|
74
|
-
ENV['
|
62
|
+
ENV['DOCKER_CONTAINER'] = "itamae"
|
75
63
|
t.ruby_opts = '-I ./spec/integration'
|
76
64
|
t.pattern = "spec/integration/*_spec.rb"
|
77
65
|
end
|
data/itamae.gemspec
CHANGED
@@ -6,12 +6,21 @@ require 'itamae/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "itamae"
|
8
8
|
spec.version = Itamae::VERSION
|
9
|
-
spec.authors = ["Ryota Arai"]
|
10
|
-
spec.email = ["ryota.arai@gmail.com"]
|
9
|
+
spec.authors = ["Ryota Arai", "Yusuke Nakamura", "sue445"]
|
10
|
+
spec.email = ["ryota.arai@gmail.com", "yusuke1994525@gmail.com", "sue445@sue445.net"]
|
11
11
|
spec.summary = %q{Simple Configuration Management Tool}
|
12
|
-
spec.homepage = "https://
|
12
|
+
spec.homepage = "https://itamae.kitchen/"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
|
+
if spec.respond_to?(:metadata)
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/itamae-kitchen/itamae"
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/itamae-kitchen/itamae/blob/master/CHANGELOG.md"
|
19
|
+
else
|
20
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
21
|
+
"public gem pushes."
|
22
|
+
end
|
23
|
+
|
15
24
|
spec.files = `git ls-files`.split($/)
|
16
25
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
26
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
data/lib/itamae/backend.rb
CHANGED
@@ -212,6 +212,17 @@ module Itamae
|
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
215
|
+
class Jexec < Base
|
216
|
+
private
|
217
|
+
def create_specinfra_backend
|
218
|
+
Specinfra::Backend::Jexec.new(
|
219
|
+
shell: @options[:shell],
|
220
|
+
login_shell: @options[:login_shell],
|
221
|
+
jail_name: @options[:jail_name],
|
222
|
+
)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
215
226
|
class Ssh < Base
|
216
227
|
private
|
217
228
|
def create_specinfra_backend
|
data/lib/itamae/cli.rb
CHANGED
@@ -73,6 +73,17 @@ module Itamae
|
|
73
73
|
run(recipe_files, :docker, options)
|
74
74
|
end
|
75
75
|
|
76
|
+
desc "jail RECIPE [RECIPE...]", "Run Itamae in jail"
|
77
|
+
define_exec_options
|
78
|
+
option :jail_name, type: :string, desc: "Jail Hostname"
|
79
|
+
def jail(*recipe_files)
|
80
|
+
if recipe_files.empty?
|
81
|
+
raise "Please specify recipe files."
|
82
|
+
end
|
83
|
+
|
84
|
+
run(recipe_files, :jexec, options)
|
85
|
+
end
|
86
|
+
|
76
87
|
desc "version", "Print version"
|
77
88
|
def version
|
78
89
|
puts "Itamae v#{Itamae::VERSION}"
|
data/lib/itamae/ext/specinfra.rb
CHANGED
@@ -18,6 +18,16 @@ module Specinfra
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
class Docker < Exec
|
22
|
+
def receive_file(from, to = nil)
|
23
|
+
if to
|
24
|
+
send_file(from, to)
|
25
|
+
else
|
26
|
+
run_command("cat #{from}").stdout
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
21
31
|
class Ssh < Exec
|
22
32
|
def receive_file(from, to = nil)
|
23
33
|
scp_download!(from, to)
|
data/lib/itamae/runner.rb
CHANGED
@@ -6,7 +6,7 @@ module Itamae
|
|
6
6
|
class Runner
|
7
7
|
class << self
|
8
8
|
def run(recipe_files, backend_type, options)
|
9
|
-
Itamae.logger.info "Starting Itamae..."
|
9
|
+
Itamae.logger.info "Starting Itamae... #{options[:dry_run] ? '(dry-run)' : ''}"
|
10
10
|
|
11
11
|
backend = Backend.create(backend_type, options)
|
12
12
|
runner = self.new(backend, options)
|
data/lib/itamae/version.rb
CHANGED
@@ -79,38 +79,34 @@ end
|
|
79
79
|
|
80
80
|
describe file('/tmp/http_request.html') do
|
81
81
|
it { should be_file }
|
82
|
-
its(:content) { should match(/"from"
|
82
|
+
its(:content) { should match(/"from":\s*"itamae"/) }
|
83
83
|
end
|
84
84
|
|
85
85
|
describe file('/tmp/http_request_delete.html') do
|
86
86
|
it { should be_file }
|
87
|
-
its(:content) { should match(/"from"
|
87
|
+
its(:content) { should match(/"from":\s*"itamae"/) }
|
88
88
|
end
|
89
89
|
|
90
90
|
describe file('/tmp/http_request_post.html') do
|
91
91
|
it { should be_file }
|
92
|
-
its(:content)
|
93
|
-
|
94
|
-
should match(/"love": "sushi"/)
|
95
|
-
end
|
92
|
+
its(:content) { should match(/"from":\s*"itamae"/) }
|
93
|
+
its(:content) { should match(/"love":\s*"sushi"/) }
|
96
94
|
end
|
97
95
|
|
98
96
|
describe file('/tmp/http_request_put.html') do
|
99
97
|
it { should be_file }
|
100
|
-
its(:content)
|
101
|
-
|
102
|
-
should match(/"love": "sushi"/)
|
103
|
-
end
|
98
|
+
its(:content) { should match(/"from":\s*"itamae"/) }
|
99
|
+
its(:content) { should match(/"love":\s*"sushi"/) }
|
104
100
|
end
|
105
101
|
|
106
102
|
describe file('/tmp/http_request_headers.html') do
|
107
103
|
it { should be_file }
|
108
|
-
its(:content) { should match(/"User-Agent"
|
104
|
+
its(:content) { should match(/"User-Agent":\s*"Itamae"/) }
|
109
105
|
end
|
110
106
|
|
111
107
|
describe file('/tmp/http_request_redirect.html') do
|
112
108
|
it { should be_file }
|
113
|
-
its(:content) { should match(/"from"
|
109
|
+
its(:content) { should match(/"from":\s*"itamae"/) }
|
114
110
|
end
|
115
111
|
|
116
112
|
describe file('/tmp/notifies') do
|
@@ -130,12 +126,26 @@ describe file('/tmp/cron_stopped') do
|
|
130
126
|
end
|
131
127
|
end
|
132
128
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
129
|
+
# FIXME: cron service is not running in docker...
|
130
|
+
#
|
131
|
+
# root@3450c6da6ea5:/# ps -C cron
|
132
|
+
# PID TTY TIME CMD
|
133
|
+
# root@3450c6da6ea5:/# service cron start
|
134
|
+
# Rather than invoking init scripts through /etc/init.d, use the service(8)
|
135
|
+
# utility, e.g. service cron start
|
136
|
+
#
|
137
|
+
# Since the script you are attempting to invoke has been converted to an
|
138
|
+
# Upstart job, you may also use the start(8) utility, e.g. start cron
|
139
|
+
# root@3450c6da6ea5:/# ps -C cron
|
140
|
+
# PID TTY TIME CMD
|
141
|
+
# root@3450c6da6ea5:/#
|
142
|
+
|
143
|
+
# describe file('/tmp/cron_running') do
|
144
|
+
# it { should be_file }
|
145
|
+
# its(:content) do
|
146
|
+
# expect(subject.content.lines.size).to eq 2
|
147
|
+
# end
|
148
|
+
# end
|
139
149
|
|
140
150
|
describe file('/tmp-link') do
|
141
151
|
it { should be_linked_to '/tmp' }
|
@@ -1,36 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require 'tempfile'
|
1
|
+
require "serverspec"
|
2
|
+
require "docker"
|
4
3
|
|
5
|
-
set :backend, :
|
4
|
+
set :backend, :docker
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
system(env, "vagrant #{cmd}")
|
10
|
-
end
|
11
|
-
|
12
|
-
if ENV['ASK_SUDO_PASSWORD']
|
13
|
-
begin
|
14
|
-
require 'highline/import'
|
15
|
-
rescue LoadError
|
16
|
-
fail "highline is not available. Try installing it."
|
17
|
-
end
|
18
|
-
set :sudo_password, ask("Enter sudo password: ") { |q| q.echo = false }
|
19
|
-
else
|
20
|
-
set :sudo_password, ENV['SUDO_PASSWORD']
|
21
|
-
end
|
22
|
-
|
23
|
-
host = ENV['TARGET_HOST']
|
24
|
-
|
25
|
-
config = Tempfile.new('', Dir.tmpdir)
|
26
|
-
vagrant "ssh-config #{host} > #{config.path}"
|
27
|
-
|
28
|
-
options = Net::SSH::Config.for(host, [config.path])
|
29
|
-
|
30
|
-
options[:user] ||= Etc.getlogin
|
31
|
-
|
32
|
-
set :host, options[:host_name] || host
|
33
|
-
set :ssh_options, options
|
6
|
+
set :docker_image, ENV["DOCKER_IMAGE"]
|
7
|
+
set :docker_container, ENV["DOCKER_CONTAINER"]
|
34
8
|
|
35
9
|
# Disable sudo
|
36
10
|
# set :disable_sudo, true
|
metadata
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itamae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Arai
|
8
|
+
- Yusuke Nakamura
|
9
|
+
- sue445
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date:
|
13
|
+
date: 2018-10-16 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: thor
|
@@ -201,6 +203,8 @@ dependencies:
|
|
201
203
|
description:
|
202
204
|
email:
|
203
205
|
- ryota.arai@gmail.com
|
206
|
+
- yusuke1994525@gmail.com
|
207
|
+
- sue445@sue445.net
|
204
208
|
executables:
|
205
209
|
- itamae
|
206
210
|
extensions: []
|
@@ -208,13 +212,13 @@ extra_rdoc_files: []
|
|
208
212
|
files:
|
209
213
|
- ".gitignore"
|
210
214
|
- ".rspec"
|
215
|
+
- ".travis.yml"
|
211
216
|
- CHANGELOG.md
|
212
217
|
- Gemfile
|
213
218
|
- LICENSE.txt
|
214
219
|
- README.md
|
215
220
|
- Rakefile
|
216
221
|
- bin/itamae
|
217
|
-
- ci/destroy_old_droplets.rb
|
218
222
|
- itamae.gemspec
|
219
223
|
- lib/itamae.rb
|
220
224
|
- lib/itamae/backend.rb
|
@@ -265,7 +269,6 @@ files:
|
|
265
269
|
- lib/itamae/resource/user.rb
|
266
270
|
- lib/itamae/runner.rb
|
267
271
|
- lib/itamae/version.rb
|
268
|
-
- spec/integration/Vagrantfile
|
269
272
|
- spec/integration/default_spec.rb
|
270
273
|
- spec/integration/recipes/default.rb
|
271
274
|
- spec/integration/recipes/default2.rb
|
@@ -292,11 +295,13 @@ files:
|
|
292
295
|
- spec/unit/lib/itamae/resource_spec.rb
|
293
296
|
- spec/unit/lib/itamae/runner_spec.rb
|
294
297
|
- spec/unit/spec_helper.rb
|
295
|
-
|
296
|
-
homepage: https://github.com/itamae-kitchen/itamae
|
298
|
+
homepage: https://itamae.kitchen/
|
297
299
|
licenses:
|
298
300
|
- MIT
|
299
|
-
metadata:
|
301
|
+
metadata:
|
302
|
+
homepage_uri: https://itamae.kitchen/
|
303
|
+
source_code_uri: https://github.com/itamae-kitchen/itamae
|
304
|
+
changelog_uri: https://github.com/itamae-kitchen/itamae/blob/master/CHANGELOG.md
|
300
305
|
post_install_message:
|
301
306
|
rdoc_options: []
|
302
307
|
require_paths:
|
@@ -313,12 +318,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
313
318
|
version: '0'
|
314
319
|
requirements: []
|
315
320
|
rubyforge_project:
|
316
|
-
rubygems_version: 2.
|
321
|
+
rubygems_version: 2.7.7
|
317
322
|
signing_key:
|
318
323
|
specification_version: 4
|
319
324
|
summary: Simple Configuration Management Tool
|
320
325
|
test_files:
|
321
|
-
- spec/integration/Vagrantfile
|
322
326
|
- spec/integration/default_spec.rb
|
323
327
|
- spec/integration/recipes/default.rb
|
324
328
|
- spec/integration/recipes/default2.rb
|
data/ci/destroy_old_droplets.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'net/https'
|
2
|
-
require 'json'
|
3
|
-
require 'time'
|
4
|
-
|
5
|
-
http = Net::HTTP.new("api.digitalocean.com", 443)
|
6
|
-
http.use_ssl = true
|
7
|
-
|
8
|
-
res = http.start do
|
9
|
-
http.get("/v2/droplets", "Authorization" => "Bearer #{ENV['DIGITALOCEAN_TOKEN']}")
|
10
|
-
end
|
11
|
-
|
12
|
-
droplets = JSON.parse(res.body)['droplets']
|
13
|
-
droplets.each do |droplet|
|
14
|
-
next unless /^itamae-/ =~ droplet['name']
|
15
|
-
if Time.now - Time.parse(droplet['created_at']) >= 60 * 60
|
16
|
-
puts "destroying #{droplet}..."
|
17
|
-
res = http.start do
|
18
|
-
http.delete("/v2/droplets/#{droplet['id']}", "Authorization" => "Bearer #{ENV['DIGITALOCEAN_TOKEN']}")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# -*- mode: ruby -*-
|
2
|
-
# vi: set ft=ruby :
|
3
|
-
require 'vagrant-digitalocean'
|
4
|
-
|
5
|
-
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
6
|
-
VAGRANTFILE_API_VERSION = "2"
|
7
|
-
|
8
|
-
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
9
|
-
config.vm.define :trusty do |c|
|
10
|
-
c.vm.hostname = 'itamae-trusty'
|
11
|
-
c.vm.hostname += "-#{ENV['WERCKER_BUILD_ID']}" if ENV['WERCKER_BUILD_ID']
|
12
|
-
c.vm.provider :virtualbox do |provider, override|
|
13
|
-
override.vm.box = "ubuntu/trusty64"
|
14
|
-
override.vm.provision :shell, inline: <<-EOC
|
15
|
-
cat /etc/apt/sources.list | sed -e 's|http://[^ ]*|mirror://mirrors.ubuntu.com/mirrors.txt|g' > /tmp/sources.list
|
16
|
-
if !(diff -q /etc/apt/sources.list /tmp/sources.list); then
|
17
|
-
mv /tmp/sources.list /etc/apt/sources.list
|
18
|
-
apt-get update
|
19
|
-
fi
|
20
|
-
echo America/New_York > /etc/timezone
|
21
|
-
dpkg-reconfigure --frontend noninteractive tzdata
|
22
|
-
EOC
|
23
|
-
end
|
24
|
-
|
25
|
-
c.vm.provider :digital_ocean do |provider, override|
|
26
|
-
override.ssh.private_key_path = '~/.ssh/id_rsa.vagrant'
|
27
|
-
override.vm.box = 'digital_ocean'
|
28
|
-
override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
|
29
|
-
|
30
|
-
provider.ssh_key_name = ENV['WERCKER'] ? 'vagrant/wercker/itamae' : 'Vagrant'
|
31
|
-
provider.token = ENV['DIGITALOCEAN_TOKEN']
|
32
|
-
provider.image = 'ubuntu-14-04-x64' # ubuntu
|
33
|
-
provider.region = 'nyc3'
|
34
|
-
provider.size = '512mb'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
data/wercker.yml
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
box: wercker/rvm
|
2
|
-
# Build definition
|
3
|
-
build:
|
4
|
-
# The steps that will be executed on build
|
5
|
-
# See the Ruby section on the wercker devcenter:
|
6
|
-
# http://devcenter.wercker.com/articles/languages/ruby.html
|
7
|
-
steps:
|
8
|
-
# Uncomment this to force RVM to use a specific Ruby version
|
9
|
-
- rvm-use:
|
10
|
-
version: 2.2.3
|
11
|
-
|
12
|
-
- script:
|
13
|
-
name: update bundler
|
14
|
-
code: gem update bundler
|
15
|
-
|
16
|
-
# A step that executes `bundle install` command
|
17
|
-
- bundle-install
|
18
|
-
|
19
|
-
# A custom script step, name value is used in the UI
|
20
|
-
# and the code value contains the command that get executed
|
21
|
-
- script:
|
22
|
-
name: echo ruby information
|
23
|
-
code: |
|
24
|
-
echo "ruby version $(ruby --version) running"
|
25
|
-
echo "from location $(which ruby)"
|
26
|
-
echo -p "gem list: $(gem list)"
|
27
|
-
|
28
|
-
- script:
|
29
|
-
name: create .ssh directory
|
30
|
-
code: mkdir -p $HOME/.ssh
|
31
|
-
|
32
|
-
- create-file:
|
33
|
-
name: put private key
|
34
|
-
filename: $HOME/.ssh/id_rsa.vagrant
|
35
|
-
overwrite: true
|
36
|
-
hide-from-log: true
|
37
|
-
content: $DIGITALOCEAN_PRIVATE_KEY
|
38
|
-
|
39
|
-
- create-file:
|
40
|
-
name: put public key
|
41
|
-
filename: $HOME/.ssh/id_rsa.vagrant.pub
|
42
|
-
overwrite: true
|
43
|
-
hide-from-log: true
|
44
|
-
content: $DIGITALOCEAN_PUBLIC_KEY
|
45
|
-
|
46
|
-
- script:
|
47
|
-
name: chmod 600 id_rsa
|
48
|
-
code: chmod 600 $HOME/.ssh/id_rsa.vagrant
|
49
|
-
|
50
|
-
- script:
|
51
|
-
name: install libxml and libxslt
|
52
|
-
code: sudo apt-get install libxml2-dev libxslt1-dev
|
53
|
-
|
54
|
-
- script:
|
55
|
-
name: bundle install
|
56
|
-
code: bundle install --deployment -j4
|
57
|
-
|
58
|
-
- script:
|
59
|
-
name: start vm
|
60
|
-
code: bundle exec vagrant up --provider=digital_ocean
|
61
|
-
cwd: spec/integration
|
62
|
-
|
63
|
-
# Add more steps here:
|
64
|
-
- script:
|
65
|
-
name: rspec
|
66
|
-
code: bundle exec rake spec
|
67
|
-
|
68
|
-
after-steps:
|
69
|
-
- script:
|
70
|
-
name: shutdown vm
|
71
|
-
code: bundle exec vagrant destroy -f
|
72
|
-
cwd: spec/integration
|
73
|
-
|
74
|
-
- script:
|
75
|
-
name: shutdown old vms
|
76
|
-
code: bundle exec ruby ci/destroy_old_droplets.rb
|
77
|
-
|