harbr 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aec15b9d17e7347298fec36cb3dbb0cd8274739f779abf68f1bc8fdb183e561f
4
- data.tar.gz: f13a3cbdc0d225bb3f29a832655a37f338d706ea29dfaa49c6767d06e152c2d0
3
+ metadata.gz: dadfff78b63601cdf6b8764d893aef44c40825dedb37cfd986794cf3c108cee8
4
+ data.tar.gz: cca2020198ca945ec0bf2bfcf3900857b3bf3fd5c27f21a1ecad9ca97eb017be
5
5
  SHA512:
6
- metadata.gz: b7e4109fb578cf793e0b2091eeafb23dd07740a8f2a1e4e5521f5de44a876d291b5bb1db02f5b34af91b7f682a570ea7bf46693111a3a3e6314d92fd45633c79
7
- data.tar.gz: 2be9d2761e3673893195a505f08e90bb8990a24d5254506cfd6d886ffec90634c0c9e071bdf695aced05e959a5aa00b2e897c0711f6ea311990be25cbcfb5a7d
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
 
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.6"
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.6
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