Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify and fix grammar for Formats docs #867

Merged
merged 73 commits into from
Aug 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
f4ffa80
grammar: replace comma splice with "that"
weedySeaDragon Aug 17, 2016
89a274c
'dendend' isn't a word; clarified
weedySeaDragon Aug 17, 2016
66d2c62
Sentences about 'settings' should go in their own paragraph. (''...de…
weedySeaDragon Aug 17, 2016
1f9587f
fix grammar; 'because' is stronger and clearer
weedySeaDragon Aug 17, 2016
bcca9cd
fix awkard sentence construction; clarify
weedySeaDragon Aug 17, 2016
4df5a78
use 'output' to be in line with the 'Output' section below. (also: 'p…
weedySeaDragon Aug 17, 2016
f5a3256
Include the idea that the files generated are in a specific format. (…
weedySeaDragon Aug 17, 2016
4a1475d
Must define "universal packaging" (esp. for newbies). Clarify the int…
weedySeaDragon Aug 17, 2016
65d2de0
correct grammar; refer to the plugin in a standardized way
weedySeaDragon Aug 17, 2016
c99d1c8
Added sentence to explain the code block
weedySeaDragon Aug 17, 2016
d5a974f
fix capitalization; standardize reference to "mappings" (previous do…
weedySeaDragon Aug 17, 2016
428070b
explain the cli options. Add needed blank line between sentences. A…
weedySeaDragon Aug 17, 2016
158a4a8
clarify by separating the explanation from the example.
weedySeaDragon Aug 17, 2016
aaa4658
clarify 'add build generated' (is unclear to novices); correct 'simpl…
weedySeaDragon Aug 17, 2016
db5d835
new paragraph: the sentence is a thought important and different enou…
weedySeaDragon Aug 17, 2016
e88eea8
consistency: stage formatted as code; insert "a" since here 'build' r…
weedySeaDragon Aug 18, 2016
ac3c54c
format IO like Path; refer the the APIs (plural). Fix akward sentenc…
weedySeaDragon Aug 18, 2016
68b9544
fix comma splice
weedySeaDragon Aug 18, 2016
ce711c7
Put simple mapping dir examples first. Explain the complex example b…
weedySeaDragon Aug 18, 2016
89d4e89
add '..excluding the directory itself' so the header makes it clear h…
weedySeaDragon Aug 18, 2016
1fa721f
comma splice
weedySeaDragon Aug 18, 2016
d263c6a
should be 'linux' plugin (not debian)
weedySeaDragon Aug 18, 2016
3875036
missing backTick. run-on sentence
weedySeaDragon Aug 18, 2016
e990067
should be "Defaults to..."; added ? for clarity
weedySeaDragon Aug 18, 2016
06ec785
make all "Default =" consistent
weedySeaDragon Aug 18, 2016
6326761
clarify paragraphs. Emphasize the actions. Add whitespace and clarif…
weedySeaDragon Aug 18, 2016
76996c1
added missing backTick
weedySeaDragon Aug 18, 2016
2054a31
emphasize the filter action; standardize how to refer to filter examp…
weedySeaDragon Aug 18, 2016
429c757
use title of reference in the text; link to page
weedySeaDragon Aug 18, 2016
a8cdcec
call out 2 different approaches with numbered list. is more readable …
weedySeaDragon Aug 18, 2016
d9d1200
comma splice
weedySeaDragon Aug 18, 2016
a7d5c57
remove period, replace with parallel ":"s
weedySeaDragon Aug 18, 2016
d99643c
add words to contrast it to an AutoPlugin (with link)
weedySeaDragon Aug 18, 2016
aed3975
fix grammar; clarify example description
weedySeaDragon Aug 18, 2016
86aa18d
add headings for examples -- easier to scan the info and find example…
weedySeaDragon Aug 18, 2016
836f444
grammar fix; replace link with title of page. take quotes off of bin…
weedySeaDragon Aug 18, 2016
fa18cfe
replace comma with colon
weedySeaDragon Aug 18, 2016
94424c0
fix 'scriptles' typo
weedySeaDragon Aug 18, 2016
6b63bde
missing word
weedySeaDragon Aug 18, 2016
e797cf3
grammar fix
weedySeaDragon Aug 18, 2016
1e1b0ec
Emphasize 2 different approaches with a numbered list, strong text. …
weedySeaDragon Aug 18, 2016
982641a
colon is needed. emphasize this appends with itals
weedySeaDragon Aug 18, 2016
8e38188
formatting to clarify Docker info, set off from sbt-native-packager info
weedySeaDragon Aug 18, 2016
57510df
fix awkward sentence
weedySeaDragon Aug 18, 2016
1afab3f
contrast 'provided' vs. 'autoPlugin' and provide link to explanations…
weedySeaDragon Aug 18, 2016
d54ce59
fix typo
weedySeaDragon Aug 18, 2016
96858bf
wrong word (should be plugin)
weedySeaDragon Aug 18, 2016
fbb45db
comma splice
weedySeaDragon Aug 18, 2016
e70a687
add 'version' so anyone skimming thru the page for that will spot it …
weedySeaDragon Aug 18, 2016
7e55cb5
add 'then' to sync with 'first'
weedySeaDragon Aug 18, 2016
9342194
missing word
weedySeaDragon Aug 18, 2016
2be5327
clarify filtering. include a reference/link to the filter method des…
weedySeaDragon Aug 18, 2016
b17c2c1
use present tense. colon required
weedySeaDragon Aug 18, 2016
68d1511
add comments to clarify code; fix typo
weedySeaDragon Aug 18, 2016
cbc8ad1
annote the code
weedySeaDragon Aug 18, 2016
6c8c2ea
use present tense; clarify. include a link to define ash shell. ital…
weedySeaDragon Aug 18, 2016
f2ace76
link to the `java-app-plugin` page;
weedySeaDragon Aug 19, 2016
dd715e8
noun/verb agreement. standardize how sbt-native-packager is used
weedySeaDragon Aug 19, 2016
c4c5104
link to the wix site
weedySeaDragon Aug 19, 2016
5417965
noun/verb agreement
weedySeaDragon Aug 19, 2016
82ca26a
make description of code more specific; capitalize Windows
weedySeaDragon Aug 19, 2016
9271f75
clarify intro paragraph. include link to javapackager
weedySeaDragon Aug 19, 2016
11f328b
comma splice
weedySeaDragon Aug 19, 2016
77c1386
capitalize Windows
weedySeaDragon Aug 19, 2016
2fb2820
use a reference to the Java App archetype
weedySeaDragon Aug 19, 2016
8722e68
phrases were ambiguous; clarified
weedySeaDragon Aug 19, 2016
84de452
removed extra backTick
weedySeaDragon Aug 19, 2016
6012bf7
replace 'sans' with 'without the'
weedySeaDragon Aug 19, 2016
1e3917d
link to javapackager site
weedySeaDragon Aug 19, 2016
0dc67ae
typos
weedySeaDragon Aug 19, 2016
765e846
link to Oracle documentation
weedySeaDragon Aug 19, 2016
34a938e
format settings lines
weedySeaDragon Aug 19, 2016
9ddf24b
corrections per review comments: remove AutoPlugin, enought, use :=
weedySeaDragon Aug 20, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions src/sphinx/formats/debian.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ Debian Plugin
=============

The debian package specification is very robust and powerful. If you wish to do any advanced features, it's best to understand how
the underlying packaging system works. http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/ is an excellent tutorial.
the underlying packaging system works. `Debian Binary Package Building HOWTO`_ by Chr. Clemens Lee is an excellent tutorial.

SBT Native Packager provides two ways to build debian packages. A native one, where you need ``dpkg-deb`` installed
or a java, platform independent approach with `jdeb <https://github.com/tcurdt/jdeb>`_. By default the *native* implementation
is activated.
.. _Debian Binary Package Building HOWTO: http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/


SBT Native Packager provides two ways to build debian packages:

1. A native implementation, where you need ``dpkg-deb`` installed, or
2. A java, platform independent approach with `jdeb <https://github.com/tcurdt/jdeb>`_.

By default the *native* implementation is activated.

.. note:: The debian plugin depends on the :ref:`linux-plugin`.

Expand Down Expand Up @@ -79,7 +85,7 @@ installation of the generated debian package in the following configuration:

- installation using python-apt module, used by Ansible and SaltStack for
example,
- being on python-apt 8.8 series, that's on Debian Wheezy and perhaps older
- being on python-apt 8.8 series that's on Debian Wheezy and perhaps older

It will fail with an error message like::

Expand All @@ -95,23 +101,22 @@ Solutions include:
Java based packaging
~~~~~~~~~~~~~~~~~~~~

If you want to use the java based implementation, enable the following plugin.
If you want to use the java based implementation, enable the following plugin:

.. code-block:: scala

enablePlugins(JDebPackaging)

and this to your ``plugins.sbt``
and this to your ``plugins.sbt``:

.. code-block:: scala

libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))

JDeb is a provided dependency so you have to add it on your own. It brings a lot of dependencies
JDeb is a provided dependency. You have to explicitly add it on your own. It brings a lot of dependencies
that could slow your build times. This is the reason the dependency is marked as provided.



Configurations
--------------

Expand Down Expand Up @@ -180,23 +185,26 @@ The Debian support grants the following commands:
Customize
---------------

This section contains example on how you can customize your debian build.
This section contains examples of how you can customize your debian build.

Customizing Debian Metadata
~~~~~~~~~~~~~~~~~~~~~~~~~~~

A Debian package provides metadata, which includes **dependencies** and **recommendations**.
A basic example to depend on java and recommend a git installation.
This example adds a dependency on java and recommends a git installation.

.. code-block:: scala

debianPackageDependencies in Debian ++= Seq("java2-runtime", "bash (>= 2.05a-11)")

debianPackageRecommends in Debian += "git"

Hook Actions into the Debian Package Lifecycle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To hook into the debian package lifecycle (https://wiki.debian.org/MaintainerScripts) you
can add ``preinst`` , ``postinst`` , ``prerm`` and/or ``postrm`` scripts. Just place them into
``src/debian/DEBIAN``. Or you can do it programmatically in your ``build.sbt``
``src/debian/DEBIAN``. Or you can do it programmatically in your ``build.sbt``. This example adds actions to ``preinst`` and ``postinst``:

.. code-block:: scala

Expand All @@ -210,7 +218,10 @@ The helper methods can be found in `MaintainerScriptHelper Scaladocs`_.

If you use the ``JavaServerAppPackaging`` there are predefined ``postinst`` and
``preinst`` files, which start/stop the application on install/remove calls. Existing
maintainer scripts will be extended not overridden.
maintainer scripts will be *extended* not overridden.

Use a Different Castle Directory for your Control Scripts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah :( I guess you can remove the bad jokes here as well ;)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Your control scripts are in a different castle.. directory? No problem.

Expand Down
57 changes: 33 additions & 24 deletions src/sphinx/formats/docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ Docker Plugin
Docker images describe how to set up a container for running an application, including what files are present, and what program to run.

https://docs.docker.com/introduction/understanding-docker/ provides an introduction to Docker.
https://docs.docker.com/reference/builder/ describes the Dockerfile; a file which describes how to set up the image.

sbt-native-packager focuses on creating a Docker image which can "just run" the application built by SBT.
https://docs.docker.com/reference/builder/ describes the ``Dockerfile``: a file which describes how to set up the image.

sbt-native-packager focuses on creating a Docker image which can "just run" the application built by SBT.

.. note:: The docker plugin depends on the :ref:`universal-plugin`.

Requirements
------------

You need the docker console client installed and version `1.3` or higher is required.
You need the version 1.3 or higher of the docker console client installed.
SBT Native Packager doesn't use the REST API, but instead uses the CLI directly.

It is currently not possible to provide authentication for Docker repositories from within the build.
Expand Down Expand Up @@ -55,9 +56,10 @@ and this to your ``plugins.sbt``

libraryDependencies += "com.spotify" % "docker-client" % "3.5.13"

The Docker-spotify client is a provided dependency so you have to add it on your own.
It brings a lot of dependenciesthat could slow your build times. This is the reason
the dependency is marked as provided.
The Docker-spotify client is a provided dependency. You have to explicitly add it on your own. It brings a lot of dependencies
that could slow your build times. This is the reason the dependency is marked as provided.



Configuration
-------------
Expand Down Expand Up @@ -130,7 +132,7 @@ Publishing Settings

Tasks
-----
The Docker support provides the following commands:
The Docker plugin provides the following commands:

``docker:stage``
Generates a directory with the Dockerfile and environment prepared for creating a Docker image.
Expand All @@ -145,13 +147,13 @@ The Docker support provides the following commands:
Customize
---------

There are some predefined settings, which you can easily customize. These
There are some predefined settings which you can easily customize. These
settings are explained in some detail in the next sections. If you want to
describe your Dockerfile completely yourself, you can provide your own
`docker commands` as described in `Custom Dockerfile`_.

Docker Image Name
~~~~~~~~~~~~~~~~~
Docker Image Name and Version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: scala

Expand Down Expand Up @@ -184,11 +186,11 @@ Docker Image Customization


In order to work properly with `USER daemon` the exposed volumes are first
created (if they do not existend) and chowned.
created (if they do not existend) and then chowned.

Install Location
~~~~~~~~~~~~~~~~
The path to which the application is written can be changed with the setting.
The path to which the application is written can be changed with the location setting.
The files from ``mappings in Docker`` are extracted underneath this directory.

.. code-block:: scala
Expand All @@ -215,8 +217,8 @@ In your sbt console type
Remove Commands
~~~~~~~~~~~~~~~

SBT Native Packager added some commands you may not need. For example
the chowning of a exposed volume.
SBT Native Packager adds commands you may not need. For example,
the chowning of a exposed volume:

.. code-block:: scala

Expand All @@ -225,27 +227,30 @@ the chowning of a exposed volume.
// we want to filter the chown command for '/data'
dockerExposedVolumes += "/data"

// use filterNot to return all items that do NOT meet the criteria
dockerCommands := dockerCommands.value.filterNot {

// ExecCmd is a case class, and args is a varargs variable, so you need to bind it with @
case ExecCmd("RUN", args @ _*) => args.contains("chown") && args.contains("/data")

// dont filter the rest
// don't filter the rest; don't filter out anything that doesn't match a pattern
case cmd => false
}


Add Commands
~~~~~~~~~~~~

Adding commands is as straightforward as adding anything in a list.
Since ``dockerCommands`` is just a ``Sequence``, adding commands is straightforward:

.. code-block:: scala

import com.typesafe.sbt.packager.docker._

// use += to add an item to a Sequence
dockerCommands += Cmd("USER", daemonUser.value)

// use ++= to merge a sequence with an existing sequence
dockerCommands ++= Seq(
// setting the run script executable
ExecCmd("RUN",
Expand Down Expand Up @@ -281,21 +286,25 @@ Now let's start adding some Docker commands.
Busybox/Ash Support
~~~~~~~~~~~~~~~~~~~

The default shell support for the Java archetype (JavaAppPackaging) is bash, with a Windows
bat file also generated. Busybox is a popular minimal Docker base image that uses ash, a much
more limited shell than bash. The result is that if you build a Docker image for Busybox the
Busybox is a popular minimal Docker base image that uses ash_, a much
more limited shell than bash. By default, the Java archetype (:ref:`java-app-plugin`) generates two files for shell
support: a ``bash`` file, and a Windows ``.bat`` file. If you build a Docker image for Busybox using the defaults, the
generated bash launch script will likely not work.

Optionally you can use an ash-compatible archetype that derives from JavaAppPacking called
AshScriptPlugin. Enable this by including:
.. _ash: https://en.wikipedia.org/wiki/Almquist_shell

To handle this, you can use *AshScriptPlugin*, an ash-compatible archetype that is derived from the :ref:`java-app-plugin` archetype.
. Enable this by including:

.. code-block:: scala

enablePlugins(AshScriptPlugin)

With this plugin enabled an ash-compatible launch script will be generated in your Docker image.

Just like for JavaAppPackaging you have the option of overriding the default script by supplying
your own src/templates/ash-template file. When overriding the file don't forget to include
${{template_declares}} somewhere to populate $app_classpath $app_mainclass from your sbt project.
Just like for :ref:`java-app-plugin`, you have the option of overriding the default script by supplying
your own ``src/templates/ash-template`` file. When overriding the file don't forget to include
``${{template_declares}}`` somewhere to populate ``$app_classpath $app_mainclass`` from your sbt project.
You'll likely need these to launch your program.


12 changes: 7 additions & 5 deletions src/sphinx/formats/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Packaging Formats
#################

There is a plugin for each packaging format, native-packager supports. These plugins can rely on each other to reuse
There is a plugin for each packaging format that native-packager supports. These plugins can rely on each other to reuse
existing functionality. Currently the autoplugin hierarchy looks like this ::

SbtNativePackager
Expand All @@ -22,8 +22,10 @@ existing functionality. Currently the autoplugin hierarchy looks like this ::
Debian RPM


If you enable the ``DebianPlugin`` all dependend plugins will be enabled as well (``LinuxPlugin``, ``UniversalPlugin``
and ``SbtNativePackager``). Each packaging format defines its own scope for settings and tasks, so you can customize
If you enable the ``DebianPlugin`` all plugins that depend on the ``DebianPlugin`` will be enabled as well (``LinuxPlugin``, ``UniversalPlugin``
and ``SbtNativePackager``).

Each packaging format defines its own scope for settings and tasks, so you can customize
your build on a packaging level. The settings and tasks must be explicitly inherited. For the ``mappings`` task this
looks like this

Expand All @@ -34,8 +36,8 @@ looks like this

To learn more about a specific plugin, read the appropriate doc.

.. tip:: You may also need to read the docs of the dependent plugins. We recommend always to read the
:ref:`universal-plugin` documentation as all plugins rely on this one.
.. tip:: You may also need to read the docs of the dependent plugins. We recommend always that you read the
:ref:`universal-plugin` documentation because all plugins rely on this one.

.. toctree::
:maxdepth: 1
Expand Down
Loading