sapoku 0.1.8 → 0.2
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.
- data/lib/sapoku.rb +27 -0
- metadata +1 -1
data/lib/sapoku.rb
CHANGED
@@ -70,6 +70,7 @@ class Tadpole
|
|
70
70
|
output = "Creating new container for your app using the #{@stack} stack"
|
71
71
|
output += `sudo lxc-clone -o #{@stack} -n #{@app_name}`
|
72
72
|
output += "Applying new config file to container"
|
73
|
+
create_interfaces_file
|
73
74
|
create_lxc_config
|
74
75
|
output += "Booting your new container"
|
75
76
|
output += `sudo lxc-start -n #{@app_name} -d`
|
@@ -95,6 +96,32 @@ class Tadpole
|
|
95
96
|
binding
|
96
97
|
end
|
97
98
|
|
99
|
+
def create_interfaces_file
|
100
|
+
@ip = self.container_ip
|
101
|
+
|
102
|
+
template = %{
|
103
|
+
auto lo
|
104
|
+
iface lo inet loopback
|
105
|
+
|
106
|
+
auto eth0
|
107
|
+
iface eth0 inet static
|
108
|
+
address 10.0.3.29
|
109
|
+
netmask 255.255.255.0
|
110
|
+
gateway 10.0.3.1
|
111
|
+
#iface eth0 inet dhcp
|
112
|
+
|
113
|
+
up route add default gw 10.0.3.1 dev eth0
|
114
|
+
}
|
115
|
+
|
116
|
+
erb = ERB.new(template)
|
117
|
+
|
118
|
+
File.open("#{@name}_interfaces", 'w') do |f|
|
119
|
+
f.write erb.result(self.get_binding)
|
120
|
+
end
|
121
|
+
|
122
|
+
system("sudo mv #{@name}_interfaces /var/lib/lxc/#{@name}/rootfs/etc/network/interfaces")
|
123
|
+
end
|
124
|
+
|
98
125
|
def create_nginx_config
|
99
126
|
@ip = self.container_ip
|
100
127
|
@ram = self.ram
|