harbr 0.2.5 → 0.2.7

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
  SHA256:
3
- metadata.gz: 95457aeca936ec9daa962ff3276511ca1e1ae0b6c0f7d722c5984ca4d2ac77f4
4
- data.tar.gz: d7359dfc24a76b6ebdea7c717327647cf36bd89f400ee4182791ca1cf131a5da
3
+ metadata.gz: dadfff78b63601cdf6b8764d893aef44c40825dedb37cfd986794cf3c108cee8
4
+ data.tar.gz: cca2020198ca945ec0bf2bfcf3900857b3bf3fd5c27f21a1ecad9ca97eb017be
5
5
  SHA512:
6
- metadata.gz: f41b623c415565e1cdd75c7d7d192b8b9242d474daf0e375ac5cf35d463e84dec40e6326a024d10a021d04263f6281e823dac5b1b3bd28b9619999a28f5fd0f0
7
- data.tar.gz: 3dd11a0490395d4a5bbb4a1c9f5f01daf6a75bbe7677bcf3a46244ab7f7d63fab0a3c2de701be6ade7d54937eaac6bcf9380c6473e04e507e49aa57396be7ba1
6
+ metadata.gz: fa387f6108ae537edbde1177495c3a383bdefd1b0352dac0d272e6c2f31efea3c0baafd56ea34d5aa009b2956ccd86e07a192c3c35ed31d3f9998e031125e92d
7
+ data.tar.gz: 2f600fea29940389b892c4a2b4d6d7351b8b3c6cbaa1c1b7dc0d7e4f10d773900726b4eb2de905206d8d521c2029a217c61409306ac0ec66fba98157333165b4
data/exe/harbr CHANGED
@@ -135,6 +135,11 @@ class HarbrCLI < Thor
135
135
  install_with_snap("ruby") unless command_exists?("ruby")
136
136
  install_with_snap("traefik") unless command_exists?("traefik")
137
137
  install_with_apt("runit") unless command_exists?("runit")
138
+ install_with_apt("lxc") unless command_exists?("lxc")
139
+
140
+ Harbr::Lxd::Setup.perform("panamax")
141
+
142
+
138
143
  puts "Setup completed successfully."
139
144
  end
140
145
 
@@ -177,7 +182,7 @@ class HarbrCLI < Thor
177
182
  version = $1
178
183
  raise "Ooops! next version not found!" if version.nil?
179
184
 
180
- Harbr::Lxd::Job.perform_async(name, 9292, "live")
185
+ Harbr::Lxd::Job.perform_async(name,version, "live",9292)
181
186
 
182
187
  /versions\/(?<version>\d*)/ =~ `ls -l /var/harbr/containers/#{name}/live`
183
188
  `ln -sf /var/harbr/containers/#{name}/version/#{$1} /var/harbr/containers/#{name}/rollback`
@@ -187,7 +192,7 @@ class HarbrCLI < Thor
187
192
 
188
193
  if options[:next]
189
194
  `ln -sf /var/harbr/containers/#{name}/version/#{version} /var/harbr/containers/#{name}/next`
190
- Harbr::Lxd::Job.perform_async(name, 9292, "next")
195
+ Harbr::Lxd::Job.perform_async(name,version,"next",9292)
191
196
  puts "deploy version #{version} of #{name} to next environment"
192
197
  end
193
198
  end
data/lib/harbr/lxd/job.rb CHANGED
@@ -56,7 +56,7 @@ module Harbr
56
56
  raise "Source path #{source_path} does not exist." unless File.directory?(source_path)
57
57
 
58
58
  # Create the container
59
- system("lxc launch ubuntu:20.04 #{name}")
59
+ system("lxc launch panamax #{name}")
60
60
  sleep(5) # Wait for the container to initialize
61
61
 
62
62
  # Check if runit is installed, if not then install
@@ -0,0 +1,45 @@
1
+ module Harbr
2
+ module Lxd
3
+ class Setup
4
+ include SuckerPunch::Job
5
+
6
+ def perform(name)
7
+ # Create the container
8
+ system("lxc launch ubuntu:20.04 #{name}")
9
+ sleep(5) # Wait for the container to initialize
10
+
11
+ # Check if runit is installed, if not then install
12
+ unless system("lxc exec #{name} -- dpkg -s runit")
13
+ system("lxc exec #{name} -- apt-get update")
14
+ system("lxc exec #{name} -- apt-get install -y runit")
15
+ end
16
+
17
+ # Check if chruby is installed, if not then install chruby, ruby-install and Ruby versions
18
+ unless system("lxc exec #{name} -- bash -c 'type chruby'")
19
+ system("lxc exec #{name} -- apt-get install -y git curl build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libgdbm-dev libncurses5-dev libffi-dev")
20
+ system("lxc exec #{name} -- wget -O chruby-0.3.9.tar.gz https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz")
21
+ system("lxc exec #{name} -- tar -xzvf chruby-0.3.9.tar.gz")
22
+ system("lxc exec #{name} -- cd chruby-0.3.9/ && make install")
23
+ system("lxc exec #{name} -- echo 'source /usr/local/share/chruby/chruby.sh' >> ~/.bashrc")
24
+ system("lxc exec #{name} -- wget -O ruby-install-0.8.3.tar.gz https://github.com/postmodern/ruby-install/archive/v0.8.3.tar.gz")
25
+ system("lxc exec #{name} -- tar -xzvf ruby-install-0.8.3.tar.gz")
26
+ system("lxc exec #{name} -- cd ruby-install-0.8.3/ && make install")
27
+
28
+ # Install Ruby versions
29
+ ["3.2.2", "3.1.2", "3.3.0"].each do |ruby_version|
30
+ system("lxc exec #{name} -- ruby-install ruby #{ruby_version}")
31
+ end
32
+ end
33
+
34
+ puts "Container #{name} created."
35
+
36
+ # Publish the container as an image named "panamax"
37
+ system("lxc stop #{name}")
38
+ system("lxc publish #{name} --alias @#{name}")
39
+
40
+ puts "panamax image #{name} published."
41
+
42
+ end
43
+ end
44
+ end
45
+ end
data/lib/harbr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Harbr
4
- VERSION = "0.2.5"
4
+ VERSION = "0.2.7"
5
5
  end
data/lib/harbr.rb CHANGED
@@ -12,6 +12,8 @@ require_relative "harbr/version"
12
12
  require_relative "harbr/container"
13
13
  require_relative "harbr/job"
14
14
  require_relative "harbr/lxd/job"
15
+ require_relative "harbr/lxd/setup"
16
+
15
17
 
16
18
 
17
19
  # Harbr module for managing containers, jobs, ports, and 2s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Kuldvee Burke
@@ -151,6 +151,7 @@ files:
151
151
  - lib/harbr/container.rb
152
152
  - lib/harbr/job.rb
153
153
  - lib/harbr/lxd/job.rb
154
+ - lib/harbr/lxd/setup.rb
154
155
  - lib/harbr/version.rb
155
156
  - sig/harbr.rbs
156
157
  - vendor/bundle/ruby/3.2.0/bin/bundle