Search code examples
tomcatmigrationopenshiftredhat

OpenShift Migration - What To Do About .openshift Folder?


There are many companies/people migrating their OpenShift v2 applications to OpenShift Pro due to the imminent sunset of OpenShift 2.

The OpenShift v2 folder .openshift no longer features in OpenShift Pro and RedHat's migration documentation actually states it should be removed.

But what if you have actually used a feature exposed by .openshift such as Tomcat settings? For example tomcat-users.xml or server.xml.

I, myself have used server.xml to specify an addition docBase.

<Context docBase="${OPENSHIFT_DATA_DIR}/documents" path="/documents" />

What am I to do?

How is this achieved in OpenShift Pro?

Is it no longer possible to do?

Is it frowned upon?

Now we are paying customers, perhaps someone at RedHat (or elsewhere) could enlighten us...


Solution

  • The document has the answer (not tried):

    1. All WAR files from the deployments source repository directory are copied to /opt/webserver/webapps.

    2. All files in the configuration source repository directory are copied to /opt/webserver/conf.

    If you want to use custom Tomcat configuration files, the file names should be the same as for a normal Tomcat installation. For example, context.xml and server.xml.

    Try logging to pod shell via oc rhc <pod_id> and explore /opt/webserver/conf area.

    EDIT 1 -

    With each deployment, the server is rebuilt and changes to server.xml would be lost. So, all the config files should be part of the repo from which the image is created.

    If you are using maven build and would like a cutom deployment of config file like server.xml, check this article

    Sample POM given here.

    EDIT 2

    Another simpler approach suggested by @Lyndon in the comments

    All you need to do is create a folder called configuration under the top level git folder. Any file you put in there will get copied to: /opt/webserver/conf. It really is that simple.