regenbogenschmetterlingeinhornkatzchen 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +37 -0
- data/.gitmodules +3 -0
- data/LICENSE +340 -0
- data/adb-atomic-developer-bundle/.git +1 -0
- data/adb-atomic-developer-bundle/.gitignore +39 -0
- data/adb-atomic-developer-bundle/LICENSE +340 -0
- data/adb-atomic-developer-bundle/README.md +21 -0
- data/adb-atomic-developer-bundle/components/boxes/vagrant-boxes.md +28 -0
- data/adb-atomic-developer-bundle/components/centos/centos-standalone/README.md +2 -0
- data/adb-atomic-developer-bundle/components/centos/centos-standalone/UNTESTED +0 -0
- data/adb-atomic-developer-bundle/components/centos/centos-standalone/Vagrantfile +25 -0
- data/adb-atomic-developer-bundle/components/centos/centos-with-docker/atomic-docker-host/UNTESTED +0 -0
- data/adb-atomic-developer-bundle/components/centos/centos-with-docker/atomic-docker-host/Vagrantfile +22 -0
- data/adb-atomic-developer-bundle/components/centos/centos-with-docker/centos-docker-host/UNTESTED +0 -0
- data/adb-atomic-developer-bundle/components/centos/centos-with-docker/centos-docker-host/Vagrantfile +23 -0
- data/adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/README.md +3 -0
- data/adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/UNTESTED +0 -0
- data/adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/Vagrantfile +12 -0
- data/adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/atomic-Vagrantfile +12 -0
- data/adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/centos-Vagrantfile +12 -0
- data/adb-atomic-developer-bundle/components/rhel/README.md +1 -0
- data/adb-atomic-developer-bundle/components/rhel/rhel-standalone/README.md +1 -0
- data/adb-atomic-developer-bundle/components/rhel/rhel-standalone/Vagrantfile +26 -0
- data/adb-atomic-developer-bundle/components/rhel/rhel-with-docker/atomic-docker-host/Vagrantfile +22 -0
- data/adb-atomic-developer-bundle/components/rhel/rhel-with-docker/rhel-docker-host/Vagrantfile +24 -0
- data/adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/README.md +3 -0
- data/adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/Vagrantfile +12 -0
- data/adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/atomic-Vagrantfile +12 -0
- data/adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/rhel-Vagrantfile +12 -0
- data/adb-atomic-developer-bundle/extras/vagrant-dockerfile/Dockerfile +10 -0
- data/adb-atomic-developer-bundle/extras/vagrant-dockerfile/runner.sh +6 -0
- data/adb-atomic-developer-bundle/motivation.md +24 -0
- data/adb-atomic-developer-bundle/tests/rhel-with-docker/test-rhel-docker.sh +64 -0
- data/adb-atomic-developer-bundle/tests/standalone-rhel/test-base-rhel.sh +61 -0
- data/adb-atomic-developer-bundle/tests/standalone-rhel/test-base-rhel.withKnownBug.sh +69 -0
- data/bin/regenbogenschmetterlingeinhornkatzchen.rb +114 -0
- data/examples/Dockerfile +20 -0
- data/examples/start.sh +12 -0
- data/lib/regenbogenschmetterlingeinhornkatzchen.rb +114 -0
- data/regenbogenschmetterlingeinhornkatzchen.gemspec +43 -0
- metadata +84 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker'
|
2
|
+
Vagrant.configure("2") do |config|
|
3
|
+
config.vm.define "app" do |app|
|
4
|
+
app.vm.provider "docker" do |d|
|
5
|
+
d.build_dir = "."
|
6
|
+
d.vagrant_vagrantfile = "../rhel-docker-host/Vagrantfile"
|
7
|
+
d.force_host_vm = "true"
|
8
|
+
end
|
9
|
+
app.vm.synced_folder './', '/app'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
FROM fedora:20
|
2
|
+
RUN yum -y install bash-completion bind-utils
|
3
|
+
RUN yum -y groupinstall 'Development Tools'
|
4
|
+
RUN yum -y install dnf dnf-plugins-core
|
5
|
+
RUN dnf copr -y enable jstribny/vagrant-f20
|
6
|
+
RUN yum -y install vagrant rubygem-vagrant-libvirt
|
7
|
+
RUN echo export VAGRANT_HOME=/mnt/vagrant-home >> /root/.bashrc
|
8
|
+
|
9
|
+
|
10
|
+
VOLUME /var/lib/libvirt
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#Motivation
|
2
|
+
Many people are considering using containers as a method of distributing applications. If you search the internet there is a lot of content similar to developing "hello world" but not much with regards to "enterprise container development." How is this different? Well, when developing with containers, much of the rules about application architecture, while not "different," are certainly more strictly enforced. For example, "decomposition of applications in to services." In a traditional application environment, on a virtual machine, for example, nothing really enforces that the services are actually independent until, during scale-out, you find out the hard way (unless you did really good testing). With containers, you find out immediately because the service isolation is enforced at any scale.
|
3
|
+
|
4
|
+
With this project, we are hoping to gather recommendations, architectural justifications, approaches, etc. that support development with containers after you have graduated from toying with containers and are truly looking to deliver enterprise-class applications.
|
5
|
+
|
6
|
+
The project also provides tools to simplify re-architecting applications to leverage containers and the development of new applications based on containers.
|
7
|
+
|
8
|
+
The project specifically focuses on providing tools and documentation based on Fedora, RHEL, and CentOS, but much of the content should be equally applicable to other enterprise operating systems.
|
9
|
+
|
10
|
+
#Approach
|
11
|
+
The project has chosen Vagrant as a semi-universal way of describing development environments and, in related projects, made sure that Vagrant works well on the three target platforms (Fedora, RHEL, and CentOS).
|
12
|
+
|
13
|
+
In order to support this endeavor, the OS communities have started to make official "Vagrant boxes" available for both the main-line OS and the Atomic variants that are pre-configured to support container development.
|
14
|
+
|
15
|
+
- Fedora: http://fedoraproject.org/wiki/Changes/Vagrant_Box_Atomic
|
16
|
+
- CentOS: TBD
|
17
|
+
- RHEL: TBD
|
18
|
+
|
19
|
+
The project has provided [Vagrantfiles](http://docs.vagrantup.com/v2/vagrantfile/index.html) to setup both regular instances of the OSs as well as a "docker host" leveraging the [Vagrant Docker Provider](http://docs.vagrantup.com/v2/docker/index.html).
|
20
|
+
|
21
|
+
The project has also been working with Aaron's https://github.com/aweiteka/UATFramework which is an "implementation" of [Behave](http://pythonhosted.org/behave/) framework which can work across machines to provides tests. However, that work hasn't been integrated here yet and, currently, the only tests are some shell scripts.
|
22
|
+
|
23
|
+
#Next
|
24
|
+
Let us know what else you think would be helpful.
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
export PATH="/bin:/usr/bin"
|
4
|
+
STATUS=0
|
5
|
+
|
6
|
+
#get the plugin installed
|
7
|
+
vagrant plugin install vagrant-registration
|
8
|
+
|
9
|
+
#do we have any now?
|
10
|
+
exec 5>&1 && OUTPUT=$(vagrant plugin list | tee >(cat - >&5))
|
11
|
+
if [ $? -ne 0 ]; then
|
12
|
+
STATUS=$?
|
13
|
+
echo "No plugins at all: Vagrant plugin test FAILED"
|
14
|
+
exit $STATUS
|
15
|
+
fi
|
16
|
+
|
17
|
+
#do we have the reg plugin?
|
18
|
+
TEST=$(echo "$OUTPUT" | grep vagrant-registration)
|
19
|
+
STATUS=$?
|
20
|
+
if [ -z "$TEST" ]; then
|
21
|
+
echo "Plugin vagrant-registration did not get installed: Vagrant plugin test FAILED"
|
22
|
+
echo "Output of vagrant plugin list:\n$OUTPUT\n"
|
23
|
+
echo "Result of \"echo \$OUTPUT | grep vagrant-registration\":\n$TEST\n"
|
24
|
+
exit $STATUS
|
25
|
+
fi
|
26
|
+
|
27
|
+
#lets pull over the files to test
|
28
|
+
cp -R ./../components/rhel-with-docker ./
|
29
|
+
cd rhel-with-docker/dev/
|
30
|
+
|
31
|
+
echo "incomplete test"
|
32
|
+
exit
|
33
|
+
|
34
|
+
#lets try and bring the machine up
|
35
|
+
OUTPUT=$(vagrant up | tee >(cat - >&5))
|
36
|
+
STATUS=$?
|
37
|
+
if [ $? -ne 0 ]; then
|
38
|
+
echo "Failed to bring up the machine: Launch FAILED"
|
39
|
+
exit $STATUS
|
40
|
+
fi
|
41
|
+
|
42
|
+
#lets test that we can connect
|
43
|
+
OUTPUT=$(vagrant ssh -c 'echo \"connected!\"' | tee >(cat - >&5))
|
44
|
+
STATUS=$?
|
45
|
+
TEST=$(echo "$OUTPUT" | grep connected)
|
46
|
+
if [ -z "$TEST" ]; then
|
47
|
+
echo "Failed to connect to the machine: connect FAILED"
|
48
|
+
exit $STATUS
|
49
|
+
fi
|
50
|
+
|
51
|
+
#lets test that we are subscribed
|
52
|
+
OUTPUT=$(vagrant ssh -c 'sudo subscription-manager status' | tee >(cat - >&5))
|
53
|
+
STATUS=$?
|
54
|
+
TEST=$(echo "$OUTPUT" | grep Current)
|
55
|
+
if [ -z "$TEST" ]; then
|
56
|
+
echo "We are not subscribed: subscribe FAILED"
|
57
|
+
exit $STATUS
|
58
|
+
fi
|
59
|
+
|
60
|
+
#time to clean up
|
61
|
+
vagrant destroy -f
|
62
|
+
rm -rf .vagrant.d Vagrantfile
|
63
|
+
|
64
|
+
echo "Test(s) complete!"
|
@@ -0,0 +1,61 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
export PATH="/bin:/usr/bin"
|
4
|
+
STATUS=0
|
5
|
+
|
6
|
+
echo "get the plugin installed"
|
7
|
+
vagrant plugin install vagrant-registration
|
8
|
+
|
9
|
+
echo "do we have any plugins now?"
|
10
|
+
exec 5>&1 && OUTPUT=$(vagrant plugin list | tee >(cat - >&5))
|
11
|
+
if [ $? -ne 0 ]; then
|
12
|
+
STATUS=$?
|
13
|
+
echo "No plugins at all: Vagrant plugin test FAILED"
|
14
|
+
exit $STATUS
|
15
|
+
fi
|
16
|
+
|
17
|
+
echo "do we have the vagrant-registration plugin?"
|
18
|
+
TEST=$(echo "$OUTPUT" | grep vagrant-registration)
|
19
|
+
STATUS=$?
|
20
|
+
if [ -z "$TEST" ]; then
|
21
|
+
echo "Plugin vagrant-registration did not get installed: Vagrant plugin test FAILED"
|
22
|
+
echo "Output of vagrant plugin list:\n$OUTPUT\n"
|
23
|
+
echo "Result of \"echo \$OUTPUT | grep vagrant-registration\":\n$TEST\n"
|
24
|
+
exit $STATUS
|
25
|
+
fi
|
26
|
+
|
27
|
+
echo "let's pull over the vagrantfile to test"
|
28
|
+
rm ./Vagrantfile
|
29
|
+
ln -s ../../components/standalone-rhel/Vagrantfile ./
|
30
|
+
|
31
|
+
echo "let's try and bring the machine up"
|
32
|
+
exec 5>&1 && OUTPUT=$(vagrant up | tee >(cat - >&5))
|
33
|
+
STATUS=$?
|
34
|
+
if [ $? -ne 0 ]; then
|
35
|
+
echo "Failed to bring up the machine: Launch FAILED"
|
36
|
+
exit $STATUS
|
37
|
+
fi
|
38
|
+
|
39
|
+
echo "let's test that we can connect"
|
40
|
+
OUTPUT=$(vagrant ssh -c 'echo \"connected!\"' | tee >(cat - >&5))
|
41
|
+
STATUS=$?
|
42
|
+
TEST=$(echo "$OUTPUT" | grep connected)
|
43
|
+
if [ -z "$TEST" ]; then
|
44
|
+
echo "Failed to connect to the machine: connect FAILED"
|
45
|
+
exit $STATUS
|
46
|
+
fi
|
47
|
+
|
48
|
+
echo "let's test that we are subscribed"
|
49
|
+
OUTPUT=$(vagrant ssh -c 'sudo subscription-manager status' | tee >(cat - >&5))
|
50
|
+
STATUS=$?
|
51
|
+
TEST=$(echo "$OUTPUT" | grep Current)
|
52
|
+
if [ -z "$TEST" ]; then
|
53
|
+
echo "We are not subscribed: subscribe FAILED"
|
54
|
+
exit $STATUS
|
55
|
+
fi
|
56
|
+
|
57
|
+
echo "time to clean up"
|
58
|
+
vagrant destroy -f
|
59
|
+
rm -rf .vagrant.d Vagrantfile
|
60
|
+
|
61
|
+
echo "tests complete!"
|
@@ -0,0 +1,69 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
export PATH="/bin:/usr/bin"
|
4
|
+
STATUS=0
|
5
|
+
|
6
|
+
echo "get the plugin installed"
|
7
|
+
vagrant plugin install vagrant-registration
|
8
|
+
|
9
|
+
echo "do we have any plugins now?"
|
10
|
+
exec 5>&1 && OUTPUT=$(vagrant plugin list | tee >(cat - >&5))
|
11
|
+
if [ $? -ne 0 ]; then
|
12
|
+
STATUS=$?
|
13
|
+
echo "No plugins at all: Vagrant plugin test FAILED"
|
14
|
+
exit $STATUS
|
15
|
+
fi
|
16
|
+
|
17
|
+
echo "do we have the vagrant-registration plugin?"
|
18
|
+
TEST=$(echo "$OUTPUT" | grep vagrant-registration)
|
19
|
+
STATUS=$?
|
20
|
+
if [ -z "$TEST" ]; then
|
21
|
+
echo "Plugin vagrant-registration did not get installed: Vagrant plugin test FAILED"
|
22
|
+
echo "Output of vagrant plugin list:\n$OUTPUT\n"
|
23
|
+
echo "Result of \"echo \$OUTPUT | grep vagrant-registration\":\n$TEST\n"
|
24
|
+
exit $STATUS
|
25
|
+
fi
|
26
|
+
|
27
|
+
echo "let\'s pull over the vagrantfile to test"
|
28
|
+
rm ./Vagrantfile
|
29
|
+
ln -s ../../components/standalone-rhel/Vagrantfile ./
|
30
|
+
|
31
|
+
echo "let\'s try and bring the machine up \(but without provisioning to work around https://github.com/whitel/vagrant-registration/issues/8\)"
|
32
|
+
exec 5>&1 && OUTPUT=$(vagrant up --no-provision | tee >(cat - >&5))
|
33
|
+
STATUS=$?
|
34
|
+
if [ $? -ne 0 ]; then
|
35
|
+
echo "Failed to bring up the machine: Launch FAILED"
|
36
|
+
exit $STATUS
|
37
|
+
fi
|
38
|
+
|
39
|
+
echo "let\'s test that we can connect"
|
40
|
+
OUTPUT=$(vagrant ssh -c 'echo \"connected!\"' | tee >(cat - >&5))
|
41
|
+
STATUS=$?
|
42
|
+
TEST=$(echo "$OUTPUT" | grep connected)
|
43
|
+
if [ -z "$TEST" ]; then
|
44
|
+
echo "Failed to connect to the machine: connect FAILED"
|
45
|
+
exit $STATUS
|
46
|
+
fi
|
47
|
+
|
48
|
+
echo "let\'s test that we are subscribed"
|
49
|
+
OUTPUT=$(vagrant ssh -c 'sudo subscription-manager status' | tee >(cat - >&5))
|
50
|
+
STATUS=$?
|
51
|
+
TEST=$(echo "$OUTPUT" | grep Current)
|
52
|
+
if [ -z "$TEST" ]; then
|
53
|
+
echo "We are not subscribed: subscribe FAILED"
|
54
|
+
exit $STATUS
|
55
|
+
fi
|
56
|
+
|
57
|
+
echo "let\'s try and do the provisioning"
|
58
|
+
OUTPUT=$(vagrant up --provision | tee >(cat - >&5))
|
59
|
+
STATUS=$?
|
60
|
+
if [ $? -ne 0 ]; then
|
61
|
+
echo "Failed to provision the machine: Launch FAILED"
|
62
|
+
exit $STATUS
|
63
|
+
fi
|
64
|
+
|
65
|
+
echo "time to clean up"
|
66
|
+
vagrant destroy -f
|
67
|
+
rm -rf .vagrant.d Vagrantfile
|
68
|
+
|
69
|
+
echo "tests complete!"
|
@@ -0,0 +1,114 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'commander/import'
|
5
|
+
|
6
|
+
program :version, '0.0.1'
|
7
|
+
program :description, 'Pllm'
|
8
|
+
|
9
|
+
adb_path = File.join(File.dirname(__FILE__), '..') + "/adb-atomic-developer-bundle/components"
|
10
|
+
centos_adb_path = adb_path+"/centos/centos-with-docker"
|
11
|
+
rhel_adb_path = adb_path+"/rhel/rhel-with-docker"
|
12
|
+
vagrant_base_cmd = "vagrant"
|
13
|
+
dockerfile_example_path = File.join(File.dirname(__FILE__), '..') + "/examples/Dockerfile"
|
14
|
+
|
15
|
+
command :new do |c|
|
16
|
+
c.syntax = 'cdk new [options]'
|
17
|
+
c.summary = 'Create new container'
|
18
|
+
c.description = 'Create directory with container and host configurations'
|
19
|
+
c.example 'Create new container configuration with atomic host to deploy', 'cdk new Geablestapler --host rhel-atomic'
|
20
|
+
c.option '--name NAME', String, 'Define name of a container'
|
21
|
+
c.option '--host TYPE', String, 'Define host to setup to later deployement'
|
22
|
+
c.action do |args, options|
|
23
|
+
if options.name && options.host
|
24
|
+
FileUtils.mkdir_p "#{options.name}/host"
|
25
|
+
host_vagrant_file_path = ""
|
26
|
+
guest_vagrant_file_path = ""
|
27
|
+
|
28
|
+
case options.host
|
29
|
+
when "rhel-atomic"
|
30
|
+
host_vagrant_file_path = rhel_adb_path+'/atomic-docker-host/Vagrantfile'
|
31
|
+
guest_vagrant_file_path = rhel_adb_path+'/sample-dev/Vagrantfile'
|
32
|
+
when "rhel-docker"
|
33
|
+
host_vagrant_file_path = rhel_adb_path+'/rhel-docker-host/Vagrantfile'
|
34
|
+
guest_vagrant_file_path = rhel_adb_path+'/sample-dev/Vagrantfile'
|
35
|
+
when "centos-atomic"
|
36
|
+
host_vagrant_file_path = centos_adb_path+'/atomic-docker-host/Vagrantfile'
|
37
|
+
guest_vagrant_file_path = centos_adb_path+'/sample-dev/Vagrantfile'
|
38
|
+
when "centos-docker"
|
39
|
+
host_vagrant_file_path = centos_adb_path+'/centos-docker-host/Vagrantfile'
|
40
|
+
guest_vagrant_file_path = centos_adb_path+'/sample-dev/Vagrantfile'
|
41
|
+
end
|
42
|
+
|
43
|
+
FileUtils.cp host_vagrant_file_path, "./#{options.name}/host/"
|
44
|
+
say "#{options.host} host Vagrantfile prepared"
|
45
|
+
FileUtils.cp guest_vagrant_file_path, "./#{options.name}/"
|
46
|
+
|
47
|
+
text = File.read("./#{options.name}/Vagrantfile")
|
48
|
+
new_contents = text.gsub(/(d.vagrant_vagrantfile[A-Za-z\t . _ = " \/ -]+)/, "d.vagrant_vagrantfile = \"./host/Vagrantfile\"")
|
49
|
+
# To write changes to the file, use:
|
50
|
+
File.open("./#{options.name}/Vagrantfile", "w") {|file| file.puts new_contents }
|
51
|
+
|
52
|
+
say "#{options.name} Guest Vagrantfile prepared"
|
53
|
+
|
54
|
+
if agree "do you want to generate Dockerfile?", false
|
55
|
+
FileUtils.cp dockerfile_example_path, "./#{options.name}/"
|
56
|
+
end
|
57
|
+
else
|
58
|
+
say "You have to specify name and host"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
command :run do |c|
|
64
|
+
c.syntax = 'cdk run'
|
65
|
+
c.summary = 'Run container on host using vagrant'
|
66
|
+
c.description = 'This command invokes vagrant up in current directory'
|
67
|
+
c.example 'Run container from Vagrantfile in current directory', 'cdk run'
|
68
|
+
c.action do |args, options|
|
69
|
+
# Do something or c.when_called Cdk::Commands::List
|
70
|
+
exec("#{vagrant_base_cmd} up")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
command :list do |c|
|
75
|
+
c.syntax = 'cdk list [options]'
|
76
|
+
c.summary = ''
|
77
|
+
c.description = ''
|
78
|
+
c.example 'description', 'command example'
|
79
|
+
c.option '--some-switch', 'Some switch that does something'
|
80
|
+
c.action do |args, options|
|
81
|
+
# Do something or c.when_called Cdk::Commands::List
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
command :destroy do |c|
|
86
|
+
c.syntax = 'cdk destroy [options]'
|
87
|
+
c.summary = ''
|
88
|
+
c.description = ''
|
89
|
+
c.example 'description', 'command example'
|
90
|
+
c.option '--some-switch', 'Some switch that does something'
|
91
|
+
c.action do |args, options|
|
92
|
+
# Do something or c.when_called Cdk::Commands::Destroy
|
93
|
+
end
|
94
|
+
|
95
|
+
command :host do |c|
|
96
|
+
c.syntax = 'sdc host [options]'
|
97
|
+
c.summary = ''
|
98
|
+
c.description = ''
|
99
|
+
c.example 'description', 'command example'
|
100
|
+
c.option '--create', 'Some switch that does something'
|
101
|
+
c.option '--delete', 'Some switch that does something'
|
102
|
+
c.option '--list', 'Some switch that does something'
|
103
|
+
c.action do |args, options|
|
104
|
+
if options.list
|
105
|
+
say("Your current options:")
|
106
|
+
say("rhel-docker, rhel-atomic, centos-docker, centos-atomic")
|
107
|
+
end
|
108
|
+
# Do something or c.when_called Cdk::Commands::List
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
end
|
114
|
+
|
data/examples/Dockerfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# "ported" by Adam Miller <maxamillion@fedoraproject.org> from
|
2
|
+
# https://github.com/fedora-cloud/Fedora-Dockerfiles
|
3
|
+
#
|
4
|
+
# Originally written for Fedora-Dockerfiles by
|
5
|
+
# scollier <scollier@redhat.com>
|
6
|
+
|
7
|
+
FROM centos:centos7
|
8
|
+
MAINTAINER The CentOS Project <cloud-ops@centos.org>
|
9
|
+
|
10
|
+
RUN yum -y update; yum clean all
|
11
|
+
RUN yum -y install openssh-server passwd; yum clean all
|
12
|
+
ADD ./start.sh /start.sh
|
13
|
+
RUN mkdir /var/run/sshd
|
14
|
+
|
15
|
+
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
|
16
|
+
|
17
|
+
RUN chmod 755 /start.sh
|
18
|
+
# EXPOSE 22
|
19
|
+
RUN ./start.sh
|
20
|
+
ENTRYPOINT ["/usr/sbin/sshd", "-D"]
|
data/examples/start.sh
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
__create_user() {
|
4
|
+
# Create a user to SSH into as.
|
5
|
+
useradd user
|
6
|
+
SSH_USERPASS=newpass
|
7
|
+
echo -e "$SSH_USERPASS\n$SSH_USERPASS" | (passwd --stdin user)
|
8
|
+
echo ssh user password: $SSH_USERPASS
|
9
|
+
}
|
10
|
+
|
11
|
+
# Call all functions
|
12
|
+
__create_user
|
@@ -0,0 +1,114 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'commander/import'
|
5
|
+
|
6
|
+
program :version, '0.0.1'
|
7
|
+
program :description, 'Pllm'
|
8
|
+
|
9
|
+
adb_path = "adb-atomic-developer-bundle/components"
|
10
|
+
centos_adb_path = adb_path+"/centos/centos-with-docker"
|
11
|
+
rhel_adb_path = adb_path+"/rhel/rhel-with-docker"
|
12
|
+
vagrant_base_cmd = "vagrant"
|
13
|
+
dockerfile_example_path = "./examples/Dockerfile"
|
14
|
+
|
15
|
+
command :new do |c|
|
16
|
+
c.syntax = 'cdk new [options]'
|
17
|
+
c.summary = 'Create new container'
|
18
|
+
c.description = 'Create directory with container and host configurations'
|
19
|
+
c.example 'Create new container configuration with atomic host to deploy', 'cdk new Geablestapler --host rhel-atomic'
|
20
|
+
c.option '--name NAME', String, 'Define name of a container'
|
21
|
+
c.option '--host TYPE', String, 'Define host to setup to later deployement'
|
22
|
+
c.action do |args, options|
|
23
|
+
if options.name && options.host
|
24
|
+
FileUtils.mkdir_p "#{options.name}/host"
|
25
|
+
host_vagrant_file_path = ""
|
26
|
+
guest_vagrant_file_path = ""
|
27
|
+
|
28
|
+
case options.host
|
29
|
+
when "rhel-atomic"
|
30
|
+
host_vagrant_file_path = rhel_adb_path+'/atomic-docker-host/Vagrantfile'
|
31
|
+
guest_vagrant_file_path = rhel_adb_path+'/sample-dev/Vagrantfile'
|
32
|
+
when "rhel-docker"
|
33
|
+
host_vagrant_file_path = rhel_adb_path+'/rhel-docker-host/Vagrantfile'
|
34
|
+
guest_vagrant_file_path = rhel_adb_path+'/sample-dev/Vagrantfile'
|
35
|
+
when "centos-atomic"
|
36
|
+
host_vagrant_file_path = centos_adb_path+'/atomic-docker-host/Vagrantfile'
|
37
|
+
guest_vagrant_file_path = centos_adb_path+'/sample-dev/Vagrantfile'
|
38
|
+
when "centos-docker"
|
39
|
+
host_vagrant_file_path = centos_adb_path+'/centos-docker-host/Vagrantfile'
|
40
|
+
guest_vagrant_file_path = centos_adb_path+'/sample-dev/Vagrantfile'
|
41
|
+
end
|
42
|
+
|
43
|
+
FileUtils.cp host_vagrant_file_path, "./#{options.name}/host/"
|
44
|
+
say "#{options.host} host Vagrantfile prepared"
|
45
|
+
FileUtils.cp guest_vagrant_file_path, "./#{options.name}/"
|
46
|
+
|
47
|
+
text = File.read("./#{options.name}/Vagrantfile")
|
48
|
+
new_contents = text.gsub(/(d.vagrant_vagrantfile[A-Za-z\t . _ = " \/ -]+)/, "d.vagrant_vagrantfile = \"./host/Vagrantfile\"")
|
49
|
+
# To write changes to the file, use:
|
50
|
+
File.open("./#{options.name}/Vagrantfile", "w") {|file| file.puts new_contents }
|
51
|
+
|
52
|
+
say "#{options.name} Guest Vagrantfile prepared"
|
53
|
+
|
54
|
+
if agree "do you want to generate Dockerfile?", false
|
55
|
+
FileUtils.cp dockerfile_example_path, "./#{options.name}/"
|
56
|
+
end
|
57
|
+
else
|
58
|
+
say "You have to specify name and host"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
command :run do |c|
|
64
|
+
c.syntax = 'cdk run'
|
65
|
+
c.summary = 'Run container on host using vagrant'
|
66
|
+
c.description = 'This command invokes vagrant up in current directory'
|
67
|
+
c.example 'Run container from Vagrantfile in current directory', 'cdk run'
|
68
|
+
c.action do |args, options|
|
69
|
+
# Do something or c.when_called Cdk::Commands::List
|
70
|
+
exec("#{vagrant_base_cmd} up")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
command :list do |c|
|
75
|
+
c.syntax = 'cdk list [options]'
|
76
|
+
c.summary = ''
|
77
|
+
c.description = ''
|
78
|
+
c.example 'description', 'command example'
|
79
|
+
c.option '--some-switch', 'Some switch that does something'
|
80
|
+
c.action do |args, options|
|
81
|
+
# Do something or c.when_called Cdk::Commands::List
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
command :destroy do |c|
|
86
|
+
c.syntax = 'cdk destroy [options]'
|
87
|
+
c.summary = ''
|
88
|
+
c.description = ''
|
89
|
+
c.example 'description', 'command example'
|
90
|
+
c.option '--some-switch', 'Some switch that does something'
|
91
|
+
c.action do |args, options|
|
92
|
+
# Do something or c.when_called Cdk::Commands::Destroy
|
93
|
+
end
|
94
|
+
|
95
|
+
command :host do |c|
|
96
|
+
c.syntax = 'sdc host [options]'
|
97
|
+
c.summary = ''
|
98
|
+
c.description = ''
|
99
|
+
c.example 'description', 'command example'
|
100
|
+
c.option '--create', 'Some switch that does something'
|
101
|
+
c.option '--delete', 'Some switch that does something'
|
102
|
+
c.option '--list', 'Some switch that does something'
|
103
|
+
c.action do |args, options|
|
104
|
+
if options.list
|
105
|
+
say("Your current options:")
|
106
|
+
say("rhel-docker, rhel-atomic, centos-docker, centos-atomic")
|
107
|
+
end
|
108
|
+
# Do something or c.when_called Cdk::Commands::List
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
end
|
114
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'regenbogenschmetterlingeinhornkatzchen'
|
3
|
+
s.version = '0.0.0'
|
4
|
+
s.date = '2012-03-23'
|
5
|
+
s.summary = "CDK wrapper"
|
6
|
+
s.description = "Wraper around couple of vagrantfiles and dockerfiles"
|
7
|
+
s.authors = ["Tomas Hrcka"]
|
8
|
+
s.email = 'thrcka@redhat.com'
|
9
|
+
s.homepage =
|
10
|
+
'http://rubygems.org/gems/hola'
|
11
|
+
s.license = 'GPL-2'
|
12
|
+
|
13
|
+
# this gemspec is, and parsing out the ignored files from the gitignore.
|
14
|
+
# Note that the entire gitignore(5) syntax is not supported, specifically
|
15
|
+
# the "!" syntax, but it should mostly work correctly.
|
16
|
+
root_path = File.dirname(__FILE__)
|
17
|
+
all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
|
18
|
+
all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
|
19
|
+
gitignore_path = File.join(root_path, ".gitignore")
|
20
|
+
gitignore = File.readlines(gitignore_path)
|
21
|
+
gitignore.map! { |line| line.chomp.strip }
|
22
|
+
gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
|
23
|
+
|
24
|
+
unignored_files = all_files.reject do |file|
|
25
|
+
# Ignore any directories, the gemspec only cares about files
|
26
|
+
next true if File.directory?(file)
|
27
|
+
|
28
|
+
# Ignore any paths that match anything in the gitignore. We do
|
29
|
+
# two tests here:
|
30
|
+
#
|
31
|
+
# - First, test to see if the entire path matches the gitignore.
|
32
|
+
# - Second, match if the basename does, this makes it so that things
|
33
|
+
# like '.DS_Store' will match sub-directories too (same behavior
|
34
|
+
# as git).
|
35
|
+
#
|
36
|
+
gitignore.any? do |ignore|
|
37
|
+
File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
|
38
|
+
File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
s.files = unignored_files
|
42
|
+
s.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: regenbogenschmetterlingeinhornkatzchen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tomas Hrcka
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2012-03-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Wraper around couple of vagrantfiles and dockerfiles
|
14
|
+
email: thrcka@redhat.com
|
15
|
+
executables:
|
16
|
+
- regenbogenschmetterlingeinhornkatzchen.rb
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- adb-atomic-developer-bundle/README.md
|
21
|
+
- adb-atomic-developer-bundle/LICENSE
|
22
|
+
- adb-atomic-developer-bundle/tests/standalone-rhel/test-base-rhel.sh
|
23
|
+
- adb-atomic-developer-bundle/tests/standalone-rhel/test-base-rhel.withKnownBug.sh
|
24
|
+
- adb-atomic-developer-bundle/tests/rhel-with-docker/test-rhel-docker.sh
|
25
|
+
- adb-atomic-developer-bundle/motivation.md
|
26
|
+
- adb-atomic-developer-bundle/components/rhel/README.md
|
27
|
+
- adb-atomic-developer-bundle/components/rhel/rhel-standalone/README.md
|
28
|
+
- adb-atomic-developer-bundle/components/rhel/rhel-standalone/Vagrantfile
|
29
|
+
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/rhel-docker-host/Vagrantfile
|
30
|
+
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/atomic-docker-host/Vagrantfile
|
31
|
+
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/atomic-Vagrantfile
|
32
|
+
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/README.md
|
33
|
+
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/rhel-Vagrantfile
|
34
|
+
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/Vagrantfile
|
35
|
+
- adb-atomic-developer-bundle/components/centos/centos-standalone/README.md
|
36
|
+
- adb-atomic-developer-bundle/components/centos/centos-standalone/Vagrantfile
|
37
|
+
- adb-atomic-developer-bundle/components/centos/centos-standalone/UNTESTED
|
38
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/centos-docker-host/Vagrantfile
|
39
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/centos-docker-host/UNTESTED
|
40
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/atomic-docker-host/Vagrantfile
|
41
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/atomic-docker-host/UNTESTED
|
42
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/atomic-Vagrantfile
|
43
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/README.md
|
44
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/Vagrantfile
|
45
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/centos-Vagrantfile
|
46
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/UNTESTED
|
47
|
+
- adb-atomic-developer-bundle/components/boxes/vagrant-boxes.md
|
48
|
+
- adb-atomic-developer-bundle/extras/vagrant-dockerfile/Dockerfile
|
49
|
+
- adb-atomic-developer-bundle/extras/vagrant-dockerfile/runner.sh
|
50
|
+
- LICENSE
|
51
|
+
- examples/Dockerfile
|
52
|
+
- examples/start.sh
|
53
|
+
- lib/regenbogenschmetterlingeinhornkatzchen.rb
|
54
|
+
- regenbogenschmetterlingeinhornkatzchen.gemspec
|
55
|
+
- bin/regenbogenschmetterlingeinhornkatzchen.rb
|
56
|
+
- .gitmodules
|
57
|
+
- adb-atomic-developer-bundle/.git
|
58
|
+
- adb-atomic-developer-bundle/.gitignore
|
59
|
+
- .gitignore
|
60
|
+
homepage: http://rubygems.org/gems/hola
|
61
|
+
licenses:
|
62
|
+
- GPL-2
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.0.14
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: CDK wrapper
|
84
|
+
test_files: []
|