25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/wildcloud/keeper/deployers/aufs.rb', line 25
def deploy(options = {})
options[:base_image] ||= 'base'
@id = options[:id]
@appid = options[:appid]
@temp_file = File.join(config['paths']['tmp'], "#{@id}.tar.gz")
@image_path = File.join(config['paths']['images'], "#{@id}")
@target_path = File.join(config['paths']['mounts'], "#{@id}")
@temp_path = File.join(config['paths']['temp'], "#{@id}")
FileUtils.mkdir_p(@image_path)
FileUtils.mkdir_p(@target_path)
FileUtils.mkdir_p(@temp_path)
@branches = "br=#{@image_path}=rw:#{File.join(config['paths']['images'], 'base')}=ro"
options[:root_path] = @image_path
unless options[:build]
run("curl -v -o #{@temp_file} -H 'X-Appid: #{config['storage']['id']}' #{config['storage']['url']}/#{@appid}.tar.gz")
run("tar -xf #{@temp_file} -C #{@image_path}")
@branches = "br=#{@temp_path}=rw:#{@image_path}=ro:#{File.join(config['paths']['images'], options[:base_image])}=ro"
options[:root_path] = @temp_path
end
run("mount -t aufs -o #{@branches} none #{@target_path}")
end
|