I added a new openshift application. I followed the instructions and uploaded my code via git push.
The upload logs seem to be fine:
1)the ROOT.war got created:
remote: [INFO] Packaging webapp
remote: [INFO] Assembling webapp [opinion] in [/var/lib/openshift/542ee542e0b8cd
2ca700037d/app-root/runtime/repo/target/opinion]
remote: [INFO] Processing war project
remote: [INFO] Copying webapp resources [/var/lib/openshift/542ee542e0b8cd2ca700
037d/app-root/runtime/repo/src/main/webapp]
remote: [INFO] Webapp assembled in [108 msecs]
remote: [INFO] Building war: /var/lib/openshift/542ee542e0b8cd2ca700037d/app-roo
t/runtime/repo/webapps/ROOT.war
remote: [INFO] WEB-INF/web.xml already added, skipping
remote: [INFO] -----------------------------------------------------------------
-------
remote: [INFO] BUILD SUCCESS
remote: [INFO] -----------------------------------------------------------------
-------
remote: [INFO] Total time: 1:24.196s
remote: [INFO] Finished at: Fri Oct 03 14:11:18 EDT 2014
remote: [INFO] Final Memory: 9M/91M
remote: [INFO] -----------------------------------------------------------------
2) Deployment was a success
remote: + rm -rf /var/lib/openshift/542ee542e0b8cd2ca700037d/jbossews//work/
remote: ++ ls /var/lib/openshift/542ee542e0b8cd2ca700037d/app-root/runtime/repo/
/webapps
remote: + '[' 'META-INF
remote: ROOT.war
remote: WEB-INF
remote: css
remote: fonts
remote: img
remote: js' ']'
remote: + rsync -rS --delete /var/lib/openshift/542ee542e0b8cd2ca700037d/app-roo
t/runtime/repo//webapps/ /var/lib/openshift/542ee542e0b8cd2ca700037d/jbossews//w
ebapps/
remote: + hot_deploy_enabled_for_latest_deployment
remote: ++ ruby_sdk latest_deployment_metadata.hot_deploy
remote: ++ oo-ruby -I/usr/lib/openshift/cartridge_sdk -rruby/sdk -e 'include Ope
nShift::CartridgeSdk; puts latest_deployment_metadata.hot_deploy'
remote: + enabled=false
remote: + '[' false == true ']'
remote: + return 1
remote: Starting jbossews cartridge
remote: Found 127.4.212.129:8080 listening port
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://542ee542e0b8cd2ca700037d#opinion-expertviews.rhcloud.com/~/git/opinion.
git/
e2a907c..08d3a44 master -> master
However, when I hit the url(http://opinion-expertviews.rhcloud.com) I am still seeing the
"Welcome to your JBossEWS (Apache/Tomcat) application on OpenShift" screen
What am I missing?
Solved:
I was uploading my files incorrectly. Corrected way:
I compiled my projects into a war file, put it into the webapps
folder at root of the openshift git directory.
removed the pom.xml
file pushed the updated folder to my application
Application now available at:
http://app_name-namespace.rhcloud.com/app_name.
Thanks a lot for your help and guiding me, although it was stupid of me to miss these points
Since you are deploying your war file with a name other than ROOT.war, you will need to visit your application at the context that is the same as the name of the war file you deployed. For example, if your war file was named myapplication.war, your url would be http://app-domain.rhcloud.com/myapplication, to fix this, you can rename your war file ROOT.war, and your application would be available at http://app-domain.rhcloud.com/
Related
Pushing changes to a remote mercurial repo is reporting an error in my changegroup.notify hook. It worked with an old 2.7 release of mercurial, but is broken now.
My server has
Python 3.9, hg --version is
Mercurial Distributed SCM (version 6.3.1)
The relevant repo's hgrc has
changegroup.notify = python:hgext.notify.hook
The hook reports an exception:
>: hg --traceback push
pushing to https://[redacted]
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
remote: error: changegroup.notify hook raised an exception: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
remote: (run with --traceback for stack trace)
Why the exception, when I am using what is supposed to just work
out of the box?
Update: Re-ran the test pushing from an account on the same machine as the server (thanks #LazyBadger), got the following traceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/mercurial/hook.py", line 116, in pythonhook
r = obj(ui=ui, repo=repo, hooktype=htype, **pycompat.strkwargs(args))
File "/usr/local/lib/python3.9/dist-packages/hgext/notify.py", line 589, in hook
n = notifier(ui, repo, hooktype)
File "/usr/local/lib/python3.9/dist-packages/hgext/notify.py", line 326, in __init__
self.stripcount = int(self.ui.config(b'notify', b'strip'))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
Solution:
Turns out this is the error you get if you haven't updated your hgrc in years. Used to be that adding the hook to your [.]hgrc was all that was required. Now you have to enable notify as well, so, e.g.
[extensions]
notify=
[hooks]
changegroup.notify = python:hgext.notify.hook
You also need some things to allow the email notication to work, for example if you have personal email support on the same server:
[reposubs]
* = [my email on the server]
[email]
from = Mercurial Notification <noreply#mydomain>
[smtp]
host = localhost
With Docker I need only provide DOCKER_HOST and appropriate credentials in order for the fabric8 plugin to be able to build my container image. As long as a Docker Registry is available - there is no need to install Docker-related infrastructure on the actual host which does the image build (e.g. my Bamboo agent).
With OpenShift I cannot seem to find a way to do this. It seems instead that I must run the maven goals on a host on which OpenShift has been installed, which must necessarily be a RedHat Linux host.
This seems far more complicated than it should be. Am I missing something here?
Is there a way to reference a remote OpenShift environment from the fabric8-maven-plugin when in openshift mode?
Thanks, Robin.
I'm from Fabric8 team. You don't need to run goals from host on which OpenShift has been install. Plugin reads your ~/.kube/config for information related to your OpenShift cluster and uses your API token in order to interact with OpenShift REST API.
Fabric8 Maven Plugin has been migrated to Eclipse JKube. Although Fabric8 Maven Plugin also works just fine with remote OpenShift Clusters. It's the same Fabric8 Maven Plugin but with a different name and targeted OpenShift Plugin. I would give this answer with Eclipse JKube's OpenShift Maven Plugin. You can have it in your pom.xml like this:
<dependency>
<groupId>org.eclipse.jkube</groupId>
<artifactId>openshift-maven-plugin</artifactId>
<version>1.0.0</version>
<type>maven-plugin</type>
</dependency>
Here is a demo using a simple Random generator application: https://github.com/rohanKanojia/eclipse-jkube-demo-project
Log into your OpenShift Cluster with credentials provided:
~ : $ oc login https://your-cluster.openshift.com--token=your-token
Logged into "https://your-cluster.openshift.com:443" as "rohanKanojia" using the token provided.
You have one project on this server: "rokumar"
Using project "rokumar".
Go to your project and Issue OpenShift Maven Plugin goals:
eclipse-jkube-demo-project : $ mvn package oc:build oc:resource oc:apply
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< meetup:random-generator >-----------------------
[INFO] Building random-generator 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # random-generator ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # random-generator ---
...
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) # random-generator ---
[INFO] Building jar: /home/rohaan/work/repos/eclipse-jkube-demo-project/target/random-generator-0.0.1.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.3.3.RELEASE:repackage (repackage) # random-generator ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] --- openshift-maven-plugin:1.0.1-SNAPSHOT:build (default-cli) # random-generator ---
[INFO] oc: Using OpenShift build with strategy S2I
[INFO] oc: Running in OpenShift mode
[INFO] oc: Running generator spring-boot
[INFO] oc: spring-boot: Using Docker image quay.io/jkube/jkube-java-binary-s2i:0.0.8 as base / builder
[INFO] oc: [random-generator:0.0.1] "spring-boot": Created docker source tar /home/rohaan/work/repos/eclipse-jkube-demo-project/target/docker/random-generator/0.0.1/tmp/docker-build.tar
[INFO] oc: Adding to Secret pullsecret-jkube
[INFO] oc: Using Secret pullsecret-jkube
[INFO] oc: Creating BuildServiceConfig random-generator-s2i for Source build
[INFO] oc: Adding to ImageStream random-generator
[INFO] oc: Starting Build random-generator-s2i
[INFO] oc: Waiting for build random-generator-s2i-1 to complete...
[INFO] oc: Using quay.io/jkube/jkube-java-binary-s2i:0.0.8 as the s2i builder image
[INFO] oc: INFO S2I source build with plain binaries detected
[INFO] oc: INFO S2I binary build from fabric8-maven-plugin detected
[INFO] oc: INFO Copying binaries from /tmp/src/deployments to /deployments ...
[INFO] oc: random-generator-0.0.1.jar
[INFO] oc: INFO Copying deployments from deployments to /deployments...
[INFO] oc: '/tmp/src/deployments/random-generator-0.0.1.jar' -> '/deployments/random-generator-0.0.1.jar'
[INFO] oc: INFO Cleaning up source directory (/tmp/src)
[INFO] oc:
[INFO] oc: Pushing image 172.30.39.149:5000/rokumar/random-generator:0.0.1 ...
[INFO] oc: Pushed 0/4 layers, 19% complete
[INFO] oc: Pushed 1/4 layers, 25% complete
[INFO] oc: Push successful
[INFO] oc: Build random-generator-s2i-1 in status Complete
[INFO] oc: Found tag on ImageStream random-generator tag: sha256:51756e1ff9b639c939f3c0c9246ab4ed924faa269bc9cbf05035c859d19fa50c
[INFO] oc: ImageStream random-generator written to /home/rohaan/work/repos/eclipse-jkube-demo-project/target/random-generator-is.yml
[INFO]
[INFO] --- openshift-maven-plugin:1.0.1-SNAPSHOT:resource (default-cli) # random-generator ---
[INFO] oc: Using docker image name of namespace: rokumar
[INFO] oc: Running generator spring-boot
[INFO] oc: spring-boot: Using Docker image quay.io/jkube/jkube-java-binary-s2i:0.0.8 as base / builder
[INFO] oc: jkube-controller: Adding a default DeploymentConfig
[INFO] oc: jkube-service: Adding a default service 'random-generator' with ports [8080]
[INFO] oc: jkube-healthcheck-spring-boot: Adding readiness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 10 seconds
[INFO] oc: jkube-healthcheck-spring-boot: Adding liveness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 180 seconds
[INFO] oc: jkube-revision-history: Adding revision history limit to 2
[INFO] oc: validating /home/rohaan/work/repos/eclipse-jkube-demo-project/target/classes/META-INF/jkube/openshift/random-generator-service.yml resource
[INFO] oc: validating /home/rohaan/work/repos/eclipse-jkube-demo-project/target/classes/META-INF/jkube/openshift/random-generator-route.yml resource
[INFO] oc: validating /home/rohaan/work/repos/eclipse-jkube-demo-project/target/classes/META-INF/jkube/openshift/random-generator-deploymentconfig.yml resource
[INFO]
[INFO] --- openshift-maven-plugin:1.0.1-SNAPSHOT:apply (default-cli) # random-generator ---
[INFO] oc: Using OpenShift at https://api.rh-idev.openshift.com:443/ in namespace rokumar with manifest /home/rohaan/work/repos/eclipse-jkube-demo-project/target/classes/META-INF/jkube/openshift.yml
[INFO] oc: OpenShift platform detected
[INFO] oc: Using project: rokumar
[INFO] oc: Creating a Service from openshift.yml namespace rokumar name random-generator
[INFO] oc: Created Service: target/jkube/applyJson/rokumar/service-random-generator.json
[INFO] oc: Creating a DeploymentConfig from openshift.yml namespace rokumar name random-generator
[INFO] oc: Created DeploymentConfig: target/jkube/applyJson/rokumar/deploymentconfig-random-generator.json
[INFO] oc: Creating Route rokumar:random-generator host: null
[INFO] oc: HINT: Use the command `oc get pods -w` to watch your pods start up
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:02 min
[INFO] Finished at: 2020-09-29T10:57:34+05:30
[INFO] ------------------------------------------------------------------------
Access your application deployed into OpenShift
eclipse-jkube-demo-project : $ oc get routes
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
random-generator random-generator-rokumar.b6ff.rh-idev.openshiftapps.com random-generator 8080 None
weather-web-application weather-web-application-rokumar.b6ff.rh-idev.openshiftapps.com weather-web-application 8080 None
eclipse-jkube-demo-project : $ curl random-generator-rokumar.b6ff.rh-idev.openshiftapps.com/random | jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 45 0 45 0 0 56 0 --:--:-- --:--:-- --:--:-- 56
{
"id": "d79ca3fd-4505-43d1-9920-a39ac15a3b49"
}
For more information, you can checkout Eclipse JKube Quickstarts
I am finding it difficult to deploy the Express4 app on Openshift.
The project is working fine on localhost but not being able to push on server
remote: Git Post-Receive Result: failure
remote: Activation status: failure
remote: Activation failed for the following gears:
remote: 55d6d1367628e11bda000128 (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/nodejs
remote: #<IO:0x000000017462a0>
remote: #<IO:0x00000001746228>
remote: )
remote: Deployment completed with status: failure
remote: postreceive failed
The app deployment fails on server.js ....
The express#3 version works fine on server.js(default they provide).
Any help for deploying express#4 version on openshift ???
I am receiving the following error when pushing a J2EE app to my OpenShift Tomcat application:
remote: [INFO] Webapp assembled in [40 msecs]
remote: [INFO] Building war: /var/lib/openshift/54eb9daa5973ca7b9a0000d9/app- root/runtime/repo/webapps/ROOT.war
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] BUILD FAILURE
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] Total time: 4.339s
remote: [INFO] Finished at: Wed Feb 25 14:51:14 EST 2015
remote: [INFO] Final Memory: 8M/112M
remote: [INFO] ------------------------------------------------------------------------
remote: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project dragonfly: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
remote: [ERROR]
remote: [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote: [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote: [ERROR]
remote: [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I have my web.xml in webapp/WEB-INF/web.xml and in .openshift/config/web.xml
I'm also confused about webapp vs. WebContent.
The web.xml file must be placed under src/main/webapp/WEB-INF. The error you are getting is because Maven is not finding web.xml at this location.
Also, I will take a wild guess but I presume WebContent is the folder generated by Eclipse when you create a web-application. If this folder is present, then there is a issue with your Eclipse project configuration. You should follow Maven conventions through out your project (and add the Maven nature to your Eclipse project with the m2e plugin).
After 2+ hours I was able to get the maven-scm-provider-hg extension (for pushing to mercurial repos from Maven) semi working, meaning that it was executing commands instead of just giving errors.
However I think I've run into a wall with this error
[INFO] [deploy:deploy {execution: default-deploy}]
[INFO] Retrieving previous build number from pircbotx.googlecode.com
[INFO] Removing C:\DOCUME~1\Owner\LOCALS~1\Temp\wagon-scm1210107000.checkout\pir cbotx\pircbotx\1.3-SNAPSHOT
[INFO] EXECUTING: cmd.exe /X /C "hg clone -r tip https://*SNIP*#site.pircbotx.googlecode.com/hg/maven2/snapshots/pircbotx/pircbotx/1.3-SNAPSHOT C:\DOCUME~1\Owner\LOCALS~1\Temp\wagon-scm1210107000.checkout\pircbotx\pircbotx\1.3-SNAPSHOT"
[INFO] EXECUTING: cmd.exe /X /C "hg locate"
[INFO] repository metadata for: 'snapshot pircbotx:pircbotx:1.3-SNAPSHOT' could not be found on repository: pircbotx.googlecode.com, so will be created Uploading: scm:hg:https://site.pircbotx.googlecode.com/hg/maven2/snapshots/pircbotx/pircbotx/1.3-SNAPSHOT/pircbotx-1.3-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error deploying artifact: Error listing repository: No such command 'list'.
What on earth would cause that error? I'm on a Windows box, so any commands that aren't commands give "'list' is not recognized as an internal or external command...", not "No such command 'list'."
POM
<build>
<extensions>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-hg</artifactId>
<version>1.4</version>
</extension>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-scm</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
...
<distributionManagement>
<snapshotRepository>
<id>pircbotx.googlecode.com</id>
<name>PircBotX Site</name>
<url>scm:hg:https://site.pircbotx.googlecode.com/hg/maven2/snapshots</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
Mercurial version
W:\programming\pircbot-hg>hg version
Mercurial Distributed SCM (version 1.7.2)
Any suggestions?
Firstly, not sure if deploying the project artifacts to an SCM is a normal practice. maven scm plugin is usually used for source code related operations like checkout/update/tag, etc.
Secondly, the cause of the error seems to be related to the fact that maven scm provider for hg does not support the list command as specified in this scm providers matrix. Not sure why and how mvn deploy uses this command though.