spring-boot/spring-boot-integration-tests/spring-boot-launch-script-tests
Andy Wilkinson 854cacdb4f Fix useStartStopDaemon in launch script and allow config via conf file
Commit 5a1ee6eb added support for disabling use of start-stop-daemon
via a placeholder in the default launch script. Unfortunately, that
placeholder was subsequently broken in 81a47639.

This commit reinstates the placeholder and adds tests to verify that all
of the placeholders in the launch script can be replaced and that they
have the required default values. Furthermore, it also allows the use of
start-stop-daemon to be configured via USE_START_STOP_DAEMON in an
app’s .conf file. This allows the configuration to be changed after the
app has been built.

Closes gh-4985
2016-01-21 14:58:51 +00:00
..
src Fix useStartStopDaemon in launch script and allow config via conf file 2016-01-21 14:58:51 +00:00
pom.xml Add integration tests for default launch script 2016-01-13 13:28:14 +00:00
README.adoc Add integration tests for default launch script 2016-01-13 13:28:14 +00:00

= Spring Boot Launch Script Tests

This module contains integration tests for the default launch script that is used
to make a jar file fully executable on Linux. The tests use Docker to verify the
functionality in a variety of Linux distributions.

== Setting up Docker

The setup that's required varies depending on your operating system.

=== Docker on OS X

Docker relies on Linux kernel features so the Docker Daemon must be run inside a Linux VM.
Following the https://docs.docker.com/engine/installation/mac/[OS X installation
instructions] to install Docker Toolbox which uses VirtualBox to host the required VM.

=== Docker on Linux

Install Docker as appropriate for your Linux distribution. See the
https://docs.docker.com/engine/installation/[Linux installation instructions] for more
information.

Next, add your user to the `docker` group. For example:

----
$ sudo usermod -a -G docker awilkinson
----

You may need to log out and back in again for this change to take affect and for your
user to be able to connect to the daemon.

== Preparing to run the tests

Before running the tests, you must prepare your environment according to your operating
system.

=== Preparation on OS X

The tests must be run in an environment where various environment variables including
`DOCKER_HOST` and `DOCKER_CERT_PATH` have been set:

----
$ eval $(docker-machine env default)
----

=== Preparation on Linux

Docker Daemon's default configuration on Linux uses a Unix socket for communication.
However, Docker's Java client uses HTTP by default. Docker Java's client can be configured
to use the Unix socket via the `DOCKER_URL` environment variable:

----
$ export DOCKER_URL=unix:///var/run/docker.sock
----

== Running the tests

You're now ready to run the tests. Assuming that you're in the same directory as this
README, the tests can be launched as follows:

----
$ mvn -Pdocker clean verify
----

The first time the tests are run, Docker will create the container images that are used to
run the tests. This can take several minutes, particularly if you have a slow network
connection. Subsequent runs will be faster as the images are cached locally. You can run
`docker images` to see a list of the cached images.

== Cleaning up

If you want to reclaim the disk space used by the cached images (at the expense of having
to wait for them to be downloaded and rebuilt the next time you run the tests), you can
use `docker images` to list the images and `docker rmi <image>` to delete them. See
`docker rmi --help` for further details.