Overview
With pre-init and/or post-init scripts it is possible to customize FlashGrid Cluster deployments by adding custom steps. Examples:
- Linux OS hardening
- Creating Oracle database
- Configuring Oracle services
- Additional software installation
How it works
- Pre-init script(s) will run on each cluster node in the beginning of the cluster init process, before FlashGrid software initialization starts. Typical use-cases are OS hardening or installing 3rd party software packages. The script(s) will run as root user. If multiple scripts are specified then they will run serially in the order they are specified.
- Post-init script(s) will run on each cluster node in the end of the cluster init process. Typical use-cases include creating a database or configuring Oracle services. The script(s) will run as root user. If multiple scripts are specified then they will run serially in the order they are specified.
The script files must be accessible from the same storage location (storage bucket/container) where Oracle installation files are located. The same script files can be used for deploying different clusters. The scripts can be bash script or any executable files. Parameters for the scripts can be passed through the Launcher config file when generating the CloudFormation / ARM / Deployment Manager template.
Parameters
The following parameters can be added to the [nodes]
section of the FlashGrid Launcher config file:
pre_init_script_filenames = ['script.a', 'script.b' ... ]
post_init_script_filenames = ['script.c', 'script.d' ... ] pre_and_post_init_script_env = { 'var1': 'value1', 'var2': 'value2' ... }
Note that the following parameters have been deprecated starting with Launcher version 21.11. Use the parameters above instead.
pre_init_script_filename = 'script.a' # deprecated
post_init_script_filename = 'script.b' # deprecated
The pre_and_post_init_script_env
parameter allow setting environment variables for the scripts and can be used for passing cluster-specific parameters to the scripts.
Additionally, the following environment variables will be set automatically and can be used for executing node-specific actions.
FG_FIRST_NODE=yes/no
- check this variable to determine whether the node is the first node in the cluster. This can be used when certain action must be executed from one node only, e.g. creating a database. FG_NODE_TYPE=database/db-only/quorum/storage
- check this variable to determine node type. This can be used when certain actions depend on node type, e.g. if action must be executed on database nodes only.
Do not specify FG_FIRST_NODE
or FG_NODE_TYPE
in pre_and_post_init_script_env
.
Error handling
If the script returns a non-zero return code then the cluster initialization will be considered as failed.
Troubleshooting
FlashGrid recommends logging the timestamp and the result of each action performed in the custom scripts in /tmp/pre_init.log and /tmp/post_init.log files.
If cluster initialization fails in presence of a pre-init and/or post-init script, the following actions are recommended:
- Check /tmp/fg_setup.log to determine whether the failure occurred before, during, or after executing the pre-init or post-init scripts.
- Try re-deploying the cluster without the pre-init and post-init scripts. This will help to confirm whether one of the scripts has introduced the problem. Note that a pre-init script might introduce incompatibility and cause the subsequent init actions to fail even if the pre-init script completes successfully.
- Upload /tmp/fg_setup.log, /tmp/pre_init.log, and /tmp/post_init.log files to FlashGrid support, open a support ticket, and share your custom scripts if possible.