Init Scripts
It can be difficult to access a container directly to configure it. Seq supports running one-time initialization scripts from a mounted directory in a container before it starts the server itself.
The following is an example of an init script:
#!/bin/bash
seqsvr restore --from-latest -y
Init scripts can be any executable file (they don't necessarily have to be shell scripts).
Within the container, the
seq
executable is on the path asseqsvr
. See the section the init environment below for more information.
Init script locations
Seq will check two container-local locations for init scripts to run:
/seqinit
— Scripts are copied from this location into/data/Init
. The/seqinit
directory is suitable as a separate read-only volume mount./data/Init
— Scripts are executed and updated directly from this location. The/data/Init
directory is suitable for storing init scripts alongside existing data.
How init scripts are run
Init scripts are run from the /data/Init
directory one-at-a-time in alphabetical order before Seq is started. The scripts are exec
'ed by the shell environment, so they can be executables or scripts.
Once a script has completed, it's renamed to {old-name}.done
, so a script named 1-setup.sh
will become 1-setup.sh.done
. Scripts with a .done
suffix are not re-run and will need to be manually renamed to execute them again.
The init environment
Within the datalust/seq
container, the seq
executable is called seqsvr
. (This is because seq
is a built-in shell command on Linux.)
Init scripts should not make assumptions about their own location or working directory. The location of the Seq storage root is available to init scripts in the DATA_DIR
environment variable.
Scripts can call seqsvr
commands or start temporary instances of Seq as needed. See Server Configuration for a full list of configuration values that can be set.
Updated 6 months ago