Skip to content

Commit 3040d1f

Browse files
committed
Merge pull request #185 from rwaffen/dockerdockerdocker
Dockerdockerdocker
2 parents 0b4d8d1 + 7235ce2 commit 3040d1f

8 files changed

Lines changed: 114 additions & 0 deletions

File tree

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,40 @@ To deploy a Opennebula instance locally run:
4949

5050
where "boxname" can be debian or centos
5151

52+
## Docker
53+
54+
To deploy a Opennebula instance locally in a docker container run these commandos:
55+
56+
First build an image with puppet and the sources in it (Depending on centos:6):
57+
58+
cd docker
59+
docker build --rm -t epost-dev/one .
60+
cd ..
61+
62+
Run puppet in the container, choose one:
63+
64+
Only build a container which acts as a opennebula head, gui, but not the kvm things:
65+
66+
docker run --rm -v $(pwd):/etc/puppet/modules/one epost-dev/one puppet apply /etc/puppet/modules/one/spec/docker-int/one-head.pp
67+
68+
Only build a container which acts like a opennebula node:
69+
70+
# here is a common error i wasn't able to fix. centos 6 in docker has some issues with ksm
71+
docker run --rm -v $(pwd):/etc/puppet/modules/one epost-dev/one puppet apply /etc/puppet/modules/one/spec/docker-int/one-node.pp
72+
73+
Build a container which acts as head and node
74+
75+
docker run --rm -v $(pwd):/etc/puppet/modules/one epost-dev/one puppet apply /etc/puppet/modules/one/spec/docker-int/one-head-node.pp
76+
77+
Build a container which has an apache for the openenbula sunstone configured:
78+
79+
docker run --rm -v $(pwd):/etc/puppet/modules/one epost-dev/one puppet apply /etc/puppet/modules/one/spec/docker-int/one-head-httpd.pp
80+
81+
This Docker command will add the current directory as ```ect/puppet/modules/one```. So one can test each new change without committing or rebuilding the image.
82+
83+
The "spec" files can be found in the spec/docker-int directory of this project. One will build a one head,
84+
one will build a node and one a head which also can be a node.
85+
5286
## Using the Module
5387

5488
Example usage for opennebula puppet module

docker/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM centos:6
2+
MAINTAINER Robert Waffen "robert.waffen@epost-dev.de"
3+
4+
ENV HOSTNAME localhost
5+
ENV LANG=en_US.UTF-8
6+
ENV LANGUAGE=en_US.UTF-8
7+
ENV LC_ALL=en_US.UTF-8
8+
ENV FACTER_operatingsystemmajrelease="6"
9+
ENV FACTER_operatingsystemrelease="6.7"
10+
ENV FACTER_lsbmajdistrelease="6"
11+
12+
RUN yum -y install https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm epel-release
13+
RUN yum makecache && yum -y install puppet tar hostname
14+
15+
RUN puppet module install puppetlabs-apt
16+
RUN puppet module install puppetlabs-concat
17+
RUN puppet module install puppetlabs-mysql
18+
RUN puppet module install puppetlabs-apache
19+
RUN puppet module install puppetlabs-corosync
20+
RUN puppet module install rodjek-logrotate
21+
22+
COPY hiera/hiera.yaml /etc/puppet/
23+
COPY hiera/docker.yaml /etc/puppet/data/

docker/hiera/docker.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
one::head::ssh_pub_key: 'ssh pub key'
3+
one::head::ssh_priv_key: 'ssh-dsa priv key'
4+
one::oned::db: oneadmin
5+
one::oned::db_user: oneadmin
6+
one::oned::db_password: oneadmin
7+
one::oned::db_host: localhost
8+
one::oned::sunstone_listen_ip: '0.0.0.0'

docker/hiera/hiera.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
:backends:
3+
- yaml
4+
:hierarchy:
5+
- docker
6+
7+
:yaml:
8+
:datadir: '/etc/puppet/data'

spec/docker-int/one-head-httpd.pp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
class httpd {
2+
class { 'apache':
3+
default_vhost => false,
4+
}
5+
include apache::mod::passenger
6+
include apache::mod::proxy
7+
include apache::mod::proxy_http
8+
9+
apache::vhost { 'one':
10+
docroot => '/usr/lib/one/sunstone/public',
11+
port => '80',
12+
directories => [{
13+
path => '/usr/lib/one/sunstone/public',
14+
options => ['-MultiViews']
15+
}],
16+
}
17+
}
18+
19+
20+
class { 'one':
21+
oned => true,
22+
node => false,
23+
sunstone => true,
24+
sunstone_passenger => true,
25+
} ->
26+
27+
class { 'httpd': }

spec/docker-int/one-head-node.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class { 'one':
2+
oned => true,
3+
node => true,
4+
sunstone => true,
5+
}

spec/docker-int/one-head.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class { 'one':
2+
oned => true,
3+
node => false,
4+
sunstone => true,
5+
}

spec/docker-int/one-node.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class { 'one':
2+
oned => false,
3+
node => true,
4+
}

0 commit comments

Comments
 (0)