mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
commit
2bf7c4a715
3 changed files with 47 additions and 6 deletions
31
Dockerfile
Normal file
31
Dockerfile
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Run vmpooler in a Docker container! Configuration can either be embedded
|
||||
# and built within the current working directory, or stored in a
|
||||
# VMPOOLER_CONFIG environment value and passed to the Docker daemon.
|
||||
#
|
||||
# BUILD:
|
||||
# docker build -t vmpooler .
|
||||
#
|
||||
# RUN:
|
||||
# docker run -e VMPOOLER_CONFIG -p 80:4567 -it vmpooler
|
||||
|
||||
FROM jruby:1.7-jdk
|
||||
|
||||
RUN mkdir -p /var/lib/vmpooler
|
||||
WORKDIR /var/lib/vmpooler
|
||||
|
||||
ADD Gemfile* /var/lib/vmpooler
|
||||
RUN bundle install --system
|
||||
|
||||
RUN ln -s /opt/jruby/bin/jruby /usr/bin/jruby
|
||||
|
||||
RUN echo "deb http://httpredir.debian.org/debian jessie main" >/etc/apt/sources.list.d/jessie-main.list
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y redis-server
|
||||
|
||||
COPY . /var/lib/vmpooler
|
||||
|
||||
ENTRYPOINT \
|
||||
/etc/init.d/redis-server start \
|
||||
&& /var/lib/vmpooler/scripts/vmpooler_init.sh start \
|
||||
&& while [ ! -f /var/log/vmpooler.log ]; do sleep 1; done ; \
|
||||
tail -f /var/log/vmpooler.log
|
||||
|
|
@ -57,10 +57,13 @@ The following YAML configuration sets up two pools, `debian-7-i386` and `debian-
|
|||
|
||||
See the provided YAML configuration example, [vmpooler.yaml.example](vmpooler.yaml.example), for additional configuration options and parameters.
|
||||
|
||||
### Template set-up
|
||||
### Running via Docker
|
||||
|
||||
Template set-up is left as an exercise to the reader. Somehow, either via PXE, embedded bootstrap scripts, or some other method -- clones of VM templates need to be able to set their hostname, register themselves in your DNS, and be resolvable by the vmpooler application after completing the clone task and booting up.
|
||||
A [Dockerfile](Dockerfile) is included in this repository to allow running vmpooler inside a Docker container. A `vmpooler.yaml` configuration file can be embedded in the current working directory, or specified inline in a `VMPOOLER_CONFIG` environment variable. To build and run:
|
||||
|
||||
```
|
||||
docker build -t vmpooler . && docker run -e VMPOOLER_CONFIG -p 80:4567 -it vmpooler
|
||||
```
|
||||
|
||||
## API and Dashboard
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,18 @@ module Vmpooler
|
|||
end
|
||||
|
||||
def self.config(filepath='vmpooler.yaml')
|
||||
# Load the configuration file
|
||||
config_file = File.expand_path(filepath)
|
||||
parsed_config = YAML.load_file(config_file)
|
||||
parsed_config = {}
|
||||
|
||||
# Set some defaults
|
||||
if ENV['VMPOOLER_CONFIG']
|
||||
# Load configuration from ENV
|
||||
parsed_config = YAML.load(ENV['VMPOOLER_CONFIG'])
|
||||
else
|
||||
# Load the configuration file from disk
|
||||
config_file = File.expand_path(filepath)
|
||||
parsed_config = YAML.load_file(config_file)
|
||||
end
|
||||
|
||||
# Set some configuration defaults
|
||||
parsed_config[:redis] ||= {}
|
||||
parsed_config[:redis]['server'] ||= 'localhost'
|
||||
parsed_config[:redis]['data_ttl'] ||= 168
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue