teamd-installer 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f71a2bd3afc34f077161a117eddb3b26dcd7a9e3
4
- data.tar.gz: 6eefbaf923af21ad08f9414b74826647a5ef33cf
3
+ metadata.gz: 2b0336e5f8fa07bf90aee256400f667d0a75d9a8
4
+ data.tar.gz: 3bb2c9cab887e65a4a64e5092aa35da428d3e28f
5
5
  SHA512:
6
- metadata.gz: 40cf7277188a7e488bb6629426594fe0ada82ec2b5bce6d4ed3b867025e1369678a1750692168d8fa1a807b89487429fba7e2a33980ba3543a1c70d5e1a98a3e
7
- data.tar.gz: f06f1fa09ef58fcd6d1bb5810d9308ee2742ec909de221cb19239d7a6d1d667af8bd21da7ff3035e8491fc75e5b8ca234f438d930ffd41294862444fa4c03ec8
6
+ metadata.gz: 971ce31ec6a15f47042947b5dc6fc8be52143be6e890e327d1fde44c851f75b2583ef97efb9b56a5dcba7ae83f9bda00f019fbe0357c8c46c3eb162966801a89
7
+ data.tar.gz: 7be8c20fbfed910abb096e46f38c81563384e7276795aa9eb50a5244545fbeb5ff3c975006ae0cbc9d35014a684405a655dcd5ab39f1e1e90f3084b17710e930
data/docker/Dockerfile CHANGED
@@ -2,7 +2,7 @@ FROM alpine:3.1
2
2
  MAINTAINER Mathias Kaufmann <me@stei.gr>
3
3
 
4
4
  RUN apk update && \
5
- apk add ruby ruby-dev ca-certificates bash wget gnupg util-linux && \
5
+ apk add ruby ruby-dev ca-certificates bash wget gnupg util-linux coreutils bzip2 && \
6
6
  gem update --system --no-ri --no-rdoc && \
7
7
  gem install --no-ri --no-rdoc teamd-installer
8
8
 
@@ -14,6 +14,7 @@ module Teamd
14
14
  method_option :installer_url, type: :string, default: "https://raw.githubusercontent.com/coreos/init/master/bin/coreos-install"
15
15
  method_option :cloud_config, type: :string, default: "/tmp/user_data"
16
16
  method_option :installer_script, type: :string, default: "/tmp/installer"
17
+ method_option :reboot, type: :boolean, default: :true
17
18
  def install
18
19
  @token ||= options[:etcd_discovery_id]
19
20
  @token ||= TeamdTokenProvider.token
@@ -29,6 +30,7 @@ module Teamd
29
30
  @config.docker_tcp = true
30
31
  @config.sshd_port = 2220
31
32
  @config.dynamic_environment = true
33
+ # @config.inspect_etcd = true
32
34
  @config = CloudConfig.new @config.to_h
33
35
  File.write(options[:cloud_config],@config.to_yaml)
34
36
  @installer = Script.download options[:installer_url]
@@ -36,6 +38,7 @@ module Teamd
36
38
  Disk.create @disk, @major, @minor
37
39
  Script.store options[:installer_script],@installer
38
40
  Script.run options[:installer_script],"-d",@disk,"-C",(ENV["GROUP"] || "stable"),"-c",options[:cloud_config]
41
+ Reboot.hard! if options[:reboot]
39
42
  end
40
43
  end
41
44
  end
@@ -0,0 +1,11 @@
1
+ module Teamd
2
+ module Installer
3
+ module Reboot
4
+ def self.hard!
5
+ File.write("/proc/sys/kernel/sysrq","1")
6
+ `sync`
7
+ File.write("/proc/sysrq-trigger","b")
8
+ end
9
+ end
10
+ end
11
+ end
@@ -5,7 +5,7 @@ module Teamd
5
5
  class TemplateConfig
6
6
  attr_accessor :etcd_discovery_id, :public_ipv4, :private_ipv4,
7
7
  :public_ipv6, :private_ipv6, :use_flannel, :docker_tcp,
8
- :sshd_port, :dynamic_environment
8
+ :sshd_port, :dynamic_environment, :inspect_etcd
9
9
  def to_h
10
10
  puts "Set discovery token, hostname and manage_etc_hosts"
11
11
  output = {
@@ -19,13 +19,22 @@ module Teamd
19
19
  "hostname" => SecureRandom.hex(8),
20
20
  "manage_etc_hosts" => "localhost",
21
21
  }
22
- puts "Create Unit for publishing discovery token"
23
- output["write_files"] << {
24
- "path" => "/run/teamd/etcd.env",
25
- "permissions" => "0444",
26
- "owner" => "root",
27
- "content" => "ETCD_DISCOVERY=https://discovery.etcd.io/#{@etcd_discovery_id}\n"
28
- }
22
+ if inspect_etcd
23
+ puts "Create Unit for publishing discovery token"
24
+ output["coreos"]["units"] << {
25
+ "name" => "reuse-etcd2-cloud-init.service",
26
+ "command" => "start",
27
+ "content" => "[Unit]\nDescription=Teamd Etcd Cloudinit DropIn Reuse\nDocumentation=https://teamd.stei.gr/discover\nConditionPathExists=/run/teamd/etcd.env\nAfter=etcd.service etcd2.service early-docker.service\nBefore=early-docker.target\n\n[Service]\nRestart=always\nRestartSec=5\nEnvironment=\"DOCKER_HOST=unix:///var/run/early-docker.sock\"\nExecStart=/usr/bin/docker run --net=host --privileged=true --rm \\\n --env-file=/run/teamd/etcd.env \\\n registry.hub.docker.com/steigr/teamd-discover",
28
+ }
29
+ else
30
+ puts "Create Unit for publishing discovery token"
31
+ output["write_files"] << {
32
+ "path" => "/run/teamd/etcd.env",
33
+ "permissions" => "0444",
34
+ "owner" => "root",
35
+ "content" => "ETCD_DISCOVERY=https://discovery.etcd.io/#{@etcd_discovery_id}\n"
36
+ }
37
+ end
29
38
  puts "Create Unit for zookeeper node"
30
39
  output["coreos"]["units"] << {
31
40
  "name" => "teamd-zookeeper.service",
@@ -1,5 +1,5 @@
1
1
  module Teamd
2
2
  module Installer
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
@@ -9,5 +9,7 @@ require "teamd/installer/script"
9
9
 
10
10
  require "teamd/installer/disk"
11
11
 
12
+ require "teamd/installer/reboot"
13
+
12
14
  require "teamd/installer/template_config"
13
15
  require "teamd/installer/cloud_config"
@@ -0,0 +1,11 @@
1
+ [Unit]
2
+ Description=Teamd Etcd2 Unit Reuse
3
+ Documentation=https://teamd.stei.gr/discover
4
+ ConditionPathExists=/run/systemd/system/etcd2.service.d/20-cloudinit.conf
5
+ Requires=etcd2.service
6
+ After=etcd2.service
7
+
8
+ [Service]
9
+ Type=oneshot
10
+ ExecStartPre=/usr/bin/mkdir /etc/systemd/system/teamd-discover.service.d
11
+ ExecStart=/usr/bin/ln -s /run/systemd/system/etcd2.service.d/20-cloudinit.conf /etc/systemd/system/teamd-discover.service.d
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamd-installer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Kaufmann
@@ -118,6 +118,7 @@ files:
118
118
  - lib/teamd/installer/disk.rb
119
119
  - lib/teamd/installer/etcd_token_provider.rb
120
120
  - lib/teamd/installer/interfaces.rb
121
+ - lib/teamd/installer/reboot.rb
121
122
  - lib/teamd/installer/script.rb
122
123
  - lib/teamd/installer/teamd_token_provider.rb
123
124
  - lib/teamd/installer/template_config.rb
@@ -125,6 +126,7 @@ files:
125
126
  - lib/teamd/installer/version.rb
126
127
  - shared/dynamic-environment.service
127
128
  - shared/teamd-discover.service
129
+ - shared/teamd-etcd2-cloudinit-reuse.service
128
130
  - teamd-installer.gemspec
129
131
  homepage: https://teamd.stei.gr/installer
130
132
  licenses: []