how to upgrade java app to Openshift v3

566 views Asked by At

I'm trying to migrate a java app that runs on Wildfly from Openshift Online v2 to Openshift Online v3 and having difficulties. I go through the steps here

https://docs.openshift.com/online/dev_guide/migrating_applications/web_framework_applications.html#dev-guide-migrating-web-framework-applications-jboss-as

and get to

"4. Use the the oc command to launch a new Wildfly application from the builder image and source code:

$ oc new-app https://github.com/<github-id>/<repo-name>.git
 --image-stream=”openshift/wildfly:10.0" --name=<app-name> -e
 <ENV_VAR_NAME>=<env_var_value>"

I get the error "error: No language matched the source repository"

1) How does Openshift even know what my account is?

2) Why doesn't it know what to do with my .war files?

I tried adding a Wildfly cartridge to my account, thinking whether I understand how or not, somehow the oc command knows which account is mine, and I need a Wildfly cartridge before it can recognize a .war file.

I get to the part where it asks me for my Git repository URL and it gives me the message:

" Please enter a valid name.

A valid name is applied to all generated resources. It is an alphanumeric (a-z, and 0-9) string with a maximum length of 24 characters, where the first character is a letter (a-z), and the '-' character is allowed anywhere except the first or last character."

How is that possible? "https://github.com//.git" is already 24 characters; "https://github.com/github-id/repo-name.git" is going to be too long no matter what my github id is or my repository name is.

2

There are 2 answers

9
Will Gordon On

So, working through each of your issues here

  1. The migration guides assume that you have already logged in to oc and created your projects. If you haven't, you can do so as follows

    oc login api.starter-<region>.openshift.com

    oc new-project <project-name>

    Where matches the URL for the cluster that you've signed up for, and can be any name that hasn't already been taken on that cluster (I've found it's usually easiest to my username, as it's rarely already taken). By logging in and creating your project (if you already have 1 project, then the oc login will use that project by default and you can skip oc new-project), this is how OpenShift will know what account to use.

  2. oc new-app uses some key files in your git repo to determine what language to deploy, you can find this list of files used for language detection in the documentation. So for your application, you need to be sure to include a pom.xml file. You can find an example of a git repository for Wildfly here. That should help you in deploying your application.

  3. When using --name, you need to actually specify an application name, instead of using the default provided <app-name>. The command is complaining that < and > are not valid characters to use, and is not referring to your git repo URL being too long.

0
iheitsch On

so to partially answer my question,

    oc new-app https://github.com/<github-id>/<repo-name>.git
    --image-stream=”openshift/wildfly:10.0"

should not have quotes around openshift/wildfly:10.0

I tried this, and skipped the --name option and it completed without any error message. That said, it produces nothing that displays as a webpage.

Back to trying to deploy from openshift's webpage:

the error I was getting: " Please enter a valid name.

A valid name is applied to all generated resources. It is an alphanumeric (a-z, and 0-9) string with a maximum length of 24 characters, where the first character is a letter (a-z), and the '-' character is allowed anywhere except the first or last character."

was referring to the first box I filled out, not the github url. I don't recall what I put there, but I probably had an uppercase letter that was causing the error.

It took a long time to build an deploy and it looked like it had finished when it had not, but eventually I was able to click on the url for my website and it displayed my index page. I'm now having issues adding anything beyond the index page