2

I am working on an 8.1 Java project, and the microservices are using the config variable replacement (read from env.sh)

SDL_BASE_DIR="/home/sdl-preview"
SDL_DATA_DIR="/home/sdl-preview/sdl_web"
SDL_FS_STORAGE_DIR="/home/sdl-preview/sdl_web/temp"
SDL_FS_DATA_STORAGE_DIR="/home/sdl-preview/sdl_web/temp/data"
SDL_DEPLOYER_INCOMING="/home/sdl-preview/sdl_web/incoming

etc....

First of all, can I add custom variables? I can't find much documentation on this.

The second issue lies with SI4T. The configuration object that is passed into the Indexer isn't transformed and contains all the ${SDL_BROKER_DB_SERVER} type string replacement values.

Has anyone got SI4T working with the "Centralized configuration for microservices" (config variable replacemet)

3 Answers 3

1

There are three ways to specify these:

  1. As a system environment variable
  2. Defining them in the Java Virtual Machine options
  3. Defining them on the command prompt.

For example, if you have the following in your cd_storage_conf.xml file:

${solrpath:-http://localhost:8080/solr/live_solr_core/}

Then you could pass this in as a parameter to the startup script:

./start.sh -solrpath=http://localhost:8080/solr/staging_solr_core/

or

./start.ps1 -solrpath=http://localhost:8080/solr/staging_solr_core/

If you don't specify it then the default is used (http://localhost:8080/solr/live_solr_core/).

Or you could also specify solrpath as an Environment Variable.

For reference, there are some pages in the online docs on this that may help further:

Storage Layer configuration parameters

About parameters in the Ambient Data Framework configuration


Update: My suspicions about being able to add your own custom variables is also backed up by the following statement on the SDL Web 8.1.1 – Optimizations article on the SDL Community site:

You can now use parameters in the storage configuration file, for items such as database names, servers or passwords (and anything else you want). These properties can be then set either in environment variables or as parameters when the service is initiated.

2
  • I think that the custom variables are fine, but SI4T seems to be reading the raw file, not the "compiled" file.
    – Andy Blyth
    Commented Jun 20, 2017 at 8:14
  • Thanks Andy. Hopefully my answer helps with the "First of all, can I add custom variables? I can't find much documentation on this." question for anyone who comes across this. I understand your problem with SI4T reading the non-compiled version now. Maybe someone from the SDL Cloud team or the SI4T team can help with this part. Commented Jun 20, 2017 at 8:23
1

Quick warning, as you are mentioning env.sh. If env.sh is used as a variable file (using the EnvironmentFile directive) in a systemd service configuration file you cannot use expressions in env.sh, only simple assignments.

So VARNAME="value" works, but VARNAME="${OTHERVAR}/value" does not work. You can only have simple assignments, which are then added to the environment by systemd.

1
  • Thanks, I have only used simple assignments, do you know if it works with SI4T? That is the main issue I am having.
    – Andy Blyth
    Commented Jun 20, 2017 at 11:16
0

SI4T unfortunately makes use of the legacy Configuration mechanism in order to stay backwards compatible with Tridion 2013 / 2011, which means environment properties are indeed not parsed. An enhancement issue is raised here: https://github.com/SI4T/SI4T/issues/15.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.