You can browse the source code at https://github.com/candlepin/candlepin/.
For anonymous access to the Candlepin source code, feel free to clone the repository:
$ git clone git://github.com/candlepin/candlepin.git
Candlepin committers can clone the repository using the ssh url, which is required if you want to push changes into the repo (and of course you need permission to do so).
$ git clone firstname.lastname@example.org:candlepin/candlepin.git
Instructions for Fedora 22.
Candlepin uses buildr as its build tool (primarily because we don’t like maven).
$ sudo dnf install ruby rubygems ruby-devel gcc make gettext tomcat java-1.8.0-openjdk-devel liquibase postgresql-jdbc openssl libxml2-python qpid-proton-c-devel qpid-proton-c
NOTE: You may want to install Java 1.6.0 or 1.7.0 depending on OS version.
$ sudo gem update --system
$ sudo -s
# export JAVA_HOME=/usr/lib/jvm/java-1.8.0/
NOTE: This should match the Java version specified above.
# gem install bundler
Install the Ruby dependencies.
$ bundle install
Make sure your tomcat directory within /var/cache has group permissions (
chmod 775 /var/cache/tomcat)
If you have multiple JVMs on your system and are getting
RuntimeError : can't
create Java VM, you may need to set your JVM via
alternatives --config java
alternatives --config javac. Additionally, you may need to use this
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.**.x86_64/, where the ** should be filled in
with the appropriate build version (matching the proper directory from
The following will compile and package candlepin into a war and api jar in
Testing will be covered below hence the
$ cd candlepin/ $ buildr clean test=no package
Candlepin is typically deployed against PostgreSQL, but schema is provided for Oracle and MySQL as well.
$ sudo dnf install -y postgresql-server postgresql
$ sudo postgresql-setup initdb
/var/lib/pgsql/data/pg_hba.conf to be trust instead of ident:
# TYPE DATABASE USER CIDR-ADDRESS METHOD local all all trust host all all 127.0.0.1/32 trust host all all ::1/128 trust
Enable and start the PostgreSQL server.
$ sudo systemctl enable postgresql $ sudo systemctl start postgresql
Create the candlepin user:
$ sudo su - postgres -c 'createuser -dls candlepin'
The preferred method for deploying Candlepin from source is using the
deploy script in the
server/bin directory. This script will generate
the database schema, populate your PostgreSQL database, create the certs
for Tomcat, deploy the war file, and restart tomcat. It can also be used to deploy to a Oracle/MySQL databases, and pre-load our test data.
Remember to set JAVA_HOME for buildr to work.
Test that the application is listening with:
$ curl -k -u admin:admin "https://localhost:8443/candlepin/status"
The deploy script can be customized with a number of environment variables, or you can set these permanently in
-gargument to deploy script.
-fargument to the deploy script.
server/bin/test_data.json. This is a selection of product, subscription, and org info that nicely covers all the functionality of Candlepin. Subscriptions point to fake content however and thus cannot be used with an actual client. Can also be specified with the
-targument to the deploy script.
-largument to the deploy script.
candlepin.conf. Can also be specified with the
-aargument to the deploy script.
notify-sendto notify you when deployment has finished
-Hargument to the deploy script. If used with
AUTOCONF, the default adapters will be overriden by hostedtest adapters in
The deploy script may also be customized/configured by providing command-line arguments during invocation. Some of these overlap with those triggered by environment variables, providing shorter alternatives to triggering the options above.
server/bin/test_data.jsonafter a successful deployment.
-ofor Oracle and
-mfor MySQL. Only one alternate should be specified for a given invocation.
-a, the default adapters will be overriden by hostedtest adapters in
If for some reason you wish to deploy manually, you can generate the candlepin war file and deploy it into tomcat easily.
$ buildr clean test=no package
This should result in candlepin-XYZ.war file being created in the
target/ directory. Deploy the resulting war file to your favorite servlet container.
There are a few things that some folks have hit while deploying Candlepin.
IMPORTANT: No matter which database you are using, you will most likely need to initialize it once and only once after it is created. This process creates some core entries in the database required for Candlepin to operate properly. If you are using our deploy script, this will be handled for you automatically. Otherwise you can trigger this by hitting the following URL:
$ wget -qO- http://localhost:8080/candlepin/admin/init
Repeated calls to this URL are not required, but will be harmless.
If you see something amiss, an easy first thing to check is to ensure that tomcat is running and listening on the right ports.
# netstat -anlp | grep java tcp 0 0 :::8080 :::* LISTEN 21864/java tcp 0 0 :::8443 :::* LISTEN 21864/java tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 21864/java tcp 0 0 :::8009 :::* LISTEN 21864/java unix 2 [ ] STREAM CONNECTED 793153 21864/java
The important things here are 8080 (the default HTTP listener), and 8443 (the SSL listener). If you don’t have both of those, try setting FORCECERT=1 and trying again. Consulting catalina.out is always useful as well.
The hornetq journal doesn’t seem to like being used by new versions. If you see an exception on startup like:
SEVERE: Failure in initialisation java.lang.IllegalStateException: Invalid record type 23 at org.hornetq.core.persistence.impl.journal.JournalStorageManager.loadBindingJournal(JournalStorageManager.java:1527)
You need to clear your journal:
$ rm -rf /var/lib/candlepin/hornetq*