OpenShift app - cannot see logs using rhc as admin collaborator - openshift

I am a collaborator on an OpenShift Online app with administrator privileges, and when I do rhc apps I can see the application, but when I do rhc tail <appname> I get Application '<appname>' not found.
Is there something I am missing?
Using rhc on Ubuntu Server 12.04.

"rhc apps" shows me the app that I am authorized to administer as a collaborator, however "rhc app stop" says - "app not found"
rhc -a app stop gave me the usage help - rhc app-stop <app> [--namespace NAME]
which hinted that a namespace might be necessary for stopping an app in another domain where I am a collaborator
and rhc app-stop testappname --namespace domainname worked!

Try appending your rhc commands with the -l option to specify a login.

Related

Run docker container on OpenShift from Nexus unsecure private registry

I'm trying to run a containerized app which is stored in Nexus docker hosted on url 12.23.34.55:8086
I'm trying to run it on my Openshift Cluster, but I'm getting error. Commands I'm using to run
oc create secret docker-registry mysecret --docker-server=http://12.23.34.55/ --docker-username=aditya --docker-password=aditya --docker-email=aditya#example.org
oc secrets link default mysecret --for=pull
My nexus is running on http://12.23.34.55:8081
Now I'm using command to launch in OpenShift using below command.
oc new-app 12.23.34.55:8085/mytestapp:11 --insecure-registry=true
as per $ oc new-app myregistry:5000/example/myimage
https://docs.openshift.com/container-platform/4.1/applications/application_life_cycle_management/creating-new-applications.html
But it does not work, it asks for password and not able to deploy from console too, can anyone help me with exact commmand.
Creating the secret is not enough for OpenShift to be able to pull from the registry. You still need to link that secret as well.
Take a look at the official documentation here:
https://docs.openshift.com/container-platform/4.1/openshift_images/managing_images/using-image-pull-secrets.html#images-allow-pods-to-reference-images-from-secure-registries_using-image-pull-secrets
Okay! I found an answer, so using private registry first we should import image using
oc import name url/imagename:tag
then we can create new app with the same
oc new app name

How to open a Web Console for open shift?

guys I am using OpenShift to conatinerize and run application on kubernetes, I have started the open shift cluster using oc cluster up now how do I open in the web console.
For the mini shift I have user minishift start and then minishift console it's not working the same with oc cluster up
Running oc whoami --show-console returns the link to the console app.
You can obtain the console URL in OpenShift Container Platform 4 as follows:
$ oc get routes -n openshift-console
Thanks, oc login helped me to get the web console url

Changing Haproxy configuration on openshift

I have a scalable Python 2.7 app on OpenShift and I'm getting this 503 error.
I checked some answers that might work but they say to rhc into the app and change the Haproxy configurations, but I don't have a clue on how to do it.
Can someone help me please?
1) Install rhc: https://developers.openshift.com/en/managing-client-tools.html and read https://blog.openshift.com/how-haproxy-scales-openshift-apps/
2) Run $ rhc setup for the initial configuration of the tool and check https://developers.openshift.com/en/managing-log-files.html#accessing-logs-via-ssh for viewing haproxy logs
3) Run rhc ssh --app yourapp, once inside, cd haproxy/conf and change your haproxy.cfg appropriately
I edited haproxy.cfg:
option httpchk OPTIONS * HTTP/1.1\r\nHost:\ {{ my app link }}
It’s working now.

How to use ant to compile and deploy my webapp in openshift server?

I don't have ant in my server. When I do rhc ssh myapp and tried to use ant, it shows "bash: ant: command not found". But I find jars related to ant in my folder "jbossews/lib/catalina-ant.jar".
I tried to install ant by sudo apt-get install ant, but it shows "bash: /usr/bin/sudo: Permission denied"
so I dont know what to do.
Ant functionality is not available on OpenShift at this time. I'm working on clearing up some conflicting articles on our side. Also, root access (sudo) isn't available to users in their gears.
Just use the commands below:
wget https://www.apache.org/dist/ant/binaries/apache-ant-1.9.4-bin.zip
unzip apache-ant-1.9.4-bin.zip

Alternative ways to deploy code to Openshift

I am trying to setup Travis CI to deploy my repository to Openshift on a successful build. Is there a way to deploy a repository besides using Git?
Git is the official mechanism for how your code is update, however depending on the type of application that you are deploying you may not need to deploy your entire code base.
For example Java application (war, ear, etc) can be deployed to JBoss or Tomcat servers, by simply taking the built application and checking it into the OpenShift git repositories, webapps or deploy directories.
An alternative to this (and it will be unsupported), is to scp your application to the gear using the SSH key. However any time the application is moved or updated (with git) this content stands a good chance of getting deleted(cleaned), by the gear.
We're working on direct binary deploys ("push") and "pull" style deploys (Openshift downloads a binary for you. The design/process is described here:
https://github.com/openshift/openshift-pep/blob/master/openshift-pep-006-deploy.md
You can do a SCP to the app-root/dependencies/jbossews/webapps directory direcly. I was able to do that successfully and have the app working. Here is the link
Here is the code which I had in the after_success blck
after_success:
- sudo apt-get -y install sshpass
- openssl aes-256-cbc -K $encrypted_8544f7cb7a3c_key -iv $encrypted_8544f7cb7a3c_iv
-in id_rsa.enc -out ~/id_rsa_dpl -d
- chmod 600 ~/id_rsa_dpl
- sshpass scp -i ~/id_rsa_dpl webapps/ROOT.war $DEPLOY_HOST:$DEPLOY_PATH
Hope this helps