Git Product home page Git Product logo

sls-packaging's Introduction

Autorelease

SLS Distribution Gradle Plugins

Build Status Gradle Plugin Portal

A set of Gradle plugins that facilitate packaging projects for distributions conforming to Palantir's Service Layout Specification. This project was formerly known as gradle-java-distribution.

The Java Service and Asset plugins cannot both be applied to the same gradle project, and distributions from both are produced as a gzipped tar named [service-name]-[project-version].sls.tgz.

Java Service Distribution Gradle Plugin

Similar to the standard application plugin, this plugin helps package Java Gradle projects for easy distribution and execution. This distribution conforms with Palantir's SLS service layout conventions that attempt to split immutable files from mutable state and configuration.

In particular, this plugin packages a project into a common deployment structure with a simple start script, daemonizing script, and, a manifest describing the content of the package. The package will follow this structure:

[service-name]-[service-version]/
    deployment/
        manifest.yml                      # simple package manifest
    service/
        bin/
            [service-name]                # Bash start script
            [service-name].bat            # Windows start script
            init.sh                       # daemonizing script
            darwin-amd64/go-java-launcher # Native Java launcher binary (MacOS)
            linux-amd64/go-java-launcher  # Native Java launcher binary (Linux x86_64)
            linux-arm64/go-java-launcher  # Native Java launcher binary (Linux arm64)
            launcher-static.yml           # generated configuration for go-java-launcher
            launcher-check.yml            # generated configuration for check.sh go-java-launcher
        lib/
            [jars]
        monitoring/
            bin/
                check.sh                  # monitoring script
    var/                                  # application configuration and data

The service/bin/ directory contains both Gradle-generated launcher scripts ([service-name] and [service-name].bat) and go-java-launcher launcher binaries. See below for usage.

Asset Distribution Gradle Plugin

This plugin helps package static files and directories into a distribution that conforms with Palantir's SLS asset layout conventions. Asset distributions differ from service distributions in that they do not have a top-level service or var directory, and instead utilize a top-level asset directory that can contain arbitrary files. See below for usage.

Usage

Product dependencies

'Product dependencies' are declarative metadata about the products your product/asset requires in order to function. When you run ./gradlew distTar, your product dependencies are embedded in the resultant dist in the deployment/manifest.yml file.

Most of your product dependencies should be inferred automatically from on the libraries you depend on. Any one of these jars may contain an embedded 'recommended product dependency' in its MANIFEST.MF (embedded using the Recommended Product Dependencies Plugin).

However, you can also use the productDependency block to specify these manually (although this is no longer considered a best-practise). Please note: you can add further restrictions to existing constraints, but you can't broaden them:

distribution {
    productDependency {
        productGroup = "com.palantir.group"
        productName = "my-service"
        minimumVersion = "1.0.0"
        maximumVersion = "1.x.x"
        recommendedVersion = "1.2.1"
        optional = false
    }
}

sls-packaging also maintains a lockfile, product-dependencies.lock, which should be checked in to Git. This file is an accurate reflection of all the inferred and explicitly defined product dependencies. Run ./gradlew --write-locks or ./gradlew writeProductDependenciesLocks to update it. e.g.

# Run ./gradlew writeProductDependenciesLocks to regenerate this file
com.palantir.auth:auth-service (1.2.0, 1.6.x)
com.palantir.storage:storage-service (3.56.0, 3.x.x)
com.palantir.email:email-service (1.200.3, 2.x.x) optional
com.palantir.foo:foo-service ($projectVersion, 1.x.x)

The $projectVersion string is a placeholder that will appear if your repo publishes multiple services, and one of them depends on another. The actual manifest will contain a concrete version.

The suffix optional will be added for optional = true in the productDependency declaration. All dependencies are required by default.

It's possible to further restrict the acceptable version range for a dependency by declaring a tighter constraint in a productDependency block - this will be merged with any constraints detected from other jars. If all the constraints on a given product don't overlap, then an error will the thrown: Could not merge recommended product dependencies as their version ranges do not overlap.

It's also possible to explicitly ignore a dependency or mark it as optional if it comes as a recommendation from a jar:

distribution {
    productDependency {
        // ...
    }
    ignoredProductDependency('other-group3', 'other-service3')
    optionalProductDependency('other-group4', 'other-service4')
}

Dependencies marked as optional will appear with the optional suffix in the lockfile.

Accessing product dependencies

You can programmatically access the minimum product dependency version as follows:

def myDependency = getMinimumProductVersion('com.palantir.service:my-service')

More often though, you probably just want to get the minimum product dependencies as a gradle configuration that you can depend on from other projects. For this purpose, there is a configuration called productDependencies that is published from each SLS project.

You can then use this together with gradle-docker to inject your product dependencies into the docker-compose templating, for instance.

For example, given a dist project, :my-service, you can collect wire up docker :

// from another project
apply plugin: 'com.palantir.docker'
dependencies {
    docker project(path: ':my-service', configuration: 'productDependencies')
}

Schema versions

sls-packaging also maintains a lockfile, schema-versions.lock, which should be checked in to Git. This file is an accurate reflection of the schema versions specified in the manifest. The file can be used to easily determine what schema versions are supported by a particular version of the code. Run ./gradlew --write-locks or ./gradlew writeSchemaVersionLocks to update it.

---
comment: "Run ./gradlew writeSchemaVersionLocks to regenerate this file"
schemaMigrations:
- type: "online"
  from: 100
- type: "online"
  from: 101
version: 1

Packaging plugins

These plugins require at least Gradle 4.10.

Java Service Distribution plugin

Apply the plugin using standard Gradle convention:

plugins {
    id 'com.palantir.sls-java-service-distribution'
}

Additionally, declare the version of go-java-launcher to use:

# Add to 'versions.props' 
com.palantir.launching:* = 1.18.0

A sample configuration for the Service plugin:

distribution {
    serviceName 'my-service'
    serviceGroup 'my.service.group'
    mainClass 'com.palantir.foo.bar.MyServiceMainClass'
    args 'server', 'var/conf/my-service.yml'
    env 'KEY1': 'value1', 'KEY2': 'value1'
    manifestExtensions 'KEY3': 'value2'
    productDependency {
        productGroup = "other-group"
        productName = "other-service"
        minimumVersion = "1.1.0"
        maximumVersion = "1.5.x"      // optional, defaults to "1.x.x" (same major version as minimumVersion)
        recommendedVersion = "1.3.0"  // optional
    }
}

And the complete list of configurable properties:

  • (optional) serviceName the name of this service, used to construct the final artifact's file name. Defaults to the configured "name" of the Gradle project, project.name.
  • (optional) serviceGroup the group of the service, used in the final artifact's manifest. Defaults to the configured "group" of the Gradle project, project.group.
  • (optional) manifestExtensions a map of extended manifest attributes, as specified in SLS 1.0
  • (optional) productDependency adds an entry to the extensions.product-dependencies block of the SLS manifest, declaring that this service has a dependency on the given other service with specific version bounds. The productDependency object must specify the following properties:
    • productGroup the serviceGroup of the dependency.
    • productName the serviceName of the dependency.
    • minVersion the minimal compatible version of the dependency.
    • maxVersion the maximal compatible version of the dependency.
    • recommended the version developers think you should use; most commonly the version of the implementation that was tested during CI (minVersion typically matches the version of the api you use to negotiate).
  • (optional) mainClass class containing the entry point to start the program. Defaults to this sole class containing a main method in the main source set if one exists.
  • (optional) args a list of arguments to supply when running start.
  • (optional) checkArgs a list of arguments to supply to the monitoring script, if omitted, no monitoring script will be generated.
  • (optional) env a map of environment variables that will be placed into the env block of the static launcher config. See go-java-launcher for details on the custom environment block.
  • (optional) defaultJvmOpts a list of default JVM options to set on the program.
  • (optional) enableManifestClasspath a boolean flag; if set to true, then the explicit Java classpath is omitted from the generated start scripts and static launcher config and instead inferred from a JAR file whose MANIFEST contains the classpath entries.
  • (optional) excludeFromVar a list of directories (relative to ${projectDir}/var) to exclude from the distribution, defaulting to ['log', 'run'].
  • (optional) javaVersion a fixed override for the desired major Java runtime version (e.g. javaVersion JavaVersion.VERSION_15). This defaults to the Java targetCompatibility version. Setting this automatically sets javaHome to the appropriate corresponding value.
  • (optional) javaHome a fixed override for the JAVA_HOME environment variable that will be applied when init.sh is run. When your targetCompatibility is Java 8 or less, this value will be blank. For Java 9 or higher will default to $JAVA_<majorversion>_HOME ie for Java 11 this would be $JAVA_11_HOME.
  • (optional) gc override the default GC settings. Available GC settings: throughput (default for Java 14 and lower), hybrid (default for Java 15 and higher) and response-time. Additionally, there is also dangerous-no-profile which does not apply any additional JVM flags and allows you to fully configure any GC settings through JVM options (not recommended for normal usage!).
  • (optional) addJava8GcLogging add java 8 specific gc logging options.

JVM Options

The list of JVM options passed to the Java processes launched through a package's start-up scripts is obtained by concatenating the following list of hard-coded required options and the list of options specified in distribution.defaultJvmOpts:

Hard-coded required JVM options:

  • -Djava.io.tmpdir=var/data/tmp: Allocates temporary files inside the application installation folder rather than on /tmp; the latter is often space-constrained on cloud hosts.

The go-java-launcher and init.sh launchers additionally append the list of JVM options specified in the var/conf/launcher-custom.yml configuration file. Note that later options typically override earlier options (although this behavior is undefined and may be JVM-specific); this allows users to override the hard-coded options.

JDK Inclusion

The distribution extension provides a configuration point to add JDKs; internally, gradle-sls-docker discovers the appropriate JDKs used in the service's associated container image then configures these JDKs to be included in the dist. There are more details in gradle-sls-docker readme.

For each included JDK major version X, the launcher-static.yml run by go-java-launcher has the corresponding JAVA_X_HOME environment variable set to be a relative path to the JDK's location in the dist. The javaHome option is also set to the relative path in the same manner. There can only be one version of each JDK major version included in the dist.

Runtime environment variables

Environment variables can be configured through the env blocks of launcher-static.yml and launcher-custom.yml as described in configuration file. They are set by the launcher process before the Java process is executed.

Directories created at runtime

The plugin configures go-java-launcher to create the following directories before starting the service:

  • var/data/tmp

Additionally, the following directories are created in every SLS distribution created:

  • var/log
  • var/run

Asset Distribution plugin

Apply the plugin using standard Gradle convention:

plugins {
    id 'com.palantir.sls-asset-distribution'
}

A sample configuration for the Asset plugin:

distribution {
    serviceName 'my-assets'
    assets 'relative/path/to/assets', 'relocated/path/in/dist'
    assets 'another/path, 'another/relocated/path'
}

The complete list of configurable properties:

  • serviceName the name of this service, used to construct the final artifact's file name.
  • (optional) serviceGroup the group of the service, used in the final artifact's manifest. Defaults to the configured "group" of the Gradle project, project.group.
  • (optional) manifestExtensions a map of extended manifest attributes, as specified in SLS 1.0.
  • (optional) productDependency adds an entry to the extensions.product-dependencies block of the SLS manifest, declaring that this asset has a dependency on the given other product with specific version bounds.
  • (optional) assets <fromPath> adds the specified file or directory (recursively) to the asset distribution, preserving the directory structure. For example, assets 'foo/bar' yields files foo/bar/baz/1.txt and foo/bar/2.txt in the asset distribution, assuming that the directory foo/bar contains files baz/1.txt and 2.txt.
  • (optional) assets <fromPath> <toPath> as above, but adds the specified files relative to toPath in the asset distribution. For example, assets 'foo/bar' 'baz' yields files baz/baz/1.txt and baz/2.txt assuming that the directory foo/bar contains the files baz/1.txt and 2.txt.
  • (optional) setAssets <map<fromPath, toPath>> as above, but removes all prior configured assets.

The example above, when applied to a project rooted at ~/project, would create a distribution with the following structure:

[service-name]-[service-version]/
    deployment/
        manifest.yml                      # simple package manifest
    asset/
        relocated/path/in/dist            # contents from `~/project/relative/path/to/assets/`
        another/relocated/path            # contents from `~/project/another/path`

Note that repeated calls to assets are processed in-order, and as such, it is possible to overwrite resources by specifying that a later invocation be relocated to a previously used destination's ancestor directory.

Packaging

To create a compressed, gzipped tar file of the distribution, run the distTar task. To create a compressed, gzipped tar file of the deployment metadata for the distribution, run the configTar task.

The plugins expose the tar file as an artifact in the sls configuration, making it easy to share the artifact between sibling Gradle projects. For example:

configurations { tarballs }

dependencies {
    tarballs project(path: ':other-project', configuration: 'sls')
}

As part of package creation, the Java Service plugin will additionally create three shell scripts:

  • service/bin/[service-name]: a Gradle default start script for running the defined mainClass. This script is considered deprecated due to security issues with injectable Bash code; use the go-java-launcher binaries instead (see below).
  • service/bin/<architecture>/go-java-launcher: native binaries for executing the specified mainClass, configurable via service/bin/launcher-static.yml and var/conf/launcher-custom.yml.
  • service/bin/init.sh: a shell script to assist with daemonizing a JVM process. The script takes a single argument of start, stop, console or status.
    • start: On calls to service/bin/init.sh start, service/bin/<architecture>/go-java-launcher will be executed, disowned, and a pid file recorded in var/run/[service-name].pid.
    • console: like start, but does not background the process.
    • status: returns 0 when var/run/[service-name].pid exists and a process the id recorded in that file with a command matching the expected start command is found in the process table.
    • stop: if the process status is 0, issues a kill signal to the process.
  • service/monitoring/bin/check.sh: a no-argument shell script that returns 0 when a service is healthy and non-zero otherwise. This script is generated if and only if checkArgs is specified above, and will run the singular command defined by invoking <mainClass> [checkArgs] to obtain health status.

Furthermore, the Java Service plugin will merge the entire contents of ${projectDir}/service and ${projectDir}/var into the package.

Tasks

  • distTar: creates the gzipped tar package
  • configTar: creates the gzipped tar package of the deployment configuration
  • createManifest: generates a simple yaml file describing the package content

Specific to the Java Service plugin:

  • createStartScripts: generates standard Java start scripts
  • createInitScript: generates daemonizing init.sh script
  • run: runs the specified mainClass with default args

Recommended Product Dependencies Plugin

This plugin allows API jars to declare the recommended product dependencies an SLS service distribution should take.

An example application of this plugin might look as follows:

apply plugin: 'java'
apply plugin: 'com.palantir.sls-recommended-dependencies'

recommendedProductDependencies {
    productDependency {
        productGroup = 'com.foo.bar.group'
        productName = 'product'
        minimumVersion = rootProject.version
        maximumVersion = "${rootProject.version.tokenize('.')[0].toInteger()}.x.x"
        recommendedVersion = rootProject.version
    }
}

The recommended product dependencies will be serialized into the jar manifest of the jar that the project produces. The SLS distribution and asset plugins will inspect the manifest of all jars in the server or asset and extract the recommended product dependencies.

Marking a product dependency as optional in recommendedProductDependencies is not currently supported.

License

This plugin is made available under the Apache 2.0 License.

sls-packaging's People

Contributors

andybradshaw avatar bavardage avatar bmoylan avatar bulldozer-bot[bot] avatar carterkozak avatar crogers avatar dansanduleac avatar darora avatar ellisjoe avatar esword avatar fawind avatar ferozco avatar iamdanfox avatar j-baker avatar jared2501 avatar jmcampanini avatar jnelson15 avatar leeavital avatar markelliot avatar mglazer avatar nmiyake avatar pkoenig10 avatar punya avatar robert3005 avatar rzpt avatar schlosna avatar sfackler avatar svc-autorelease avatar svc-excavator-bot avatar uschi2000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sls-packaging's Issues

add option to print arbitrary message to stderr on start

I've seen several issues in the field whose root cause was people running init.sh start by hand instead of via lifecycle management tools. It would be nice to add an optional flag to the distribution block that would cause a message to be printed to stderr, so that when people do run the init script by hand they get immediate feedback telling them it may cause problems.

Something like stdErrOnStart, which takes the full message you want printed, maybe? I'm not sure if this is too specific.

Move config.sh to var

Can we move config.sh to var? It seems like a better place for deployment specific configurations to stay consistent. If it's cool I can look at making a PR.

DistTar task ships source code

The DistTar task will include source jars (files off the form *-sources.jar). This is dangerous if you are pulling in source jars, as you might accidentally be distributing proprietary source code.

launcher-static.yml not being updated

While trying to run our ETE tests, if our commit hash changes, the launcher-static.yml isn't updated. This causes our ETE tests to fail because the tgz has the new jars but the launcher-static.yml is referencing the old ones.

@hsaraogi @jeremyk-91

Fail fast when using an incompatible Java version

Consumers should be able to specify that they want a certain major version of Java. If run with a lower version, the service script should die with an informative message (rather than falling through to Java, which will usually produce a mysterious "incompatible class format 52" message down the line).

add an sls configuration + artifact to the project

// + @markelliot + @bmoylan for SA + thoughts

i'd like to refer to projects that produce a java distribution tarball via Gradle dependencies. specifically, i'd like to do something like this:

dependencies {
    skylab project(path: ':product', configuration: 'sls')
}

this would give a clean way for a project to depend on the resulting sls artifact produced by this plugin.

it would involve adding something like this to the plugin:

configurations {
    sls
}

artifacts {
    sls distTar
}

i believe this would be non-disruptive to existing projects.

Change default GC settings

cc @schlosna

The JVM defaults are to use the Parallel Old GC collector. Probably most services using g-j-d should be using either the CMS + Parallel New collector or the G1 collector.

Should we make an opinionated decision in g-j-d about a different default GC collector than the JVM defaults?

Minutely jstacks

For debugging purposes it can be helpful to have minutely jstacks written out to disk as a poor-man's version of assembling a flamegraph

Include files from arbitrary locations (like buildDir/work)

We have a service which generates some 100 or so files automatically which are included in the output distribution.

At the moment, this task dictates that we must store these generated files in projectDir/service.

It would be nice if we could instead supply a path to an alternate location to pull files from, like buildDir/work. Otherwise, we're cluttering our git repo with auto-generated files (or at the very least leaving behind a dirty git repo).

Allow building tar with configurations other than runtime

My project has multiple configurations (that extend from the runtime configuration) that allow the project to be built with differently versioned jars. I would like to be able to use distTar to build a tgz for each of these configurations, but currently, the plugin only works for runtime. Currently I have a project-distribution subproject that iterates over these configurations and exposes a dist task for each (distA, distB.. etc). If I could specify which configuration to use with this plugin, then I could instead make sub-projects for each of the different configurations and apply the plugin to a different configuration on each one (project-distribution-a:distTar, project-distribution-b:distTar). That's somewhat more overhead but it's the only way that I can think of that would make this work.

Supporting packaged JREs?

Some products like to package a JRE to reduce their dependency on the environment. There is currently not a good way to set JAVA_HOME to point at the packaged one from within init.sh or the start scripts. I'm not totally convinced products should do this as it makes your distro larger and platform-specific (generally linux only), but it seems to be a thing people want to do. There would need to be a good way for users to override it too, unless the answer is to publish two versions of everything.

init.sh fails to check status correctly if service name is different than project name

init.sh check tries to grep service name in the command for the PID. If the service name is different than project name, this check might fail with a generic failure message "process dead but PID exists".

Three options I can think of to make this better:
(1) A better way to check command for the PID (not sure if there's another easy way)
(2) Enforce service name to be same as project name
(3) At minimum, fail with a better message, like "Could not find service name in command for PID"

distTar task fails when project.version is not a string

See https://github.com/nmalaguti/repro-distribution-flexversion for a repro. Running ./gradlew distTar results in:

* What went wrong:
Execution failed for task ':createManifest'.
> No signature of method: java.lang.String.replaceAll() is applicable for argument types: (java.lang.String, com.palantir.gradle.versions.flexversioning.FlexVersion) values: [@serviceVersion@, master-1-g2c6266869ebb]
  Possible solutions: replaceAll(java.lang.String, java.lang.String), replaceAll(java.util.regex.Pattern, groovy.lang.Closure), replaceAll(java.util.regex.Pattern, java.lang.CharSequence), replaceAll(java.lang.CharSequence, java.lang.CharSequence), replaceAll(java.lang.CharSequence, groovy.lang.Closure), replace(char, char)

Since Gradle will convert the project.version object to a string when it needs to, I would expect the plugin to do the same.

Panic when running with incorrect jvm opts

This config:

configType: java
configVersion: 1
jvmOpts: -XX:-PerfDisableSharedMem

Produces this panic:

panic: yaml: unmarshal errors:
  line 12: cannot unmarshal !!str `-XX:-Pe...` into []string

goroutine 1 [running]:
panic(0x555de0, 0xc8200d9860)
        /usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/palantir/go-java-launcher/launchlib.ParseCustomConfig(0xc820093500, 0x156, 0x356, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/ubuntu/.go_workspace/src/github.com/palantir/go-java-launcher/launchlib/config.go:57 +0xf8
main.LaunchWithConfig(0x7fffd6e37e2e, 0x1f, 0x7fffd6e37e4e, 0x1c)
        /home/ubuntu/.go_workspace/src/github.com/palantir/go-java-launcher/go-java-launcher/main.go:36 +0x3d6
main.main()
        /home/ubuntu/.go_workspace/src/github.com/palantir/go-java-launcher/go-java-launcher/main.go:56 +0xf6

I would expect to instead get a helpful error message here about the correct format for the jvmOpts parameter needing to be a string array rather than just a string.

Corrected config is (from memory):

configType: java
configVersion: 1
jvmOpts:
 - "-XX:-PerfDisableSharedMem"

Avoid using afterEvaluate { } to configure the distTar task

Some Gradle plugins depend, for example, on the distTar task output filename to resolve against artifacts or publish locations. (For example, pt-almanac.) Since gradle-java-distribution adds an afterEvaluate to configure the output name, any output filenames fetched during normal project evaluation are not reliable, and will cause those plugins to break in non-obvious ways at runtime (see HIGHLINE-1091).

The workaround, as it exists currently, is to move the publication resolution strategy (or the entire almanacPublish task) to an afterEvaluate, but I find this difficult to maintain for the same reason _.defer isn't desirable in JS code. If, for example, the Almanac task is placed in a shared Gradle script, depending on it or modifying its configuration would probably require a nested afterEvaluate block.

I'd suggest refactoring the extension instead to mutate variables/properties synchronously, so that after the extension is reconfigured, the project is in a consistent/complete state and ready for further configuration. As an even stronger notion, the extension can be a call-me-once method, such that all necessary configuration is collected from the closure, and the run/dist tasks are created in immutable-state fashion from the one-time configuration closure.

Temp dir failures on windows

Disclaimer: I'm on 0.9.0, but I don't see any relevant changes in recent commits.

I'm running a java application on Windows. This application uses spring shell and jline, which means that it loads a .dll file to the temporary directory upon startup. This consistently fails for me due to the default JVM_OPT of -Djava.io.tmpdir=var/tmp/data - it doesn't seem to point to the correct directory on Windows. I've haven't been able to get any relative directory to work in this setting, but using a full path did work (e.g. C:...\var\tmp\data).

Enable GC logs by default

Probably best to have on by default in prod

Concerns:

  • what directory to write them to
  • log rotation
  • what exact flags to enable by default

print process id on start and status calls to init.sh

It would be helpful for our users is init.sh reported "Running (PID xxxxx)" instead of the current "Ok".

Furthermore, it would be a good idea to include some sort of logic to ensure the server actually started if at all possible (eg checking to see if the pid is still live after a few seconds...)

Enable GC logging

Something like

  launcherCustom:
    configType: java
    configVersion: 1
    jvmOpts:
      - '-XX:+PrintGCDateStamps'
      - '-XX:+PrintGCDetails'
      - '-XX:-TraceClassUnloading'
      - '-XX:+UseGCLogFileRotation'
      - '-XX:GCLogFileSize=10M'
      - '-XX:NumberOfGCLogFiles=10'
      - '-Xloggc:var/log/{{product_name}}.gc.log'
      - '-verbose:gc'

Stop command should kill whole process group

If the top-level (daemonized) service starts one or more long-running child processes, it has to ensure that those child processes get killed when the parent process is killed. This is somewhat painful to do in Java because it involves setting a shutdown hook, and it's repetitive work that's easy to get wrong. If done incorrectly, the child processes become zombies and have to be reaped manually by other means; they could take up system resources such as memory and ports.

Instead, if init.sh were to record the process group ID and kill the process group, we'd have a clean solution that works without additional work from the app.

Tagging @mingyukim, @tomkozlowski and @gdearment for comments.

Ability to create dist from configurations other than just `runtime`?

At the moment, the distTar task always uses the runtime configuration: https://github.com/palantir/gradle-java-distribution/blob/b5d2c60a3e9e59fa382a793c834eaf8dd23b5e54/src/main/groovy/com/palantir/gradle/javadist/DistTarTask.groovy#L48

To facilitate testing plugin points, I've added an extra eteDrivers configuration which has a couple of extra drivers. It would be great if the gradle-java-distribution plugin would allow me to set up both a normal distTar task and also an eteDistTar task.

`[service-name]` bash start script does not use JVM options from `launcher-custom.yml`

I'd like to run a custom dropwizard command (migrate) to do migrations, that needs the JVM trustStore system property to be set.

Since I can't use init.sh to run migrate, I tried to use the [service-name] bash start script, however, this did not pick up the JVM arguments I'd set in launcher-custom.yml.

  launcherCustom:
    configType: java
    configVersion: 1
    jvmOpts:
      - '-Djavax.net.ssl.trustStore=XXX'

Is this a reasonable approach to take or am I going about this the wrong way?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.