sapoku 0.1.8 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/sapoku.rb +27 -0
  2. 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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sapoku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: