docker-builder 0.1.50 → 0.1.55
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{Rakefile → Rakefile_temp} +8 -7
- data/install_local.sh +1 -1
- data/lib/docker_builder.rb +4 -1
- data/lib/docker_builder/cli.rb +23 -56
- data/lib/docker_builder/config.rb +75 -34
- data/lib/docker_builder/config/dsl.rb +17 -1
- data/lib/docker_builder/{manager.rb → manager_container.rb} +25 -308
- data/lib/docker_builder/manager_image.rb +103 -0
- data/lib/docker_builder/provisioner/base.rb +188 -0
- data/lib/docker_builder/provisioner/{provisioner_chef.rb → chef.rb} +5 -1
- data/lib/docker_builder/server_settings.rb +34 -64
- data/lib/docker_builder/version.rb +1 -1
- data/readme.md +118 -79
- data/temp_config.rb +17 -0
- metadata +8 -58
- data/examples/example-apps-php/.chef/knife.rb +0 -6
- data/examples/example-apps-php/config.rb +0 -19
- data/examples/example-apps-php/servers/apps-php/.chef/knife.rb +0 -2
- data/examples/example-apps-php/servers/apps-php/config.rb +0 -69
- data/examples/example-apps-php/servers/apps-php/cookbooks/apps-php/README.md +0 -1
- data/examples/example-apps-php/servers/apps-php/cookbooks/apps-php/metadata.rb +0 -9
- data/examples/example-apps-php/servers/apps-php/cookbooks/apps-php/recipes/build.rb +0 -43
- data/examples/example-apps-php/servers/apps-php/cookbooks/apps-php/recipes/install.rb +0 -55
- data/examples/example-apps-php/servers/apps-php/cookbooks/apps-php/recipes/install_app.rb +0 -27
- data/examples/example-apps-php/servers/apps-php/cookbooks/apps-php/recipes/install_host.rb +0 -9
- data/examples/example-apps-php/servers/apps-php/cookbooks/apps-php/templates/index.html.erb +0 -4
- data/examples/example-apps-php/servers/apps-php/cookbooks/apps-php/templates/nginx-sites/app.conf.erb +0 -55
- data/examples/example-apps-php/servers/apps-php/cookbooks/apps-php/templates/nginx-sites/app.conf.erb.1 +0 -55
- data/examples/example-apps-php/servers/apps-php/cookbooks/apps-php/templates/nginx-sites/default.conf.erb +0 -45
- data/examples/example-apps-php/servers/apps-php/readme.md +0 -0
- data/examples/example-apps-php/temp/apps-php.1.json +0 -14
- data/examples/example-base-chef/.chef/knife.rb +0 -6
- data/examples/example-base-chef/config.rb +0 -19
- data/examples/example-base-chef/readme.md +0 -8
- data/examples/example-base-chef/servers/my/.chef/knife.rb +0 -2
- data/examples/example-base-chef/servers/my/config.rb +0 -53
- data/examples/example-base-chef/servers/my/cookbooks/my/README.md +0 -1
- data/examples/example-base-chef/servers/my/cookbooks/my/metadata.rb +0 -9
- data/examples/example-base-chef/servers/my/cookbooks/my/recipes/build.rb +0 -23
- data/examples/example-base-chef/servers/my/cookbooks/my/recipes/install.rb +0 -0
- data/examples/example-base-chef/servers/my/cookbooks/my/recipes/install_host.rb +0 -9
- data/examples/example-base-chef/servers/my/readme.md +0 -0
- data/examples/example-kafka-zookeeper/config.rb +0 -87
- data/examples/example-kafka-zookeeper/servers/kafka/Dockerfile +0 -21
- data/examples/example-kafka-zookeeper/servers/kafka/README.md +0 -78
- data/examples/example-kafka-zookeeper/servers/kafka/files/LICENSE +0 -202
- data/examples/example-kafka-zookeeper/servers/kafka/files/broker-list.sh +0 -5
- data/examples/example-kafka-zookeeper/servers/kafka/files/create-topics.sh +0 -32
- data/examples/example-kafka-zookeeper/servers/kafka/files/download-kafka.sh +0 -5
- data/examples/example-kafka-zookeeper/servers/kafka/files/start-kafka-shell.sh +0 -2
- data/examples/example-kafka-zookeeper/servers/kafka/files/start-kafka.sh +0 -67
- data/examples/example-nginx/config.rb +0 -19
- data/examples/example-nginx/servers/nginx/.chef/knife.rb +0 -8
- data/examples/example-nginx/servers/nginx/config.rb +0 -55
- data/examples/example-nginx/servers/nginx/cookbooks/nginx/README.md +0 -1
- data/examples/example-nginx/servers/nginx/cookbooks/nginx/metadata.rb +0 -9
- data/examples/example-nginx/servers/nginx/cookbooks/nginx/recipes/build.rb +0 -10
- data/examples/example-nginx/servers/nginx/cookbooks/nginx/recipes/install.rb +0 -28
- data/examples/example-nginx/servers/nginx/cookbooks/nginx/recipes/install_host.rb +0 -9
- data/examples/example-nginx/servers/nginx/cookbooks/nginx/templates/index.html.erb +0 -4
- data/examples/example-nginx/servers/nginx/cookbooks/nginx/templates/nginx-sites/default.conf.erb +0 -45
- data/examples/example-nginx/servers/nginx/readme.md +0 -0
- data/examples/example-nginx/servers/nginx/scripts/install.sh +0 -3
- data/examples/example-nginx/temp/ex_nginx.json +0 -20
- data/examples/example-nginx/temp/nginx.json +0 -1
- data/examples/example-swarm-redis/config.rb +0 -61
- data/examples/example-swarm-redis/readme.md +0 -10
- data/lib/docker_builder/temp.rb +0 -1
@@ -1,69 +0,0 @@
|
|
1
|
-
|
2
|
-
add 'build', {
|
3
|
-
"image_name" => "apps-php",
|
4
|
-
'build_type' => 'chef',
|
5
|
-
|
6
|
-
"base_image" => {
|
7
|
-
"name" => "my-nginx-php",
|
8
|
-
"repository" => "my-nginx-php",
|
9
|
-
"tag" => "latest"
|
10
|
-
|
11
|
-
},
|
12
|
-
|
13
|
-
}
|
14
|
-
|
15
|
-
add 'install', {
|
16
|
-
"host" => {
|
17
|
-
'script_type' => 'chef_recipe',
|
18
|
-
'script' => 'install_host',
|
19
|
-
},
|
20
|
-
"node" => {
|
21
|
-
'script_type' => 'chef_recipe',
|
22
|
-
'script' => 'install',
|
23
|
-
}
|
24
|
-
|
25
|
-
|
26
|
-
}
|
27
|
-
|
28
|
-
|
29
|
-
add 'docker', {
|
30
|
-
'command' => "/sbin/my_init",
|
31
|
-
#"command"=> "",
|
32
|
-
'ports' => [
|
33
|
-
[8080,80],
|
34
|
-
],
|
35
|
-
'volumes' => [
|
36
|
-
#['html', '/usr/share/nginx/html'],
|
37
|
-
['html', '/var/www/html'],
|
38
|
-
#['app', '/usr/share/nginx/html/app'],
|
39
|
-
['log/nginx', '/var/log/nginx/'],
|
40
|
-
],
|
41
|
-
'links' => [
|
42
|
-
]
|
43
|
-
}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
add 'attributes', {
|
48
|
-
'nginx' =>{
|
49
|
-
"sitename" =>"mysite.local"
|
50
|
-
},
|
51
|
-
'apps' =>{
|
52
|
-
'app1'=>{
|
53
|
-
'app_name' => 'app1',
|
54
|
-
'app_env' => 'production',
|
55
|
-
'app_domain' => 'app1.mmx.gex',
|
56
|
-
'app_domain_aliases' => ['app1.mmx.local'],
|
57
|
-
},
|
58
|
-
'app2'=>{
|
59
|
-
'app_name' => 'app2',
|
60
|
-
'app_env' => 'production',
|
61
|
-
'app_domain' => 'app2.mmx.gex',
|
62
|
-
'app_domain_aliases' => ['app2.mmx.local'],
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
|
67
|
-
}
|
68
|
-
|
69
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
# nginx
|
@@ -1,9 +0,0 @@
|
|
1
|
-
name 'apps-php'
|
2
|
-
maintainer 'YOUR_COMPANY_NAME'
|
3
|
-
maintainer_email 'YOUR_EMAIL'
|
4
|
-
license 'All rights reserved'
|
5
|
-
description 'Nginx server with PHP applications'
|
6
|
-
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
7
|
-
version '0.1.0'
|
8
|
-
|
9
|
-
#depends "apt"
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# will be added to Docker image
|
2
|
-
|
3
|
-
#
|
4
|
-
['/var/www/html', 'var/www/temp'].each do |d|
|
5
|
-
directory d do
|
6
|
-
recursive true
|
7
|
-
action :create
|
8
|
-
end
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
execute 'who' do
|
18
|
-
command 'echo $(whoami) > /tmp/1.txt'
|
19
|
-
end
|
20
|
-
|
21
|
-
=begin
|
22
|
-
#include_recipe 'apt'
|
23
|
-
execute 'apt-get update' do
|
24
|
-
command 'apt-get update'
|
25
|
-
end
|
26
|
-
|
27
|
-
['git'].each do |p|
|
28
|
-
apt_package p
|
29
|
-
end
|
30
|
-
=end
|
31
|
-
|
32
|
-
=begin
|
33
|
-
# clean
|
34
|
-
execute 'apt-get clean' do
|
35
|
-
command 'apt-get clean'
|
36
|
-
end
|
37
|
-
|
38
|
-
execute 'remove temp' do
|
39
|
-
command 'rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*'
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
=end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
## nginx default server
|
3
|
-
template "/etc/nginx/conf.d/default.conf" do
|
4
|
-
source "nginx-sites/default.conf.erb"
|
5
|
-
|
6
|
-
#owner 'root'
|
7
|
-
#group 'root'
|
8
|
-
|
9
|
-
mode '0775'
|
10
|
-
end
|
11
|
-
=end
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
### apps on nginx
|
16
|
-
node.run_state['apps'] = node['apps']
|
17
|
-
|
18
|
-
node['apps'].each do |name, opt|
|
19
|
-
node.run_state['app_name'] = name
|
20
|
-
node.run_state['app'] = node['apps'][name]
|
21
|
-
|
22
|
-
#include_recipe 'apps-php::install_app'
|
23
|
-
|
24
|
-
template "/etc/nginx/conf.d/#{name}.conf" do
|
25
|
-
source "nginx-sites/app.conf.erb"
|
26
|
-
|
27
|
-
variables({
|
28
|
-
:app_name => name,
|
29
|
-
:app => node['apps'][name]
|
30
|
-
})
|
31
|
-
|
32
|
-
|
33
|
-
#owner 'root'
|
34
|
-
#group 'root'
|
35
|
-
mode '0775'
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
#
|
45
|
-
bash 'reload nginx' do
|
46
|
-
code <<-EOH
|
47
|
-
service nginx reload
|
48
|
-
EOH
|
49
|
-
|
50
|
-
ignore_failure true
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
#command '/etc/init.d/nginx reload'
|
55
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# install PHP app for Nginx
|
2
|
-
|
3
|
-
name = node.run_state['app_name']
|
4
|
-
|
5
|
-
# dir
|
6
|
-
dir_base = "/var/www/html/#{name}"
|
7
|
-
dir_logs = "/var/www/logs/#{name}"
|
8
|
-
|
9
|
-
[dir_base, dir_logs].each do |d|
|
10
|
-
directory d do
|
11
|
-
recursive true
|
12
|
-
action :create
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
# nginx server
|
19
|
-
|
20
|
-
template "/etc/nginx/conf.d/#{name}.conf" do
|
21
|
-
source "nginx-sites/app.conf.erb"
|
22
|
-
|
23
|
-
|
24
|
-
#owner 'root'
|
25
|
-
#group 'root'
|
26
|
-
mode '0775'
|
27
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
server {
|
2
|
-
<% if @app['app_port'] %>
|
3
|
-
listen <%=@app['app_port']%>;
|
4
|
-
<% else %>
|
5
|
-
listen 80;
|
6
|
-
<% end %>
|
7
|
-
|
8
|
-
|
9
|
-
<% if @app['app_domain_aliases'] %>
|
10
|
-
server_name <%=@app['app_domain']%> <%=@app['app_domain_aliases'].join(' ') %>;
|
11
|
-
<% else %>
|
12
|
-
server_name <%=@app['app_domain']%>;
|
13
|
-
<% end %>
|
14
|
-
|
15
|
-
|
16
|
-
root /var/www/html/<%=@app_name%>;
|
17
|
-
index index.html index.htm index.php;
|
18
|
-
error_page 404 /index.php;
|
19
|
-
|
20
|
-
access_log /var/log/nginx/access.log;
|
21
|
-
error_log /var/log/nginx/error.log error;
|
22
|
-
|
23
|
-
charset utf-8;
|
24
|
-
|
25
|
-
location / {
|
26
|
-
try_files $uri $uri/ /index.html /index.php?$query_string;
|
27
|
-
}
|
28
|
-
|
29
|
-
location = /favicon.ico {
|
30
|
-
log_not_found off;
|
31
|
-
access_log off;
|
32
|
-
}
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
location = /robots.txt {
|
37
|
-
access_log off;
|
38
|
-
log_not_found off;
|
39
|
-
}
|
40
|
-
|
41
|
-
location ~ \.php$ {
|
42
|
-
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
43
|
-
# With php5-fpm:
|
44
|
-
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
45
|
-
fastcgi_index index.php;
|
46
|
-
include fastcgi_params;
|
47
|
-
fastcgi_param HTTPS off;
|
48
|
-
}
|
49
|
-
|
50
|
-
# Deny .htaccess file access
|
51
|
-
location ~ /\.ht {
|
52
|
-
deny all;
|
53
|
-
}
|
54
|
-
|
55
|
-
}
|
@@ -1,55 +0,0 @@
|
|
1
|
-
server {
|
2
|
-
<% if node.run_state['app']['app_port'] %>
|
3
|
-
listen <%=node.run_state['app']['app_port']%>;
|
4
|
-
<% else %>
|
5
|
-
listen 80;
|
6
|
-
<% end %>
|
7
|
-
|
8
|
-
|
9
|
-
<% if node.run_state['app']['app_domain_aliases'] %>
|
10
|
-
server_name <%=node.run_state['app']['app_domain']%> <%=node.run_state['app']['app_domain_aliases'].join(' ') %>;
|
11
|
-
<% else %>
|
12
|
-
server_name <%=node.run_state['app']['app_domain']%>;
|
13
|
-
<% end %>
|
14
|
-
|
15
|
-
|
16
|
-
root /var/www/html/<%=node.run_state['app_name']%>;
|
17
|
-
index index.html index.htm index.php;
|
18
|
-
error_page 404 /index.php;
|
19
|
-
|
20
|
-
access_log /var/log/nginx/access.log;
|
21
|
-
error_log /var/log/nginx/error.log error;
|
22
|
-
|
23
|
-
charset utf-8;
|
24
|
-
|
25
|
-
location / {
|
26
|
-
try_files $uri $uri/ /index.html /index.php?$query_string;
|
27
|
-
}
|
28
|
-
|
29
|
-
location = /favicon.ico {
|
30
|
-
log_not_found off;
|
31
|
-
access_log off;
|
32
|
-
}
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
location = /robots.txt {
|
37
|
-
access_log off;
|
38
|
-
log_not_found off;
|
39
|
-
}
|
40
|
-
|
41
|
-
location ~ \.php$ {
|
42
|
-
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
43
|
-
# With php5-fpm:
|
44
|
-
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
45
|
-
fastcgi_index index.php;
|
46
|
-
include fastcgi_params;
|
47
|
-
fastcgi_param HTTPS off;
|
48
|
-
}
|
49
|
-
|
50
|
-
# Deny .htaccess file access
|
51
|
-
location ~ /\.ht {
|
52
|
-
deny all;
|
53
|
-
}
|
54
|
-
|
55
|
-
}
|
@@ -1,45 +0,0 @@
|
|
1
|
-
server {
|
2
|
-
listen 80;
|
3
|
-
server_name localhost <%=node['nginx']['sitename']%> ;
|
4
|
-
|
5
|
-
#charset koi8-r;
|
6
|
-
#access_log /var/log/nginx/log/access.log main;
|
7
|
-
|
8
|
-
location / {
|
9
|
-
root /usr/share/nginx/html;
|
10
|
-
index index.html index.htm;
|
11
|
-
}
|
12
|
-
|
13
|
-
#error_page 404 /404.html;
|
14
|
-
|
15
|
-
# redirect server error pages to the static page /50x.html
|
16
|
-
#
|
17
|
-
error_page 500 502 503 504 /50x.html;
|
18
|
-
location = /50x.html {
|
19
|
-
root /usr/share/nginx/html;
|
20
|
-
}
|
21
|
-
|
22
|
-
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
23
|
-
#
|
24
|
-
#location ~ \.php$ {
|
25
|
-
# proxy_pass http://127.0.0.1;
|
26
|
-
#}
|
27
|
-
|
28
|
-
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
29
|
-
#
|
30
|
-
#location ~ \.php$ {
|
31
|
-
# root html;
|
32
|
-
# fastcgi_pass 127.0.0.1:9000;
|
33
|
-
# fastcgi_index index.php;
|
34
|
-
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
35
|
-
# include fastcgi_params;
|
36
|
-
#}
|
37
|
-
|
38
|
-
# deny access to .htaccess files, if Apache's document root
|
39
|
-
# concurs with nginx's one
|
40
|
-
#
|
41
|
-
#location ~ /\.ht {
|
42
|
-
# deny all;
|
43
|
-
#}
|
44
|
-
}
|
45
|
-
|
File without changes
|
@@ -1,14 +0,0 @@
|
|
1
|
-
{"name":"apps-php",
|
2
|
-
"build":{"image_name":
|
3
|
-
"apps-php","build_type":"chef","base_image":{"name":"my-nginx-php","repository":"my-nginx-php","tag":"latest"}},
|
4
|
-
|
5
|
-
"install":{
|
6
|
-
"host":{"script_type":"chef_recipe","script":"install_host"},
|
7
|
-
"node":{"script_type":"chef_recipe","script":"install"}},
|
8
|
-
"docker":{"command":"/sbin/my_init","ports":[[8080,80]],
|
9
|
-
"volumes":[["/disk3/data/my-examples/apps-php/html","/var/www/html"],
|
10
|
-
["/disk3/data/my-examples/apps-php/log/nginx","/var/log/nginx/"]],
|
11
|
-
"links":[]},
|
12
|
-
"attributes":{"nginx":{"sitename":"mysite.local"},"apps":{"app1":{"app_name":"app1","app_env":"production","app_domain":"app1.mmx.gex","app_domain_aliases":["app1.mmx.local"]},"app2":{"app_name":"app2","app_env":"production","app_domain":"app2.mmx.gex","app_domain_aliases":["app2.mmx.local"]}}},
|
13
|
-
"common":{"prefix":"example-","image_prefix":"example-","dir_data":"/disk3/data/my-examples/"},
|
14
|
-
"base":{"image_name":"example-apps-php","container_name":"example-apps-php"}}
|