[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Using Environment Variables within context.xml - Tomcat 8 Source 2 Image



Oh, can you also provide your directory structure and the commands you're using to build your app image?

If you're using a template DC, and you have specified
- name: "MAPPING_JNDI"
  value: ${MAPPING_JNDI}
in the `env` section, then, those environment variables are not coming from your properties file (at least initially).  They're coming from what you specify in your `oc process ... | oc apply ...` step [0][1].


[0] https://docs.openshift.com/container-platform/3.7/dev_guide/templates.html#generating-a-list-of-objects
[1] https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html-single/red_hat_jboss_web_server_for_openshift/index#using_the_jws_for_openshift_image_source_to_image_s2i_process



___________________________________________________

LOUIS P. SANTILLAN

Architect, OPENSHIFT, MIDDLEWARE & DEVOPS

Red Hat Consulting, Container and PaaS Practice

lsantill redhat com   M: 3236334854    




On Thu, Jan 18, 2018 at 9:32 PM, Louis Santillan <lsantill redhat com> wrote:
Which base image are you using?

___________________________________________________

LOUIS P. SANTILLAN

Architect, OPENSHIFT, MIDDLEWARE & DEVOPS

Red Hat Consulting, Container and PaaS Practice

lsantill redhat com   M: 3236334854    




On Thu, Jan 18, 2018 at 12:41 AM, David Gibson <dgibson9999 yahoo co uk> wrote:
Louis,

Thanks for the response, I have tried prefixing the variables with env. but it had the same result. Also checked to make sure the pod had picked up the correct environment variable and all variables had been set as expected.

David


On Thursday, 18 January 2018, 02:22:24 GMT, Louis Santillan <lsantill redhat com> wrote:


David,

Try adding `env.` to your variables (e.g. `${env.MAPPING_JNDI}`) [0].  You can also verify that the vars are set the way you expect using `oc rsh ...` or `oc debug ...` (in the case of a failed pod).


___________________________________________________

LOUIS P. SANTILLAN

Architect, OPENSHIFT, MIDDLEWARE & DEVOPS

Red Hat Consulting, Container and PaaS Practice

lsantill redhat com   M: 3236334854    




On Wed, Jan 17, 2018 at 2:23 AM, David Gibson <dgibson9999 yahoo co uk> wrote:
Hello,

I was wondering if it is possible to achieve the following:

We have created a Geoserver web app using the Tomcat 8 source to image file, however we require this app to connect to 3 external databases to retrieve the spatial data.

To build our application we are using the Jenkins S2I and have created a build pipeline that will build, deploy and promote the application through various stages eg dev, test, prod.

Using the Tomcat Source 2 Image the app has been created and the war file gets deployed along with the context.xml file specific for the application, which if we hardcode all the values in the context.xml file this will work for an individual environment.

I have read that it was possible in OS version 2 to substitute the values in the context.xml file with environment variable within OS however this does not seem to work.

What we have is

context xml

<Resource name="${MAPPING_JNDI}"
                     url = "">

etc.

<Resource name = "${OSMAP_JNDI}"
                     url = "">

In the deploy template we have these values configured as environment variable as such

- name: "MAPPING_JNDI"
  value: ${MAPPING_JNDI}

where the values are read in from a properties file.

If I use the terminal to inspect the pod I can see that the environment variable are all set correctly, however the JNDI lookup fails as the values have not been substituted. Is it possible to do this.

Thanks,

David


______________________________ _________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat. com/openshiftmm/listinfo/users





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]