Sha256: 246ea91622705fb37071b132eb4513184b0ec4141a8e372b8a201f7a2becfeaf

Contents?: true

Size: 1.45 KB

Versions: 17

Compression:

Stored size: 1.45 KB

Contents

# The main Smartcloud Engine driver
module Smartcloud
	class Engine < Smartcloud::Base
		def initialize
		end

		def install
			self.uninstall

			Smartcloud::User.create_htpasswd_files

			ssh = Smartcloud::SSH.new
			machine = Smartcloud::Machine.new

			system("mkdir -p ./tmp/engine")
			system("cp #{Smartcloud.config.root_path}/lib/smartcloud/engine/Dockerfile ./tmp/engine/Dockerfile")

			gem_file_path = File.expand_path("../../cache/smartcloud-#{Smartcloud.version}.gem", Smartcloud.config.root_path)
			system("cp #{gem_file_path} ./tmp/engine/smartcloud-#{Smartcloud.version}.gem")

			machine.sync first_sync: true

			puts "-----> Creating image smartcloud ... "
			ssh.run "docker image build -t smartcloud \
					--build-arg SMARTCLOUD_MASTER_KEY=#{Smartcloud::Credentials.new.read_key} \
					--build-arg SMARTCLOUD_VERSION=#{Smartcloud.version} \
					--build-arg USER_NAME=`id -un` \
					--build-arg USER_UID=`id -u` \
					--build-arg DOCKER_GID=`getent group docker | cut -d: -f3` \
					~/.smartcloud/tmp/engine"

			puts "-----> Adding smartcloud to PATH ... "
			ssh.run "chmod +x ~/.smartcloud/bin/smartcloud.sh && sudo ln -sf ~/.smartcloud/bin/smartcloud.sh /usr/local/bin/smartcloud"
			system("rm ./tmp/engine/Dockerfile")
			system("rm ./tmp/engine/smartcloud-#{Smartcloud.version}.gem")

			machine.sync
		end

		def uninstall
			ssh = Smartcloud::SSH.new

			ssh.run "sudo rm /usr/local/bin/smartcloud"
			ssh.run "docker rmi smartcloud"
		end
	end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
smartcloud-0.6.0 lib/smartcloud/engine.rb
smartcloud-0.5.3 lib/smartcloud/engine.rb
smartcloud-0.5.2 lib/smartcloud/engine.rb
smartcloud-0.5.1 lib/smartcloud/engine.rb
smartcloud-0.5.0 lib/smartcloud/engine.rb
smartcloud-0.4.4 lib/smartcloud/engine.rb
smartcloud-0.4.3 lib/smartcloud/engine.rb
smartcloud-0.4.2 lib/smartcloud/engine.rb
smartcloud-0.4.1 lib/smartcloud/engine.rb
smartcloud-0.3.2 lib/smartcloud/engine.rb
smartcloud-0.3.1 lib/smartcloud/engine.rb
smartcloud-0.3.0 lib/smartcloud/engine.rb
smartcloud-0.2.4 lib/smartcloud/engine.rb
smartcloud-0.2.3 lib/smartcloud/engine.rb
smartcloud-0.2.2 lib/smartcloud/engine.rb
smartcloud-0.2.1 lib/smartcloud/engine.rb
smartcloud-0.2.0 lib/smartcloud/engine.rb