Skip to content

Commit 286b79f

Browse files
authored
Issue #371 - Documentation for alternate configuration directory (#640)
* Issue #371 - Documentation for alternate configuration directory * Issue #371 - Updates from review
1 parent cf37e7f commit 286b79f

File tree

6 files changed

+76
-19
lines changed

6 files changed

+76
-19
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ Many organizations are using WebLogic Server, with or without other Oracle Fusio
3030
- [ODL Configuration](site/odl_configuration.md)
3131
- [Configuring Oracle HTTP Server (OHS)](site/ohs_configuration.md)
3232
- [Configuring Oracle WebLogic Server Kubernetes Operator](site/kubernetes.md)
33-
- [Variable Injection](site/variable_injection.md)
3433
- [Model Samples](site/samples/samples.md)
35-
- [Model Filters](site/tool_filters.md)
3634
- [The Archive File](site/archive.md)
35+
- Configuration
36+
- [Custom Configuration](site/config/custom_configuration.md)
37+
- [Model Filters](site/tool_filters.md)
38+
- [Type Definitions](site/type_def.md)
39+
- [Variable Injection](site/variable_injection.md)
3740
- [Downloading and Installing](#downloading-and-installing-the-software)
3841
- [Developer Guide](site/developer/developer_guide.md)
3942
- [Known Issues](KnownIssues.md)

site/config/custom_configuration.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Custom Configuration
2+
3+
WDT allows you to create or extend the pre-installed type definitions, model filters, variable injectors, and target environments. Starting with WDT 1.10.0, these additional configuration files can be stored outside the `$WLSDEPLOY_HOME/lib` directory. This allows the files to remain in place if the WDT installation is moved or upgraded to a new version.
4+
5+
To use a separate configuration directory, set the `WDT_CUSTOM_CONFIG` environment variable to the directory to be used for configuration. For example:
6+
```
7+
export WDT_CUSTOM_CONFIG=/etc/wdtconfig
8+
```
9+
10+
The customized configuration files should be named and organized the same way they would be under the `$WLSDEPLOY_HOME/lib` directory. For example:
11+
```
12+
/etc/wdtconfig
13+
injectors
14+
*.json (injector files)
15+
typedefs
16+
*.json (typedef files)
17+
targets
18+
my-target
19+
target.json
20+
*.py (filter files)
21+
model_filters.json
22+
model_variable_injector.json
23+
variable_keywords.json
24+
```
25+
This is a full set of files that can be configured. You will need only to add the files you have created or extended. Details for each configuration type are found at the following links:
26+
- [Model Filters](../tool_filters.md)
27+
- [Type Definitions](../type_def.md) (see [example](#example-extending-a-type-definition) below)
28+
- [Variable Injection](../variable_injection.md)
29+
- [The Prepare Model Tool](../prepare.md) (target environments)
30+
31+
The WDT tools will look for each configuration file under `$WDT_CUSTOM_CONFIG` if specified, then under `$WLSDEPLOY_HOME/lib`.
32+
33+
### Example: Extending a Type Definition
34+
35+
To extend the `WLS` type definition, follow these steps:
36+
- Create a directory to use for custom configurations, such as `/etc/wdtconfig`.
37+
- Define the `WDT_CUSTOM_CONFIG` environment variable to point to that directory.
38+
- Copy the file `$WLSDEPLOY_HOME/lib/typedefs/WLS.json` to the `$WDT_CUSTOM_CONFIG/typedefs` directory and rename it, for example `MY_WLS.json`.
39+
- Edit `MY_WLS.json` with any required changes.
40+
- Run the tool referencing the name of the new type definition, for example:
41+
```
42+
createDomain.cmd -oracle_home /wls12213 -domain_type MY_WLS ...
43+
```

site/prepare.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,17 @@ from the model that are not compatible with the WebLogic Kubernetes Operator, re
99

1010
To use the Prepare Model Tool, simply run the `prepareModel` shell script with the correct arguments. To see the list of valid arguments, simply run the shell script with the `-help` option (or with no arguments) for usage information.
1111

12-
```
1312
To prepare model files, run the tool as follows:
14-
15-
$WLSDEPLOY_HOME/bin/prepareModel.sh -oracle_home /u01/wls12213 -model_file [command separed list of models] -target k8s -output_dir $HOME/k8soutput
16-
13+
```
14+
$WLSDEPLOY_HOME/bin/prepareModel.sh -oracle_home /u01/wls12213 -model_file [command separed list of models] -target k8s -output_dir $HOME/k8soutput
1715
```
1816

19-
In the output directory, you will find
20-
17+
In the output directory, you will find:
2118
```
2219
model1.yaml
2320
model2.yaml
2421
create_k8s_secrets.sh
2522
k8s_variable.properties
26-
2723
```
2824

2925
You can then customize the `k8s_variable.properties` and `create_k8s_secrets.sh` to provide environment specific values.
@@ -32,8 +28,9 @@ You can then customize the `k8s_variable.properties` and `create_k8s_secrets.sh`
3228

3329
The '-target' parameter is referring to a file on the file system '$WLSDEPLOY_HOME/lib/target/<target value>/target.json'
3430

35-
It has the format
31+
You also can configure a target in a [Custom Configuration](config/custom_configuration.md) directory, in `$WDT_CUSTOM_CONFIG/target/<target name>/target.json`.
3632

33+
It has the format:
3734
```
3835
{
3936
"model_filters" : {
@@ -47,19 +44,21 @@ It has the format
4744
}
4845
```
4946

50-
The json file has several attributes that can be customized
47+
The JSON file has several attributes that can be customized
5148

5249
| Name | Description |
5350
| --- | --- |
54-
| model_filters | Specify the filters json configuration for the target configuration. This follows the same schema of [Model Filters](tool_filters.md). Note only discover is valid |
55-
| variable_injectors | Specify the variable injector json configuration for the target configuration. This follows the same schema of [Model Filters](tool_filters.md)|
51+
| model_filters | Specify the filters JSON configuration for the target configuration. This follows the same schema of [Model Filters](tool_filters.md). Note only discover is valid |
52+
| variable_injectors | Specify the variable injector JSON configuration for the target configuration. This follows the same schema of [Model Filters](tool_filters.md)|
5653
| validation method | lax only |
5754
| credentials_method | "secrets" or "config_override_secrets" |
5855

5956
`"@@TARGET_CONFIG_DIR@@` resolves to the '$WDT_INSTALL/lib/target/<target value>' directory.
6057

61-
If there is a need to customize your own filers or injectors, you can
58+
If there is a need to customize your own filters or injectors, you can
6259

6360
1. ```mkdir $WDT_INSTALL/lib/target/mytarget```
64-
2. Create a file named target.json follow the schema above in $WLSDEPLOY_HOME/lib/target/mytarget
61+
2. Create a file named `target.json` following the schema above in $WLSDEPLOY_HOME/lib/target/mytarget
6562
3. Run the prepareModel command using the parameter -target mytarget
63+
64+
Another option is to configure a new target in a [Custom Configuration](config/custom_configuration.md) directory. Create the `target/<target name>/target.json` file in the `$WDT_CUSTOM_CONFIG` directory.

site/tool_filters.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def filter_model(model):
1919

2020
Model filters are configured by creating a `model_filters.json` file in the `WLSDEPLOY_HOME/lib` directory. This file has separate sections for filters to be applied for specific tools.
2121

22+
Another option is to configure model filters in a [Custom Configuration](config/custom_configuration.md) directory. Create the `model_filters.json` file in the `$WDT_CUSTOM_CONFIG` directory.
23+
2224
This example configures two filters for the Create Domain Tool: `fix-password.py` and `no-mail.py`, and one filter for the Discover Domain tool.
2325

2426
```json

site/type_def.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@ WebLogic Server Deploy Tooling has an extensible domain type system. The three
7676
}
7777
```
7878

79-
This file tells the Create Domain Tool which templates to use to create the domain, which server groups to target, and even which RCU schemas to create, all based on the installed version of WebLogic Server. New domain types can be defined by creating a new JSON file with the same structure in the `WLSDEPLOY_HOME/lib/typedefs` directory. For example, to define a `SOA` domain type for 12.2.1.3, add the `WLSDEPLOY_HOME/lib/typedefs/SOA.json` file with with similar content, as shown below.
79+
This file tells the Create Domain Tool which templates to use to create the domain, which server groups to target, and even which RCU schemas to create, all based on the installed version of WebLogic Server.
80+
81+
New domain types can be defined by creating a new JSON file with the same structure in the `WLSDEPLOY_HOME/lib/typedefs` directory.
82+
83+
Another option is to create this file in the [Custom Configuration](config/custom_configuration.md) directory `$WDT_CUSTOM_CONFIG/typedefs`.
84+
85+
For example, to define a `SOA` domain type for 12.2.1.3, add the `typedefs/SOA.json` file with similar content, as shown below.
8086

8187
```json
8288
{

site/variable_injection.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
The Variable Injector Tool is used to tokenize a model with variables. The values for these variables are assigned using an external property file. This facilitates using the same domain model to create new domains in different environments. The Variable Injector Tool can be run as an option in the Discover Domain Tool, or from the standalone command-line interface.
44

5-
To enable the Variable Injector Tool during the Discover Domain Tool run, create a variable injector configuration by placing a JSON file named `model_variable_injector.json` into the `\<WLSDEPLOY\>/lib` directory using one or more of the pre-defined keywords and/or a CUSTOM list of files. A keyword points to an injector directive file. The tool applies the directives to the attributes in a model, and if the directive matches an attribute, then a property token with a unique variable name is injected into the model and replaces the attribute value. The variable name and model attribute value are placed into the external variable properties file.
5+
To enable the Variable Injector Tool during the Discover Domain Tool run, create a variable injector configuration by placing a JSON file named `model_variable_injector.json` into the `<WLSDEPLOY>/lib` directory using one or more of the pre-defined keywords and/or a CUSTOM list of files.
6+
7+
Another option is to configure variable injection in a [Custom Configuration](config/custom_configuration.md) directory. Create the `model_variable_injector.json` file in the `$WDT_CUSTOM_CONFIG` directory.
8+
9+
A keyword points to an injector directive file. The tool applies the directives to the attributes in a model, and if the directive matches an attribute, then a property token with a unique variable name is injected into the model and replaces the attribute value. The variable name and model attribute value are placed into the external variable properties file.
610

711
**NOTE**: Variable injection on an attribute is only performed once. The property token is not replaced by any subsequent matches.
812

@@ -23,7 +27,7 @@ The supported keywords are as follows:
2327

2428
- `URL` - All MBean URL attribute values in the model are injected with a variable.
2529

26-
**NOTE**: The directives used by each pre-defined keyword are defined in an injector JSON file that is located in the `\<WLSDEPLOY\>/lib/injectors` folder. These files should not be changed, but could be used as is.
30+
**NOTE**: The directives used by each pre-defined keyword are defined in an injector JSON file that is located in the `<WLSDEPLOY>/lib/injectors` folder. These files should not be changed, but could be used as is.
2731

2832
Here is an example of a `model_variable_injector.json` file using the PORT keyword.
2933

@@ -80,7 +84,7 @@ Server.soa_server2.ListenPort=8001
8084
Server.soa_server2.SSL.ListenPort=8002
8185
```
8286

83-
To specify the name and location of the variable properties file for the Discover Domain Tool, use the argument `-variable_properties_file` on the command line. Usage of the `variable_properties_file` argument without the presence of the model variable injector file in the `\<WLSDEPLOY\>/lib` directory will cause an error condition and the tool will exit. If the model variable injector file exists in the directory, but the command-line argument is not used, the variable properties file is created with the following defaults:
87+
To specify the name and location of the variable properties file for the Discover Domain Tool, use the argument `-variable_properties_file` on the command line. Usage of the `variable_properties_file` argument without the presence of the model variable injector file in the `<WLSDEPLOY>/lib` directory will cause an error condition and the tool will exit. If the model variable injector file exists in the directory, but the command-line argument is not used, the variable properties file is created with the following defaults:
8488
* If the `model_file` command-line argument is used on the Discover Domain Tool run, the properties file name and location will be the same as the model file, with the file extension `.properties`.
8589
* If only the archive file argument is present, the archive file name and location will be used.
8690

0 commit comments

Comments
 (0)