The following steps will help you get Puppet Server up and running from source.
Use your system's package tools to ensure that the following prerequisites are installed:
- JDK 1.7 or higher
- Leiningen
- Git (for checking out the source code)
$ git clone git://github.com/puppetlabs/puppet-server
$ cd puppet-server
# initialize git submodules (which are located in ./ruby, and contain the
# puppet/facter ruby source code)
$ git submodule init
$ git submodule update
Choose a directory outside of the git working copy, e.g. ~/.puppet-server
, where you'd
like to maintain local config files for development. Then, copy the file
dev/sample-configs/puppet-server.sample.conf
to that directory, and name it puppet-server.conf
.
Edit it to suit your needs. A few notes:
- Relative paths in the config file refer to the root directory of the puppet-server git working copy.
- Puppet Server reads most of its configuration data from
puppet.conf
and Puppet's usualconfdir
. The settingmaster-conf-dir
may be used to modify the location of the Puppetconfdir
. Otherwise, it will use the same default locations as Puppet normally uses (~/.puppet
for non-root users,/etc/puppet
for root).
Alternately you may break the individual configuration settings from puppet-server.conf
into multiple .conf
files, and place them in a conf.d
-style directory.
This will let you develop on Puppet Server and see your changes by simply editing the code and restarting the server. It will not create an init script or default configuration directory. To start the Puppet Server when running from source, you will need to run the following:
$ lein run -c /path/to/puppet-server.conf
Running the server inside of the clojure REPL allows you to make changes to the source code and reload the server without having to restart the entire JVM. It can be much faster than running from the command line, when you are doing iterative development. To start the server from the REPL, run the following:
$ lein repl
nREPL server started on port 47631 on host 127.0.0.1
puppetlabs.trapperkeeper.main=> (load-file "./dev/user_repl.clj")
#'user-repl/reset
puppetlabs.trapperkeeper.main=> (ns user-repl)
nil
user-repl=> (go)
Then, if you make changes to the source code, all you need to do in order to restart the server with the latest changes is:
user-repl=> (reset)
Restarting the server this way should be significantly faster than restarting the entire JVM process.
lein test
to run the clojure test suiterake spec
to run the jruby test suite