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

umask can also be set via bashScriptExtraDefines #1274

Merged
merged 1 commit into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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