How to add a custom hostname for project in OpenShift Online (Next Gen) Developer Preview - openshift

How can I put a custom host name for the new project created in the OpenShift (Next Gen) Developer Preview?
It was pretty straight forward for the previous version where I have to add an alias and add the required CNAME entry in DNS. For this version, I tried both CNAME and A. First I add a CNAME to the default address provided by the platform; then I tried adding A record for the address to the Cluster IP shown in the service. Both methods failed to solve it unfortunately!
I can see a router object in the site but not sure what to do!
Anyone any idea?

At this point in time, the developer preview does not permit you to add a custom hostname through the platform itself. OpenShift does support the concept, but it is disabled for now.
The only way to can achieve the same result at the moment is to run your site behind a CDN such as CloudFlare, or your own separate proxy outside of OpenShift, with those terminating the request for your custom host name and then forwarding it.
That said, how it would usually be done if enabled is by creating a new route with the specified hostname.
oc expose service myapp --name myapp-public --hostname www.example.com

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.

"The host is unknown to Read the Docs" while hosting local RTD server

I'm trying to see whether I can host RTD privately (behind a VPN). I spun up an AWS EC2 instance and set it up using the Docker image and instructions here. Everything worked fine, but when I go to http://<internal_ip> to test it I get a page with the message
404 - Invalid Host
The host "" is unknown to Read the Docs
If you control this domain and believe this is in error, please review our custom domain documentation. In the past, we allowed custom domains to point to us without configuring the domain in the Read the Docs dashboard and we attempted to intelligently guess the correct project based on DNS settings. Now, we believe that explicit is better than implicit. Below are some steps to help you get your domain working again:
Ensure you have a CNAME record pointing to readthedocs.io
Add your desired domain in the Read the Docs dashboard for your project (under Your Project >> Admin >> Domains)
It points me to this page, but it seems to me that those instructions assume I'm hosting my project on the public readthedocs.io site. Any ideas on how I can get this to work on my private server?

How to make polymer serve be accessible on the internet or Lan, instead localhost?

I have a Polymer 2 component that I serve locally running
polymer serve
I get the following back:
Files in this directory are available under the following URLs
applications: http://127.0.0.1:8081
reusable components: http://127.0.0.1:8081/components/component-name/
That works very well; as expected I am able to open a local URL and view the component on Chrome.
I need to test this component on an Android Device, the best way it would be (please correct me if I´m wrong) to make this polymer component available on the internet or my local network.
Any suggestion is appreciated. thanks.
When you use the serve command you have some additional parameters. With one of them (-H) you can set the IP you want to be used. So instead of launching the server for your loopback (localhost) IP (the default), you can use your LAN IP (I guess most likely something like 192.169.x.x), or even:
polymer serve -H 0.0.0.0
"0.0.0.0" basically meaning "all IPv4 addresses on the local machine". So now you only need to know your IP in the network you are and that Android device is connected also. So if both of them are connected to the same router you should be able to open in your phone an URL like http://192.168.x.x:8081

Openshift 3 Online Starter & Routing

I have a starter (free) tier account with Openshift online. I have an application consisting of two pods, a Node and a Mongo. The pods build and deploy; from the terminal that executes in the web console on the running Node pod I can run curl localhost:8080 and the Node process obligingly spits back my base page.
I have a route that was autogenerated; the web console gives me a link to <myappname>.stuff.starter-east-1.openshiftapps.com and appears to correctly reference the Node service that sits on top of the running Node pod.
However, when I point my browser at that hostname, I get the Openshift error page that tells me that either the route or path was not typed correctly, or the pod isn't running.
I have tried this with my own code and with the example node packages and I see the same thing.
When I use the oc tool to query things about my application, I see that I don't have a router resource - but the route claims to have been exposed on a router. So I think I'm using some kind of default router in the node, and I don't have to launch one in my project, but I'm not sure. Most of the other questions around this topic are for people using the Enterprise product and running on their own hardware, where they have more control at the admin layer over the router package; all the suggestions seem to imply that for the Online product this 'just works'. Any ideas what I am missing?
Update : After some period of time, the example project did work and a browser request was serviced with the basic example page. Looking at the two setups I cannot see any differences, or why my route (in my custome app) never gets activated but the sample project route does.
Turns out the issue was that my application (node) was listening to localhost:8080, when it needs to be listening to 0.0.0.0:8080. I'm not enough of a networking guy to explain why that matters to the router but it does.

Using a custom domain with openshift v3

I've been trying to use Openshift Online v3 to host a web app. It works fine with the red hat-provided domain, but I can't get the routing working to get it to work on any other domain. all I get is:
Application is not available
The application is currently not serving requests at this endpoint. It may not have been started or is still starting.
Possible reasons you are seeing this page:
The host doesn't exist. Make sure the hostname was typed correctly and that a route matching this hostname exists.
The host exists, but doesn't have a matching path. Check if the URL path was typed correctly and that the route was created using the desired path.
Route and path matches, but all pods are down. Make sure that the resources exposed by this route (pods, services, deployment configs, etc) have at least one pod running.
Does anybody know how to do a custom domain in Openshift v3?
Step 1: Create two routes in openshift v3 console. One provided default by the openshift (*.openshiftapps.com) and create another route with the host name as your domain name.
Step 2: Go to domain registrar and add a CNAME record for your domain which points to *.openshiftapps.com domain
Wait for the CNAME addition to take effect and access your domain name from the browser, now it should get the page loaded properly.
As was the case with OpenShift Online Developer Preview, the GA free OpenShift Online starter tier does not support custom domains. Custom domains will only be available when the full paid tier is available. The only option in the interim is to use a proxy in front. One option is to use Cloudflare as that proxy.
Take a look at these docs.
$ oc create route edge --service=frontend \
--cert=${MASTER_CONFIG_DIR}/ca.crt \
--key=${MASTER_CONFIG_DIR}/ca.key \
--ca-cert=${MASTER_CONFIG_DIR}/ca.crt \
--hostname=www.example.com
For starter (free) plan, you may try hidden redirected URL. Some DNS providers provide such service.