harbr 0.2.6 → 0.2.8

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: 1b9e586587823c5ac77b9e3e09f73b53a6045c73748e1eb306edfa8fda6bd270
4
+ data.tar.gz: 0d6257d47ae69bc032f505592263d398a5905808c0d833398dcfa2e1df97c6d6
5
5
  SHA512:
6
- metadata.gz: b7e4109fb578cf793e0b2091eeafb23dd07740a8f2a1e4e5521f5de44a876d291b5bb1db02f5b34af91b7f682a570ea7bf46693111a3a3e6314d92fd45633c79
7
- data.tar.gz: 2be9d2761e3673893195a505f08e90bb8990a24d5254506cfd6d886ffec90634c0c9e071bdf695aced05e959a5aa00b2e897c0711f6ea311990be25cbcfb5a7d
6
+ metadata.gz: a5e1b5f85a08ae8c75ef5719f7fbffe64c584203ec5fbc35d25ed77b5515d8de8b2289b1fbda3c51e3d4ff949925493b38a73933cab1985374f09f8745f051e1
7
+ data.tar.gz: c0684653d07a03a9b07e0bd2ec13d179b14edf98e1ceae15dfb8597c1251d68cb78779c49a7b541f9d53440aaeaeba8338df29308e8786a80a36d63732bd30f0
data/exe/harbr CHANGED
@@ -135,6 +135,10 @@ 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.new.perform("panamax")
141
+
138
142
  puts "Setup completed successfully."
139
143
  end
140
144
 
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.8"
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.8
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