Compiling graylog server for production

How do I compile a graylog.jar file that is ready for production on my local machine?

I downloaded the latest source code (tag 2.3.1) graylog from https://github.com/Graylog2/graylog2-server.

I then ran mvn compile and then mvn package just fine.

I noticed that only target/jar files where created in most of the sub folders and not the master project.

Am I just using the wrong command to create a production ready jar?

You have to run mvn assembly:single to produce a tar-ball with the Graylog release.

Also take a look at the Travis CI configuration, which produces these artifacts:

@jochen

Thank you so much for the help. I am able to curl and set up the certs. And also run the mvn assembly:single command.
But I am not able to run mvn -B -Dmaven.test.skip=true -Dskip.web.build=true -pl graylog2-server versioneye:securityAndLicenseCheck

It gives me missing API key errors. I assume I am going to have to obtain (or set these somewhere). I do have a versionEye account.

Would you be able to point me in the right direction?

You don’t need to do that if you have an up-to-date certificate store.

You don’t need to run this. See https://www.versioneye.com/ for details about what VersionEye is.

After installing my custom built version of graylog 2.3.1. I get a message saying graylog is out of date.

The most recent stable Graylog version is 2.3.1 (Tegernseer) released at 2017-08-25T00:00:00.000Z. Get it from https://www.graylog.org/.

Is there a way to turn this off?

@jochen

I also have a enterprise license and have moved the enterprise plugins to the plugin directory

My graylog version in the web-ui is showing 0-0-unknown even thought my package.json says 2.3.1

Found this log error…

	at com.github.zafarkhaja.semver.VersionParser.ensureValidLookahead(VersionParser.java:530) ~[graylog.jar:?]
	at com.github.zafarkhaja.semver.VersionParser.parseBuild(VersionParser.java:358) ~[graylog.jar:?]
	at com.github.zafarkhaja.semver.VersionParser.parseBuild(VersionParser.java:237) ~[graylog.jar:?]
	at com.github.zafarkhaja.semver.Version.setBuildMetadata(Version.java:458) ~[graylog.jar:?]
	at org.graylog2.plugin.Version.buildSemVer(Version.java:149) ~[graylog.jar:?]
	at org.graylog2.plugin.Version.from(Version.java:140) ~[graylog.jar:?]
	at org.graylog2.plugin.Version.fromClasspathProperties(Version.java:239) [graylog.jar:?]
	at org.graylog2.plugin.Version.fromClasspathProperties(Version.java:199) [graylog.jar:?]
	at org.graylog2.plugin.Version.fromClasspathProperties(Version.java:173) [graylog.jar:?]
	at org.graylog2.plugin.Version.<clinit>(Version.java:66) [graylog.jar:?]
	at org.graylog2.bootstrap.CmdLineTool.<clinit>(CmdLineTool.java:90) [graylog.jar:?]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_111]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [?:1.8.0_111]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.8.0_111]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [?:1.8.0_111]
	at com.github.rvesse.airline.parser.ParserUtil.createInstance(ParserUtil.java:39) [graylog.jar:?]
	at com.github.rvesse.airline.DefaultCommandFactory.createInstance(DefaultCommandFactory.java:25) [graylog.jar:?]
	at com.github.rvesse.airline.parser.ParserUtil.createInstance(ParserUtil.java:94) [graylog.jar:?]
	at com.github.rvesse.airline.parser.ParseResult.getCommand(ParseResult.java:114) [graylog.jar:?]
	at com.github.rvesse.airline.parser.command.CliParser.parse(CliParser.java:54) [graylog.jar:?]
	at com.github.rvesse.airline.Cli.parse(Cli.java:107) [graylog.jar:?]
	at com.github.rvesse.airline.Cli.parse(Cli.java:93) [graylog.jar:?]
	at org.graylog2.bootstrap.Main.main(Main.java:43) [graylog.jar:?]```

You have to build the artifacts by running mvn install once in the root directory of the project.

I ran mvn package before running mvn assembly:single

@jochen Here are the steps I have followed.

  1. Download 2.3.1 zip file from https://github.com/Graylog2/graylog2-server/releases
  2. Unzip file
  3. Run mvn install
  4. Run mvn assembly:single
  5. Copy graylog TAR from target/assembly to my server.
  6. Extract contents and restart server.
  7. Graylog UI boots just fine, but shows version 0.0.0-unknown

Looking at graylog server.log I see the following

2017-08-30T12:51:25.477Z ERROR [Version] Unable to read version.properties, this build has no version number.
com.github.zafarkhaja.semver.UnexpectedCharacterException: null
	at com.github.zafarkhaja.semver.VersionParser.ensureValidLookahead(VersionParser.java:530) ~[graylog.jar:?]
	at com.github.zafarkhaja.semver.VersionParser.parseBuild(VersionParser.java:358) ~[graylog.jar:?]
	at com.github.zafarkhaja.semver.VersionParser.parseBuild(VersionParser.java:237) ~[graylog.jar:?]
	at com.github.zafarkhaja.semver.Version.setBuildMetadata(Version.java:458) ~[graylog.jar:?]
	at org.graylog2.plugin.Version.buildSemVer(Version.java:149) ~[graylog.jar:?]
	at org.graylog2.plugin.Version.from(Version.java:140) ~[graylog.jar:?]
	at org.graylog2.plugin.Version.fromClasspathProperties(Version.java:239) [graylog.jar:?]
	at org.graylog2.plugin.Version.fromClasspathProperties(Version.java:199) [graylog.jar:?]
	at org.graylog2.plugin.Version.fromClasspathProperties(Version.java:173) [graylog.jar:?]
	at org.graylog2.plugin.Version.<clinit>(Version.java:66) [graylog.jar:?]
	at org.graylog2.bootstrap.CmdLineTool.<clinit>(CmdLineTool.java:90) [graylog.jar:?]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_111]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [?:1.8.0_111]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.8.0_111]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [?:1.8.0_111]
	at com.github.rvesse.airline.parser.ParserUtil.createInstance(ParserUtil.java:39) [graylog.jar:?]
	at com.github.rvesse.airline.DefaultCommandFactory.createInstance(DefaultCommandFactory.java:25) [graylog.jar:?]
	at com.github.rvesse.airline.parser.ParserUtil.createInstance(ParserUtil.java:94) [graylog.jar:?]
	at com.github.rvesse.airline.parser.ParseResult.getCommand(ParseResult.java:114) [graylog.jar:?]
	at com.github.rvesse.airline.parser.command.CliParser.parse(CliParser.java:54) [graylog.jar:?]
	at com.github.rvesse.airline.Cli.parse(Cli.java:107) [graylog.jar:?]
	at com.github.rvesse.airline.Cli.parse(Cli.java:93) [graylog.jar:?]
	at org.graylog2.bootstrap.Main.main(Main.java:43) [graylog.jar:?]
2017-08-30T12:51:25.774Z ERROR [CmdLineTool] Plugin "OpsGenie Alarm Callback" requires version 2.0.0 - not loading!
2017-08-30T12:51:25.775Z ERROR [CmdLineTool] Plugin "Aggregates" requires version 2.3.0 - not loading!
2017-08-30T12:51:25.776Z ERROR [CmdLineTool] Plugin "ArchivePlugin" requires version 2.3.1 - not loading!
2017-08-30T12:51:25.777Z ERROR [CmdLineTool] Plugin "Audit Log" requires version 2.3.1 - not loading!
2017-08-30T12:51:25.778Z ERROR [CmdLineTool] Plugin "Elastic Beats Input" requires version 2.3.1 - not loading!
2017-08-30T12:51:25.780Z ERROR [CmdLineTool] Plugin "Collector" requires version 2.3.1 - not loading!
2017-08-30T12:51:25.781Z ERROR [CmdLineTool] Plugin "Enterprise Integration Plugin" requires version 2.3.1 - not loading!
2017-08-30T12:51:25.782Z ERROR [CmdLineTool] Plugin "License Plugin" requires version 2.3.1 - not loading!
2017-08-30T12:51:25.784Z ERROR [CmdLineTool] Plugin "MapWidgetPlugin" requires version 2.3.1 - not loading!
2017-08-30T12:51:25.785Z ERROR [CmdLineTool] Plugin "Internal Metrics Datadog Reporter" requires version 2.0.0 - not loading!
2017-08-30T12:51:25.800Z ERROR [CmdLineTool] Plugin "Pipeline Processor Plugin" requires version 2.3.0 - not loading!
2017-08-30T12:51:25.801Z ERROR [CmdLineTool] Plugin "QuickValuesPlusWidget" requires version 2.3.0 - not loading!
2017-08-30T12:51:25.803Z ERROR [CmdLineTool] Plugin "Anonymous Usage Statistics" requires version 2.3.1 - not loading!

What operating system are you using to build Graylog?
What’s the complete output of mvn install and mvn assembly:single?

Using mac Sierra version 10.12.6

mvn install -> https://pastebin.com/kRFFutCP
mvn assmebly:single -> https://pastebin.com/7hNWwmS0

Which version of Maven are you using?

Also make sure that the version.properties file is generated and has sane contents.

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T15:39:06-04:00)
Maven home: /usr/local/Cellar/maven/3.5.0/libexec
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: “mac os x”, version: “10.12.6”, arch: “x86_64”, family: “mac”

Also what do you mean by the version.properties file!?

I can not find a version.properties file in the graylog zip that I downloaded!?

All the version.properties files have project.version=${project.version}

one example being graylog2-server/src/resources/version.properties

You have to check the filtered file inside the target/ directories.

Example:

$ cat ./graylog2-server/target/classes/version.properties
project.version=2.4.0-SNAPSHOT

cat ./graylog2-server/target/classes/version.properties
project.version=2.3.1

above is what I get