OpenShift: rhc setup receives error 403 - openshift

When first setting up the rhc setup for our openshift enterprise installation, I get the following error:
Connect without checking the certificate? (yes|no): yes
DEBUG: Connecting to https://master.sb.local:8443/broker/rest/api
DEBUG: Client supports API versions 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7
DEBUG: Created new httpclient
DEBUG: Request GET https://master.sb.local:8443/broker/rest/api
DEBUG: SSL Verification failed -- Using self signed cert
DEBUG: code 403 284 ms
You are not authorized to perform this operation.
Any ideas how to solve this? I'm pretty sure it's just a small glitch I'm missing.

Related

GCP deployment fails on "Updating service"

I have asp.net core application hosted on GCP App Engine. When I try to deploy the application it fails on last step:
Updating service [name] (this may take several minutes)... ...failed
ERROR: (gcloud.app.deploy) Error Response: [9] An internal error occurred while processing task /app-engine-flex/flex_await_healthy/flex_await_healthy>blablabla.wm.1
The exception stack trace show that service running in background couldn't find MySQL table (that table obviously exists).
my app.yaml file:
service: XXX
runtime: custom
env: flex
automatic_scaling:
max_concurrent_requests: 80
min_num_instances: 1
max_num_instances: 1
resources:
cpu: XXX
memory_gb: XXX
beta_settings:
cloud_sql_instances: "XXX:XXXX:XXXX=tcp:3306"
It looks like the application is deployed properly despite the error. This is the only error and backgroud service desn't throw any exceptions at later point. In fact it works properly and can connect to the database.
My guess was that maybe GCP is checking health while the application is not connected do database. So I tried to add liveness_check and readiness_check to app.yaml and configured dedicated /healthcheck endpoint in my application but it didn't make any change.
Any ideas how to fix it and what might be a cause?
Deploying app with new version fixed the issue

Connecting to CloudSQL Mysql over ssl from external application

I am trying to get a sample java application to connect to a Mysql gen2 instance I have in GCP. I use SSL and the ip address is whitelisted. I have confirmed connectivity to the instance using the mysql command line and passing in the client-cert.pem, client-key.pem and the server-ca.pem. Now inorder to connect to it from the spring boot java application, I did the following:
created a p12 file from the client cert and key and added it to keystore.jks
created a truststore with the server-ca.pem file.
Added this code in the main before the connection is created:
System.setProperty("javax.net.debug", "all");
System.setProperty("javax.net.ssl.trustStore", TRUST_STORE_PATH);
System.setProperty("javax.net.ssl.trustStorePassword", "fake_password");
System.setProperty("javax.net.ssl.keyStore", KEY_STORE_PATH);
System.setProperty("javax.net.ssl.keyStorePassword", "fake_password");
For the jdbc url, I used : jdbc:mysql://1.1.1.1:3306/sampledb?useSSL=true&requireSSL=true
However I am unable to connect to the instance and see this error from the java ssl debug:
restartedMain, RECV TLSv1.1 ALERT: fatal, unknown_ca
%% Invalidated: [Session-2, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA]
restartedMain, called closeSocket()
restartedMain, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: unknown_ca
restartedMain, called close()
restartedMain, called closeInternal(true)
I also tried to run
openssl verify -CAfile server-ca.pem client-cert.pem`
and got this output:
error 20 at 0 depth lookup:unable to get local issuer certificate`
Any ideas on what I might be doing wrong?

Error creating a custom cartridge application in OpenShift

I'm trying to create a custom cartridge application on OpenShift using the command rhc -d create-app liferay htt..... An error is raised but I don't know where to find more specific information. What does this error mean and how do I fix it?
Creating application 'liferay' ... DEBUG: Creating application 'liferay' with these options - {:cartridges=>[#<RHC::Rest::Cartridge:0x007ff8f9354e00 #attributes={"url"=>"http...", "messages"=>[]}, #client=nil>]}
DEBUG: Adding application liferay to domain 546b3528ecb8d480bb000012
DEBUG: Using token authentication
DEBUG: Request POST https:...openshift.redhat.com/broker/rest/domain/catapp/applications
DEBUG: code 500 267521 ms
Unable to complete the requested operation due to: An invalid exit code (1) was returned from the server ex-std-node192.prod.rhcloud.com. This indicates an unexpected
problem during the execution of your request.
Reference ID: 4f4141b703879dd93b88b271f553ec1b
Try enabling HTTP_DEBUG:
HTTP_DEBUG=1 rhc -d create-app liferay htt....

Cannot port forward for app

I am trying to use:
rhc port-forward -a <appname>
But keep getting the error:
checking available ports...none
There are no available ports to forward for this application. Your application may be stopped or idled
I can browse to my app, and I've restarted it several times from the web frontend.
Can anyone tell me how I can get port forward to work?
EDIT: When I use debug:
DEBUG: Using config file C:/Users/matthew.harris/.openshift/express.conf
DEBUG: Git config '"C:\Program Files (x86)\Git\bin\git.exe" config --get rhc.app
-id' returned ''
DEBUG: Git config '"C:\Program Files (x86)\Git\bin\git.exe" config --get rhc.app
-name' returned ''
DEBUG: Git config '"C:\Program Files (x86)\Git\bin\git.exe" config --get rhc.dom
ain-name' returned ''
DEBUG: Authenticating with RHC::Auth::Token
DEBUG: Connecting to https://openshift.redhat.com/broker/rest/api
DEBUG: Getting all domains
DEBUG: Client supports API versions 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7
DEBUG: Created new httpclient
DEBUG: Request GET https://openshift.redhat.com/broker/rest/api
DEBUG: code 200 2441 ms
DEBUG: Server supports API versions 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7
DEBUG: Using API version 1.7
DEBUG: Client API version 1.7 is not current. Refetching API
DEBUG: Request GET https://openshift.redhat.com/broker/rest/api
DEBUG: code 200 154 ms
DEBUG: Using token authentication
DEBUG: Request GET https://openshift.redhat.com/broker/rest/domains
DEBUG: code 200 109 ms
DEBUG: Using token authentication
DEBUG: Request GET https://openshift.redhat.com/broker/rest/domain/mharrisweb/ap
plication/node
DEBUG: code 200 210 ms
Checking available ports ... DEBUG: /usr/bin/rhc-list-ports: line 32: 127.5.42.1
30:27017: syntax error: invalid arithmetic operator (error token is ".5.42.130:2
7017")
DEBUG: Getting all gear groups for application node
DEBUG: Using token authentication
DEBUG: Request GET https://openshift.redhat.com/broker/rest/application/5501b0c0
4382ecfefe0000a2/gear_groups
DEBUG: code 200 384 ms`

error rhc app delete 500 error code

I'm trying to delete an app and getting a 500 error code. The app is temp-cartracker.rhcloud.com (I also have temp2-cartracker.rhcloud.com that I can't delete, either)
$ rhc app delete temp -d
DEBUG: Using config file /Users/smenzer/.openshift/express.conf
DEBUG: Git config 'git config --get rhc.app-id' returned ''
DEBUG: Git config 'git config --get rhc.app-name' returned ''
DEBUG: Git config 'git config --get rhc.domain-name' returned ''
DEBUG: Authenticating with RHC::Auth::Token
DEBUG: Connecting to https://openshift.redhat.com/broker/rest/api
DEBUG: Getting all domains
DEBUG: Client supports API versions 1.1, 1.2, 1.3, 1.4, 1.5, 1.6
DEBUG: Using token authentication
DEBUG: Created new httpclient
DEBUG: Request GET https://openshift.redhat.com/broker/rest/api
DEBUG: code 200 530 ms
DEBUG: Server supports API versions 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6
DEBUG: Using API version 1.6
DEBUG: Client API version 1.6 is not current. Refetching API
DEBUG: Using token authentication
DEBUG: Request GET https://openshift.redhat.com/broker/rest/api
DEBUG: code 200 159 ms
DEBUG: Using token authentication
DEBUG: Request GET https://openshift.redhat.com/broker/rest/domains
DEBUG: code 200 141 ms
DEBUG: Using token authentication
DEBUG: Request GET https://openshift.redhat.com/broker/rest/domains/cartracker/applications/temp
DEBUG: code 200 195 ms
This is a non-reversible action! Your application code and data will be permanently deleted if you continue!
Are you sure you want to delete the application 'temp'? (yes|no): yes
Deleting application 'temp' ... DEBUG: Deleting application temp
DEBUG: Using token authentication
DEBUG: Request DELETE https://openshift.redhat.com/broker/rest/application/53617aae500446ad820001b5
DEBUG: code 501 99 ms
DEBUG: Response did not include a message from server: invalid character at "<HTML><HEA"
Server returned an unexpected error code: 501
Can someone please tell me what I'm doing wrong?
Thanks!
This looks like a temporary issue with OpenShift service. Can you try deleting the app from OpenShift web console? You can delete apps via web console as well https://openshift.redhat.com/app/console/applications