= devonfw templates This are the devonfw templates to build devonfw apps for Openshift using the s2i images. They are based on the work of Mickuehl in Oasp templates/mythaistar for deploy My Thai Star. - Inside the `example-mythaistar` we have an example to deploy My Thai Star application using devonfw templates. All this information is used as a part of the link:dsf-okd-initial-setup[initial setup] for openshift. == How to use === Previous requirements ==== Deploy the Source-2-Image builder images Remember that this templates need a build image from s2i-devonfw-angular and s2i-devonfw-java. More information: * link:dsf-okd-s2i#deploy-the-source-2-image-builder-images[Deploy the Source-2-Image builder images]. ==== Customize Openshift Remember that this templates also have custom icons, and to use it, we must modify the master-config.yml inside openshift. More information: * link:dsf-okd-customize[Customize Openshift]. === Deploy devonfw templates Now, it's time to create devonfw templates to use this s2i and add it to the browse catalog. To let all user to use these templates in all openshift projects, we should create it in an openshift namespace. To do that, we must log in as an admin. [source,Shell] ---- oc create -f https://raw.githubusercontent.com/devonfw/devonfw-shop-floor/master/dsf4openshift/openshift-devonfw-deployment/templates/devonfw-java-template.json --namespace=openshift oc create -f https://raw.githubusercontent.com/devonfw/devonfw-shop-floor/master/dsf4openshift/openshift-devonfw-deployment/templates/devonfw-angular-template.json --namespace=openshift ---- When it finishes, remember to logout as an admin and enter with our normal user. [source,Shell] ---- $ oc login ---- === How to use devonfw templates in openshift To use these templates with openshift, we can override any parameter values defined in the file by adding the --param-file=paramfile option. This file must be a list of = pairs. A parameter reference may appear in any text field inside the template items. *The parameters that we must override are the following* [source,Shell] ---- $ cat paramfile APPLICATION_NAME=app-Name APPLICATION_GROUP_NAME=group-Name GIT_URI=Git uri GIT_REF=master CONTEXT_DIR=/context ---- *The following parameters are optional* [source,Shell] ---- $ cat paramfile APPLICATION_HOSTNAME=Custom hostname for service routes. Leave blank for default hostname, e.g.: .., # Only for angular REST_ENDPOINT_URL=The URL of the backend's REST API endpoint. This can be declared after, REST_ENDPOINT_PATTERN=The pattern URL of the backend's REST API endpoint that must be modify by the REST_ENDPOINT_URL variable, ---- *For example, to deploy My Thai Star Java* [source,Shell] ---- $ cat paramfile APPLICATION_NAME="mythaistar-java" APPLICATION_GROUP_NAME="My-Thai-Star" GIT_URI="https://github.com/devonfw/my-thai-star.git" GIT_REF="develop" CONTEXT_DIR="/java/mtsj" $ oc new-app --template=devonfw-java --namespace=mythaistar --param-file=paramfile ----