Skip to content

Commit

Permalink
umask can also be set via bashScriptExtraDefines (#1274)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurz authored and muuki88 committed Nov 5, 2019
1 parent 4b7d917 commit 8b76983
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/sphinx/archetypes/cheatsheet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ For a bash script this could look like this.
"""addJava "-Xmx2048m""""
)
For information take a look at the :doc:` customize section for java apps </archetypes/java_app/customize>`
For more information take a look at the :ref:`according documentation<add-code-to-the-start-scripts>`.

File - application.ini or etc-default
-------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/sphinx/archetypes/java_app/customize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ The default configuration looks like this
bashScriptConfigLocation := Some("${app_home}/../conf/application.ini")
batScriptConfigLocation := Some("%APP_HOME%\\conf\\application.ini")
.. _add-code-to-the-start-scripts:

Add code to the start scripts
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
1 change: 1 addition & 0 deletions src/sphinx/recipes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ This section provides recipes for common configurations. If you can't find what
scalajs
package_configuration
embedded-jvm
umask

.. _sbt-native-packager examples: https://github.com/muuki88/sbt-native-packager-examples
32 changes: 25 additions & 7 deletions src/sphinx/recipes/umask.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,36 @@
Setting the umask for your process
==================================

When using the :ref:`java-server-plugin`, the umask, associated with the user running the process,
will determine what permissions files generated by the process, such as log file, will have. Usually the system default umask
for daemons is fine and can be left unchanged, however sometime the need arises to oerride it.
In Linux, the umask, associated with the user running the process, will determine what permissions files generated by the process,
such as log files, will have.

Within the start script
-------------------------------------

You can set the umask within the generated start script:

.. code-block:: scala
bashScriptExtraDefines += "umask 077"
This line will be added just before the application will be executed by the start script and therefore the application process
will also inhert this umask. For more information take a look at the :ref:`according documentation<bash-script-defines>`.

.. hint:: When using :ref:`Docker<docker-plugin>` this is the only reliable way `right now <https://github.com/moby/moby/issues/19189>`_ to set the umask for the process. Docker `will ignore <https://stackoverflow.com/a/46900270/810109>`_ any umask set in e.g. `/etc/login.defs` (or other config files) within a docker image.

System V/systemd
----------------

To set a custom umask for your application that is running either via a System V init script or systemd, the umask can be
specified via a custom ``/etc/default/appname`` file. The contents of this file can be specified by creating a template at
``src/templates/etc-default`` and adding a line such as the following:
When using the :ref:`java-server-plugin` usually the system default umask for daemons is fine and can be left unchanged,
however sometime the need arises to override it.

As an alternative to the start script approach described in the section above, to set a custom umask for
your application that is running either via a System V init script or systemd, the umask can be specified via
a custom ``/etc/default/appname`` file.

The contents of this file can be specified by creating a template at ``src/templates/etc-default`` and adding a line such as the following:


.. code-block:: bash
umask 022
umask 077

0 comments on commit 8b76983

Please sign in to comment.