Skip to content

Commit 1e59217

Browse files
Support overwriting bootstrap scripts (#1174)
[ci] fixes #1170 Signed-off-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org> Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
1 parent 2100cb1 commit 1e59217

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

cluster/images/common/entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ if [ -f /app/pre-bootstrap.sh ]; then
2727
source /app/pre-bootstrap.sh
2828
fi
2929

30+
if [ -n "${OVERRIDE_BOOTSTRAP_SCRIPT:-}" ]; then
31+
json_log "Overwriting bootstrap script from environment variable"
32+
echo "$OVERRIDE_BOOTSTRAP_SCRIPT" > /app/bootstrap.sc
33+
fi
34+
3035
if [ -f /app/bootstrap.sc ]; then
3136
ARGS+=( --bootstrap /app/bootstrap-entrypoint.sc )
3237
fi

docs/src/deployment/configuration.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,32 @@ Furthermore, the participant and other synchronizer components can be configured
3232

3333
.. todo:: point to the release that these docs are built from; or inline the source code or Scaladoc to avoid confusion
3434

35+
Custom bootstrap scripts
36+
++++++++++++++++++++++++
37+
38+
Both Canton and splice support bootstrap scripts during
39+
initialization. While this usually should not be needed as the
40+
validator app takes care of initializing the node, in some scenarios
41+
it can be useful. To do so, you need to set the
42+
``OVERRIDE_BOOTSTRAP_SCRIPT`` environment variable to the content of your bootstrap script.
43+
Note that the script must be wrapped in a ``main`` function, e.g.,
44+
45+
.. code::
46+
47+
def main() {
48+
logger.info(s"Participant id from bootstrap script: ${participant.id}")
49+
}
50+
51+
You can set this environment variable through ``additionalEnvVars`` as described below.
52+
53+
Note that this overwrites any bootstrap scripts baked into the
54+
container image. So if you added custom functionality there, you will
55+
need to replicate this in the overwrite.
3556

3657
Helm charts support
3758
^^^^^^^^^^^^^^^^^^^
3859

39-
The helm charts can be configured through the value `additionalEnvVars`, which passes the values as environment variables to the apps.
60+
The helm charts can be configured through the value ``additionalEnvVars``, which passes the values as environment variables to the apps.
4061

4162
.. code-block:: yaml
4263

0 commit comments

Comments
 (0)