How do I debug 503 errors in Openshift? - openshift

I have a scalable EAP 6.0 web app hosted on Openshift, and I get HTTP 503 error messages whenever I attempt to access the app. How do I fix this.

In my case this was an issue with the HAProxy cartridge, and not my web cartridge. I found this out by attempting to view the HAProxy status page at http://app-domain.rhcloud.com/haproxy-status/ (obviously you'll have to replace app and domain in that URL to match your own Openshift settings). That page was displaying a 503 error.
To fix it, ssh into the HAProxy session using
ssh 1234567890abcdef1234567890abcdef#app-domain.rhcloud.com
You'll get your actual username and hostname from your OpenShift web admin console. Then run
ctl_app restart
This will restart the HAProxy. And for me, that fixed the issue.
Another handy tip I found while debugging this was that you can browse to a specific instance of your web cartridge, bypassing the HAProxy.
In the HAProxy status page, you can see that the web cartridge instance is called gear-1234567890ab-domain. Drop the "gear-" prefix, and then use the remaining hex characters and domain name to form a URL like:
1234567890ab-domain.rhcloud.com
This will take you straight to the specific web cartridge, bypassing any HAProxy issues.

Thanks Phyxx,
Its working for me let elaborate your suggestion so that others can also benefit.
Step 1: cd /var/lib/openshift/your server/haproxy/conf
Step 2: vi haproxy.cfg
step 3: remove " option httpchk GET /"
step 4: save
step 5: ctl_app restart

Related

How to view a dash app created on a Ubuntu server without GUI (a VM instance in gcp)

I have an R script that uses Plotly Dash to create a web page. I am running the script on a VM instance in GCP which is a Ubuntu server without GUI. When the script is executed, it says,
start 127.0.0.1:8050
My question is how to access this web page on a browser from anywhere. Since the VM doesnt have a gui/browser I cannot even test my web page..
Anyone could explain what I am missing here or any way to deploy my web page and access from anywhere?
I am unsure how your application works, but that ending line shows that the server is running on localhost and on which port is it serving. So you may want to access from an external browser with the instance's ip address: like http:// xx.xxx.xx.xx:8050 and let's see if it works. Otherwise you may need to set up a Remote Desktop Setup through Chrome to enable a GUI interface on the VM.
Also remember to make sure that traffic is allowed on that port 8050 checking /creating the firewall rules
I encountered the same problem. You need to change the IP address on which the dash server is running to the internal IP address of your gcp VM instance. It usually starts with 10.xxx.x.x. You can find this internal address in the 'IP address' tab in the VPC networks section on the google cloud console. So do this:
app.run_server(host='10.xxx.x.x', port='8050')
Open a browser and browse to http://externalip:8050. Make sure you have your firewall rules set up correctly.
You should now be able to see the dash app.

Openshift Login Plugin Jenkins - Invalid Request

I tried to setup-up a custom jenkins image, based on the redhat jenkins image. The redhat jenkins image, has the Openshift Login Plugin, installed already.
After, the image started up properly, I tried to login, with my Openshift credentials, but it didn't work.
I just saw the the following error message:
"error":"invalid_request","error_description":"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.","state":"xxxxxxxxxxxxxxxxxxx"
and there was another message in the OS terminal of the running pod.
I read about several other issues from the Openshift Login Plugin, but also an update to Version 1.0.12 didn't fix my problems.
My Problem was, that I didn't knew, that each Openshift Service Account has a redirect reference - specially configured for one deployment.
I already used the Service Account, I used for the above mentioned Jenkins, for another Jenkins Deployment, because of this Openshift added the redirect reference, configured for this "older" deployment.
In our Openshift Setup (3.11), you aren't able to find the redirection configuration within the Service Account settings that you can find under Resources --> Membership --> Service Accounts. Instead you have to look and edit the YAML File of the Service Account, that you can find under Resources --> Other Resources --> Service Account.
serviceaccounts.openshift.io/oauth-redirectreference.jenkins
Since this is quite tricky to find out, I hope that I could possibly save somebody a few hours of searching.

How do I change my IIS Express SSL certificate for one that will work with Chrome 58+?

Chrome 58+ drops support for CN in SSL certs, which means (at least on my machine) that browsing sites hosted in IIS Express throw constant security warnings.
How do I change my IIS Express SSL certificate for one that will work with Chrom 58+?
This is how I fixed this. There may be an easier way (I'm sure there is!)
Step 1 - Open Windows PowerShell (in admin mode) and generate a certificate like this:
New-SelfSignedCertificate -DnsName "localhost", "localhost" -CertStoreLocation "cert:\LocalMachine\My"
Keep the thumbprint safe.
Step 2 - Open a command prompt (in admin mode) and run these commands.
The first will delete the current IIS Express certificate for ports 44300-44399.
for /L %i in (44300,1,44399) do netsh http delete sslcert ipport=0.0.0.0:%i
The next will add your new certificate to those ports. Change the thumbprint obviously.
for /L %i in (44300,1,44399) do netsh http add sslcert ipport=0.0.0.0:%i certhash=33459ADA4D5329673604F43A073B7F43084818A7 appid={214124cd-d05b-4309-9af9-9caa44b2b74a}
The appid is for IIS Express 10 I believe. You may want to check your IIS Express appid is the same as mine first. To do that do this:
netsh http show sslcert
Step 3 - Restart IIS Express and Chrome, then run up one of your sites in Chrome.
It'll give you the security warning again. Proceed to the page then go into settings > advanced settings, HTTPS/SSL Manage certificates.
In here, export the certificate from Personal and import the certificate to Trusted Root Certificate Authorities (I did it as .p7b) then restart Chrome.
Try the site again - you should be secure now.
You can do all this outside of Chrome in certmgr as well.
Edit: Alternate steps for Step 3 above using certmgr:
Hit win key and type "certmgr" to open the Windows cert manager.
Expand Certificates - Local Computer > Personal > Certificates and find the cert you just created (it should be issued to localhost and have an expiration one year from the current date).
Select the cert and ctrl-c to copy.
Expand Certificates - Local Computer > Trusted Root Certification Authorities > Certificates and ctrl-v to paste.
The answer Chris gave solves the issue, thanks! Because my whole team had this issue, I created a little Powershell script to run the steps in Chris' answer.
https://gist.github.com/camieleggermont/5b2971a96e80a658863106b21c479988
Running this in elevated mode did the trick for me.
I am just using this setting until it is fixed in Visual Studio:
chrome://flags/#allow-insecure-localhost
It just prevents having to allow the security exception each time but it will still show the SSL as invalid (red) in your browser bar.
The solution provided by Chris does do the trick (thanks!), but ultimately this should be fixed by the visual studio team. You can vote here in order to bring this issue to their attention:
https://developercommunity.visualstudio.com/content/problem/48596/visual-studio-2017-151-264037-crashing-during-code.html
A more visual way to fix it is to use Jexus Manager to,
Generate a new certificate.
Let Windows (and Chrome) trust it.
Bind it to the site.
I documented the exact steps in a blog post.

Google Chrome remote debugging local domain

I'm developing a website on my local machine using myblog.local as a custom domain for that, I have an apache VirtualHost and the name registered on the hosts file of my mac. The thing is when I try to use chrome remote debugging on my USB connected device using myblog.local as an address pushed using the chrome://inspect tool.
I always a not found error.
My question is, do I need to do something extra in order to remotely debug a custom domain registered on my Mac?
Check out Map to custom local domains.
I got it set up once to work with custom local domains, but it took a bit of experimenting. I definitely needed a proxy server to get it working.
I had exactly the same problem on a PC. I followed #Kayce Basques' Map to custom local domains guide and after some perseverance everything is now working.
Kayce's guide requires a proxy server, I've included my working configuration for the Squid open source and free proxy server below.
Squid installation was easy, I just downloaded and installed a pre-compiled Windows binary file and the server appeared in my Windows system tray. It should hopefully be equally simple for OSX and Linux platforms.
All configuration is done inside a squid.conf file accessible from the Squid menu. I followed this simple guide for a Reverse Proxy. Whilst I included everything in that guide I believe the following line is the critical one to get everything working.
cache_peer 192.168.0.2 parent 80 0 no-query proxy-only originserver
In the above line 192.168.0.2 is my PC's internal IP address and 80 is my Apache virtual host port number defined in my Apache Virtual Hosts file. There's another helpful guide here but that guide omits the originserver option and didn't work on my machine though otherwise helpful.
It seems you do need to be connected by USB cable for this to work so I don't quite understand #asolenzal's comment above. Also each time I changed the configuration I ran Path/to/squid.exe -k reconfigure -n Squid in a command window to reload Squid. You can find that command here.

PHPStorm head method failed

Attempted to add a project from a server on a remote host. I can SSH & SFTP without PHPStorm in no prob. The first error I encounter is attempting to select my remote server; when I test the connect, it is successful. When I do not check off 'Don't check HTTP connection to server', I get:
Connection to 'Server' failed.
HEAD method failed for "ip address" with HTTP status 401.
If I enable Don't check HTTP connection to server, I can proceed and I am brought to a list of all directories on my remote server. I select my project as the project root, and attempt to download. Collecting files goes smoothly, and downloading goes by well until a particular file is reached. Error msg:
Downloading Project Files failed: failed to transfer file 'wireframes.scssc': channel is not opened.
I tried to exclude that directory from download, but it had no effect.
The apache server is configured with basic access authentication. I disabled mod_auth_basic (as confirmed in php.ini), but am still prompted for credentials even after an apache restart. This is second issue preventing me from exploring this potential solution. Any suggestions?
http://imgur.com/a/qGC1I
I had this same issue, to fix it I chose custom for deployment options and then added .sass-cache to the list of things in the "Exclude items by name" field.
I also had to close and re-open phpstorm or it would fail immediately after starting the download.