Skip to content

Commit

Permalink
#4324 - Allow configuring UID GID etc in Kubernetes
Browse files Browse the repository at this point in the history
- Improve documentation
  • Loading branch information
reckart committed Dec 2, 2023
1 parent 3c51d7e commit 6e64770
Showing 1 changed file with 31 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,33 @@ annotations and knowledge bases, these are stored in files on disk). For product
recommended to use a dedicated database server (i.e. MariaDB or compatible) instead of the embedded
SQL database.

== Memory and other Java options

By default, {application-name} will use 80% of the memory allocated to the container.
However, if you allocate very little or very much memory to the container, you may want to adjust this.

For example, to set the available memory (RAM) to e.g. 4GB, append `-Xmx4g`.

[source,shell,subs="+attributes"]
----
$ docker run -it -e JAVA_OPTS=-Xmx4g ghcr.io/inception-project/inception:{revnumber}
----

Be sure to leave some memory for the operating system inside the Docker container as well. Instead of setting a fixed value for the memory, you might consider allocating a percentage of the container's memory to {application-name} using `-XX:MaxRAMPercentage=80`.

[source,shell,subs="+attributes"]
----
$ docker run -it -e JAVA_OPTS=-XX:MaxRAMPercentage=80 ghcr.io/inception-project/inception:{revnumber}
----

The applications logs the amount of memory it will use during startup. Check this value to validate that your memory setting takes effect.

----
INFO [main] [SYSTEM] boot - Max. application memory: 4096MB
---
You also pass additional options to the Java runtime through the `JAVA_OPTS` environment variable. This also includes system properties, e.g. `-DpropertName=value`. Most of the settings that can be configured in the `settings.properties` file can also be supplied in this way instead.
== Customizing UID/GID
By default, {product-name} runs with the UID 2000 and the GID 2000. On startup, any files belonging to {product-name} are automatically reassigned to these UID/GID, in the Docker container itself as well as in any volume potentially mounted under `/export` within the container. If you need the application to run as a different UID/GID, you can override these values when starting the container using the `APP_UID` and `APP_GID` environment variables.
Expand All @@ -109,6 +136,10 @@ By default, {product-name} runs with the UID 2000 and the GID 2000. On startup,
$ docker run -it -e APP_UID=1234 -e APP_GID=4321 ghcr.io/inception-project/inception:{revnumber}
----
NOTE: If the container is already started using a non-root UID, then `APP_UID` and `APP_GID` have no effect and also
no changes to the file ownerships in `/export` will be performed. This is e.g. the case when running a container using
`-u` parameter or using the Kubernetes `runAsUser` setting.
== Docker Compose
Using Docker Compose, you can manage multiple related containers. This section illustrates how to use
Expand Down Expand Up @@ -183,15 +214,5 @@ you mount the data to folders on your host.
NOTE: Mind that you cannot arbitrarily switch between volume-managed and host-stored data. Choose wisely.
=== Java options

You can pass additional options to the Java runtime by extending the `JAVA_OPTS` variable in the
Docker Compose script. To increase the available memory (RAM) to e.g. 4Gb, append `-Xmx4g`.

[source,shell,subs="+attributes"]
----
- JAVA_OPTS=-Dspring.jpa.properties.hibernate.dialect.storage_engine=innodb -Xmx4g
----

There is a lot more that you can do using Docker and Docker Compose. Please see the link:https://docs.docker.com/compose/[docker-compose reference] for details.

0 comments on commit 6e64770

Please sign in to comment.