kameleon-builder 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.editorconfig +0 -0
- data/CHANGELOG.rst +87 -0
- data/docs/Makefile +1 -1
- data/docs/source/context.rst +3 -1
- data/docs/source/debian7.yaml +128 -0
- data/docs/source/debian_customized.yaml +28 -0
- data/docs/source/debian_customized_g5k.yaml +21 -0
- data/docs/source/grid5000_tutorial.rst +435 -32
- data/docs/source/installation.rst +8 -0
- data/docs/source/tau_install_g5k.yaml +24 -0
- data/ext/mkrf_conf.rb +58 -0
- data/kameleon-builder.gemspec +7 -6
- data/lib/kameleon.rb +6 -2
- data/lib/kameleon/compat.rb +23 -1
- data/lib/kameleon/context.rb +8 -2
- data/lib/kameleon/engine.rb +19 -17
- data/lib/kameleon/persistent_cache.rb +11 -6
- data/lib/kameleon/recipe.rb +15 -4
- data/lib/kameleon/shell.rb +12 -13
- data/lib/kameleon/step.rb +19 -6
- data/lib/kameleon/utils.rb +5 -2
- data/templates/debian7-g5k.yaml +2 -2
- data/templates/debian7-kameleon.yaml +43 -0
- data/templates/debian7.yaml +1 -1
- data/templates/docker-debian7.yaml +107 -0
- data/templates/steps/bootstrap/initialize_disk_chroot.yaml +1 -1
- data/templates/steps/bootstrap/initialize_disk_qemu.yaml +1 -1
- data/templates/steps/bootstrap/prepare_docker.yaml +37 -35
- data/templates/steps/bootstrap/prepare_qemu.yaml +1 -1
- data/templates/steps/bootstrap/start_docker.yaml +6 -2
- data/templates/steps/bootstrap/start_qemu.yaml +2 -2
- data/templates/steps/checkpoints/qemu.yaml +1 -1
- data/templates/steps/export/save_appliance_from_g5k.yaml +1 -1
- data/version.txt +1 -1
- metadata +15 -7
- data/templates/debian7-docker.yaml +0 -111
data/lib/kameleon/utils.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module Kameleon
|
2
2
|
module Utils
|
3
3
|
|
4
|
-
def self.resolve_vars(raw, yaml_path, initial_variables)
|
4
|
+
def self.resolve_vars(raw, yaml_path, initial_variables, kwargs = {})
|
5
|
+
strict = kwargs.fetch('strict', true)
|
5
6
|
raw.to_s.gsub(/\$\$\{[a-zA-Z0-9\-_]+\}|\$\$[a-zA-Z0-9\-_]+/) do |var|
|
6
7
|
# remove the dollars
|
7
8
|
if var.include? "{"
|
@@ -13,7 +14,9 @@ module Kameleon
|
|
13
14
|
if initial_variables.has_key? strip_var
|
14
15
|
value = initial_variables[strip_var]
|
15
16
|
else
|
16
|
-
|
17
|
+
if strict
|
18
|
+
fail RecipeError, "#{yaml_path}: variable #{var} not found in local or global" \
|
19
|
+
end
|
17
20
|
end
|
18
21
|
return $` + resolve_vars(value.to_s + $', yaml_path, initial_variables)
|
19
22
|
end
|
data/templates/debian7-g5k.yaml
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
#==============================================================================
|
2
|
+
# vim: softtabstop=2 shiftwidth=2 expandtab fenc=utf-8 cc=81 tw=80
|
3
|
+
#==============================================================================
|
4
|
+
#
|
5
|
+
# DESCRIPTION: Debian 7 appliance with kameleon.
|
6
|
+
#
|
7
|
+
#==============================================================================
|
8
|
+
|
9
|
+
---
|
10
|
+
extend: debian7-desktop
|
11
|
+
|
12
|
+
global:
|
13
|
+
# You can see the base template `debian7-desktop.yaml` to know the
|
14
|
+
# variables that you can override
|
15
|
+
arch: amd64
|
16
|
+
|
17
|
+
bootstrap:
|
18
|
+
- @base
|
19
|
+
|
20
|
+
setup:
|
21
|
+
- @base
|
22
|
+
- autologin
|
23
|
+
- install_software:
|
24
|
+
- packages: parted qemu-system debootstrap qemu-utils
|
25
|
+
- install_kameleon:
|
26
|
+
- deb_install:
|
27
|
+
- exec_in: wget http://kameleon.imag.fr/pkg/kameleon_2.1.0+20140612204940-1_amd64.deb -O kameleon_2.1.0_amd64.deb
|
28
|
+
- exec_in: dpkg -i kameleon_2.1.0_amd64.deb
|
29
|
+
- exec_in: rm -f kameleon_2.1.0_amd64.deb
|
30
|
+
- prepare_export:
|
31
|
+
- nullify_freespace:
|
32
|
+
- exec_in: rm -rf /tmp/* || true
|
33
|
+
- exec_in: rm -rf /var/tmp/* || true
|
34
|
+
- exec_in: |
|
35
|
+
echo "Nullify freespace..."
|
36
|
+
dd if=/dev/zero of=/bigemptyfile bs=1M 2>&1 >/dev/null || true
|
37
|
+
rm -f /bigemptyfile
|
38
|
+
|
39
|
+
export:
|
40
|
+
- save_appliance:
|
41
|
+
- save_as_qcow2:
|
42
|
+
- exec_out: qemu-img convert -c -O qcow2 $$image_disk $KAMELEON_WORKDIR/$$kameleon_recipe_name.qcow2
|
43
|
+
- exec_out: echo "Saved qcow2 appliance to $KAMELEON_WORKDIR/$$kameleon_recipe_name.qcow2"
|
data/templates/debian7.yaml
CHANGED
@@ -96,7 +96,7 @@ setup:
|
|
96
96
|
- dist_upgrade: true
|
97
97
|
- install_software:
|
98
98
|
- packages: >
|
99
|
-
debian-keyring ntp
|
99
|
+
debian-keyring ntp rsync sudo less vim bash-completion
|
100
100
|
- configure_kernel:
|
101
101
|
- arch: $$arch
|
102
102
|
# Configuration
|
@@ -0,0 +1,107 @@
|
|
1
|
+
#==============================================================================
|
2
|
+
# vim: softtabstop=2 shiftwidth=2 expandtab fenc=utf-8 cc=81 tw=80
|
3
|
+
#==============================================================================
|
4
|
+
#
|
5
|
+
# DESCRIPTION: Build a debian image for docker with docker
|
6
|
+
#
|
7
|
+
#==============================================================================
|
8
|
+
|
9
|
+
---
|
10
|
+
# Loads some helpful aliases
|
11
|
+
aliases: defaults.yaml
|
12
|
+
# Enables qcow2 checkpoint
|
13
|
+
# checkpoint: docker.yaml
|
14
|
+
#== Global variables use by Kameleon engine and the steps
|
15
|
+
global:
|
16
|
+
## User varibales : used by the recipe
|
17
|
+
user_name: kameleon
|
18
|
+
user_password: $$user_name
|
19
|
+
|
20
|
+
# Distribution
|
21
|
+
distrib: debian
|
22
|
+
release: wheezy
|
23
|
+
arch: amd64
|
24
|
+
|
25
|
+
## Docker options
|
26
|
+
docker_dns: 208.67.222.222
|
27
|
+
docker_image: $$kameleon_recipe_name
|
28
|
+
docker_hostname: $$kameleon_recipe_name
|
29
|
+
|
30
|
+
# rootfs options
|
31
|
+
rootfs_download_path: /var/cache/kameleon/$$distrib/$$release/$$arch/rootfs
|
32
|
+
|
33
|
+
## System variables. Required by kameleon engine
|
34
|
+
# Include specific steps
|
35
|
+
include_steps:
|
36
|
+
- $$distrib/$$release
|
37
|
+
- $$distrib
|
38
|
+
|
39
|
+
# Apt options
|
40
|
+
apt_repository: http://ftp.debian.org/debian/
|
41
|
+
apt_enable_contrib: true
|
42
|
+
apt_enable_nonfree: true
|
43
|
+
apt_install_recommends: false
|
44
|
+
|
45
|
+
# Shell session from where we launch exec_out commands. There is often a
|
46
|
+
# local bash session, but it can be a remote shell on other machines or on
|
47
|
+
# any shell. (eg. bash, chroot, fakechroot, ssh, tmux, lxc...)
|
48
|
+
out_context:
|
49
|
+
cmd: bash
|
50
|
+
workdir: $$kameleon_cwd
|
51
|
+
|
52
|
+
# Shell session that allows us to connect to the building machine in order to
|
53
|
+
# configure it and setup additional programs
|
54
|
+
ssh_config_file: $$kameleon_cwd/ssh_config
|
55
|
+
in_context:
|
56
|
+
cmd: LC_ALL=POSIX ssh -F $$ssh_config_file $$kameleon_recipe_name -t /bin/bash
|
57
|
+
workdir: /root/kameleon_workdir
|
58
|
+
|
59
|
+
#== Bootstrap the new system and create the 'in_context'
|
60
|
+
bootstrap:
|
61
|
+
- debootstrap:
|
62
|
+
- include_pkg: >
|
63
|
+
ifupdown locales libui-dialog-perl dialog isc-dhcp-client netbase
|
64
|
+
net-tools iproute acpid openssh-server pciutils extlinux
|
65
|
+
linux-image-$$arch
|
66
|
+
- release: $$release
|
67
|
+
- arch: $$arch
|
68
|
+
- repository: $$apt_repository
|
69
|
+
- enable_cache: true
|
70
|
+
- prepare_docker
|
71
|
+
- start_docker
|
72
|
+
|
73
|
+
|
74
|
+
#== Install and configuration steps
|
75
|
+
# WARNING: this part should be independante from the out context (whenever
|
76
|
+
# possible...)
|
77
|
+
setup:
|
78
|
+
# Install
|
79
|
+
- configure_apt:
|
80
|
+
- repository: $$apt_repository
|
81
|
+
- enable_contrib_repo: $$apt_enable_contrib
|
82
|
+
- enable_nonfree_repo: $$apt_enable_nonfree
|
83
|
+
- install_recommends: $$apt_install_recommends
|
84
|
+
- upgrade_system:
|
85
|
+
- dist_upgrade: true
|
86
|
+
- install_software:
|
87
|
+
- packages: >
|
88
|
+
debian-keyring ntp rsync sudo less vim bash-completion
|
89
|
+
# Configuration
|
90
|
+
- configure_system:
|
91
|
+
- locales: POSIX C en_US fr_FR de_DE
|
92
|
+
- lang: en_US.UTF-8
|
93
|
+
- timezone: UTC
|
94
|
+
- configure_keyboard:
|
95
|
+
- layout: "us,fr,de"
|
96
|
+
- create_group:
|
97
|
+
- name: admin
|
98
|
+
- create_user:
|
99
|
+
- name: $$user_name
|
100
|
+
- groups: sudo admin
|
101
|
+
- password: $$user_password
|
102
|
+
|
103
|
+
#== Export the generated appliance in the format of your choice
|
104
|
+
export:
|
105
|
+
- save_docker_appliance:
|
106
|
+
- commit:
|
107
|
+
- exec_out: docker commit $(cat MAIN_CONTAINER_ID) -t $$kameleon_recipe_name:latest
|
@@ -8,7 +8,7 @@
|
|
8
8
|
- exec_out: mkdir -p $$kameleon_cwd/checkpoints
|
9
9
|
- exec_out: |
|
10
10
|
if [ ! -e "$$image_disk" ] ; then
|
11
|
-
qemu-img create -f qcow2
|
11
|
+
qemu-img create -f qcow2 $$kameleon_cwd/checkpoints/base.qcow2 $$image_size
|
12
12
|
# keep a link to the last checkpoint disk
|
13
13
|
ln -sf $$kameleon_cwd/checkpoints/base.qcow2 $$image_disk
|
14
14
|
fi
|
@@ -1,13 +1,4 @@
|
|
1
|
-
|
2
|
-
- check_docker:
|
3
|
-
- on_bootstrap_init:
|
4
|
-
- exec_out: DOCKER=${DOCKER:-docker}
|
5
|
-
- rescue:
|
6
|
-
- exec_out: command -V $DOCKER
|
7
|
-
- breakpoint: >
|
8
|
-
error: Docker executable no found. Make sure Docker
|
9
|
-
is installed and/or use the DOCKER variable to set Docker
|
10
|
-
executable.
|
1
|
+
- insecure_ssh_key: $$kameleon_cwd/insecure_ssh_key
|
11
2
|
|
12
3
|
- clean_containers:
|
13
4
|
- on_checkpoint: redo
|
@@ -19,31 +10,42 @@
|
|
19
10
|
- exec_out: cat CONTAINERS_TO_CLEAN | xargs -I {} docker rm {}
|
20
11
|
- exec_out: rm -f CONTAINERS_TO_CLEAN
|
21
12
|
|
22
|
-
- import_rootfs:
|
23
|
-
- exec_out: |
|
24
|
-
docker images | grep -q $$image \
|
25
|
-
|| (echo "Importing $$image to docker..." && cat "$$rootfs_archive"\
|
26
|
-
| docker import - $$image \
|
27
|
-
| xargs -I {} docker tag {} $$image:base)
|
28
|
-
- exec_out: docker tag $$image:base $$image:latest
|
29
13
|
|
30
|
-
-
|
31
|
-
-
|
32
|
-
- exec_out: echo -e 'y\n' | ssh-keygen -q -t rsa -f $$insecure_ssh_key -N ''
|
14
|
+
- configure_ssh_access:
|
15
|
+
- exec_out: echo -e 'y\n' | ssh-keygen -q -t dsa -f $$insecure_ssh_key -N ''
|
33
16
|
- exec_out: cat $$insecure_ssh_key
|
17
|
+
- exec_out: chroot $$rootfs_download_path mkdir -p /root/.ssh
|
34
18
|
- exec_out: |
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
-
|
49
|
-
|
19
|
+
cat $${insecure_ssh_key}.pub > $$rootfs_download_path/root/.ssh/authorized_keys
|
20
|
+
cat $${insecure_ssh_key}.pub > $$rootfs_download_path/root/.ssh/kameleon_insecure_public_key
|
21
|
+
chmod 600 $$rootfs_download_path/root/.ssh/authorized_keys
|
22
|
+
chmod 755 $$rootfs_download_path/root/.ssh
|
23
|
+
- on_clean:
|
24
|
+
- exec_out: rm -rf $$rootfs_download_path/root/.ssh
|
25
|
+
|
26
|
+
- import_to_docker:
|
27
|
+
- check_cmd_out: docker
|
28
|
+
- exec_out: echo "Importing $$docker_image to docker..."
|
29
|
+
- exec_out: tar -C $$rootfs_download_path -c . | $DOCKER import - $$docker_image:base
|
30
|
+
|
31
|
+
- create_ssh_config:
|
32
|
+
- write_out:
|
33
|
+
- $$ssh_config_file
|
34
|
+
- |
|
35
|
+
Host $$kameleon_recipe_name
|
36
|
+
HostName 127.0.0.1
|
37
|
+
User root
|
38
|
+
IdentityFile $$insecure_ssh_key
|
39
|
+
UserKnownHostsFile /dev/null
|
40
|
+
StrictHostKeyChecking no
|
41
|
+
PasswordAuthentication no
|
42
|
+
IdentitiesOnly yes
|
43
|
+
LogLevel FATAL
|
44
|
+
ForwardAgent yes
|
45
|
+
ControlPath /tmp/$${kameleon_short_uuid}%r@%h:%p
|
46
|
+
ControlMaster auto
|
47
|
+
ControlPersist yes
|
48
|
+
Compression yes
|
49
|
+
Protocol 2
|
50
|
+
- on_export_clean:
|
51
|
+
- exec_out: rm -f /tmp/$${kameleon_short_uuid}*
|
@@ -1,12 +1,16 @@
|
|
1
1
|
- start_sshd:
|
2
2
|
- on_checkpoint: redo
|
3
3
|
- exec_out: |
|
4
|
-
CID=$(docker run -d -p 127.0.0.1::22 -i
|
5
|
-
|
4
|
+
CID=$(docker run -d -p 127.0.0.1::22 -i \
|
5
|
+
--dns $$docker_dns \
|
6
|
+
-h $$docker_hostname \
|
7
|
+
--privileged "$$docker_image:base" \
|
8
|
+
/bin/bash -c "service ssh restart ; tail -f /dev/null")
|
6
9
|
- exec_out: echo "$CID" >> CONTAINERS_TO_CLEAN
|
7
10
|
- exec_out: echo $CID > MAIN_CONTAINER_ID
|
8
11
|
- on_export_clean:
|
9
12
|
- exec_out: rm -f MAIN_CONTAINER_ID
|
10
13
|
- exec_out: echo $(docker port $CID 22) | cut -d':' -f2 > MAIN_CONTAINER_PORT
|
14
|
+
- exec_out: echo "Port $(cat MAIN_CONTAINER_PORT)" >> $$ssh_config_file
|
11
15
|
- on_export_clean:
|
12
16
|
- exec_out: rm -f MAIN_CONTAINER_PORT
|
@@ -47,7 +47,7 @@
|
|
47
47
|
- exec_in: |
|
48
48
|
sleep 2 && shutdown -h now &
|
49
49
|
- exec_out: |
|
50
|
-
while nc -w
|
50
|
+
while nc -w 1 -z localhost $$qemu_monitor_port
|
51
51
|
do
|
52
52
|
sleep 1
|
53
53
|
echo -n "."
|
@@ -58,7 +58,7 @@
|
|
58
58
|
- on_checkpoint: redo
|
59
59
|
- on_export_clean:
|
60
60
|
- exec_out: |
|
61
|
-
if nc -w
|
61
|
+
if nc -w 1 -z localhost $$qemu_monitor_port 2>/dev/null
|
62
62
|
then
|
63
63
|
echo "Shutting down qemu virtual machine..."
|
64
64
|
echo "system_reset" | nc localhost $$qemu_monitor_port 1>/dev/null 2>&1
|
@@ -5,7 +5,7 @@
|
|
5
5
|
- exec_in: tgz-g5k $$filename.tar.gz
|
6
6
|
- exec_out: |
|
7
7
|
rsync -avz -e "ssh -F $$out_cwd/ssh_config" \
|
8
|
-
$$kameleon_recipe_name
|
8
|
+
$$kameleon_recipe_name:$$in_cwd/$$filename.tar.gz \
|
9
9
|
$$out_cwd/$$filename.tar.gz
|
10
10
|
- exec_out: echo "Saved tar.gz appliance to $$out_cwd/$$filename.tar.gz"
|
11
11
|
- exec_in: rm -f $$in_cwd/$$filename.tar.gz
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kameleon-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-06-
|
15
|
+
date: 2014-06-16 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: childprocess
|
@@ -85,7 +85,7 @@ dependencies:
|
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 3.0
|
88
|
+
version: '3.0'
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -93,7 +93,7 @@ dependencies:
|
|
93
93
|
requirements:
|
94
94
|
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 3.0
|
96
|
+
version: '3.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: pry
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,13 +182,15 @@ email:
|
|
182
182
|
- bruno.bzeznik@imag.fr
|
183
183
|
executables:
|
184
184
|
- kameleon
|
185
|
-
extensions:
|
185
|
+
extensions:
|
186
|
+
- ext/mkrf_conf.rb
|
186
187
|
extra_rdoc_files: []
|
187
188
|
files:
|
188
189
|
- .editorconfig
|
189
190
|
- .env
|
190
191
|
- .gitignore
|
191
192
|
- AUTHORS
|
193
|
+
- CHANGELOG.rst
|
192
194
|
- COPYING
|
193
195
|
- Gemfile
|
194
196
|
- README.rst
|
@@ -233,6 +235,9 @@ files:
|
|
233
235
|
- docs/source/commands.rst
|
234
236
|
- docs/source/conf.py
|
235
237
|
- docs/source/context.rst
|
238
|
+
- docs/source/debian7.yaml
|
239
|
+
- docs/source/debian_customized.yaml
|
240
|
+
- docs/source/debian_customized_g5k.yaml
|
236
241
|
- docs/source/faq.rst
|
237
242
|
- docs/source/getting_started.rst
|
238
243
|
- docs/source/grid5000_tutorial.rst
|
@@ -240,8 +245,10 @@ files:
|
|
240
245
|
- docs/source/installation.rst
|
241
246
|
- docs/source/persistent_cache.rst
|
242
247
|
- docs/source/recipe.rst
|
248
|
+
- docs/source/tau_install_g5k.yaml
|
243
249
|
- docs/source/use_cases.rst
|
244
250
|
- docs/source/workspace.rst
|
251
|
+
- ext/mkrf_conf.rb
|
245
252
|
- kameleon-builder.gemspec
|
246
253
|
- lib/kameleon.rb
|
247
254
|
- lib/kameleon/cli.rb
|
@@ -280,10 +287,11 @@ files:
|
|
280
287
|
- templates/archlinux.yaml
|
281
288
|
- templates/debian-testing.yaml
|
282
289
|
- templates/debian7-desktop.yaml
|
283
|
-
- templates/debian7-docker.yaml
|
284
290
|
- templates/debian7-g5k.yaml
|
291
|
+
- templates/debian7-kameleon.yaml
|
285
292
|
- templates/debian7-oar-dev.yaml
|
286
293
|
- templates/debian7.yaml
|
294
|
+
- templates/docker-debian7.yaml
|
287
295
|
- templates/extend.erb
|
288
296
|
- templates/fedora-rawhide.yaml
|
289
297
|
- templates/fedora20-desktop.yaml
|
@@ -380,7 +388,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
380
388
|
requirements:
|
381
389
|
- - ! '>='
|
382
390
|
- !ruby/object:Gem::Version
|
383
|
-
version:
|
391
|
+
version: '0'
|
384
392
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
385
393
|
none: false
|
386
394
|
requirements:
|