Deploy war file in apache-tomcat on google compute engine - google-compute-engine

I have created instance on google cloud platform (allowed http traffic). Used Ubuntu 14.04 OS. Installed oracle java8 and apache-tomcat.Placed war file in tomcat webapps and started server. Server started successfully.
Question is how to access my application, tried accessing external ip of instance from web browser but no response.
Can anyone tell me the process or missing things I have not done.
Thanks in advance.

I had the same issue and eventually solved it
In my case the solution was simple.Check the firewall rule is really tcp:8080 and not tcp:80 as created by default.
Changed this and finally saw my tomcat welcome page.

1)Added http port (8080) in firewall rules in Networking section
2)Refreshing VM instance by click refresh option before accessing with external ip followed by http server port(8080)
I hope after following first step, need to refresh VM instance to access web serve with external IP

Related

Express/NodeJS application on Cpanel

Ok so I have an app with a Node/Express API and everything works fine on localhost. I'm trying to figure out how to make everything work on CPanel that's running on Apache. The client side stuff but I am unable to fetch any data from the backed. I've searched and looked, yes, but I'm still quite unsure on how to approach this. Do I have to use a Virtual Host and if so what are the specific steps I need to do?
NodeJS doesn't run on Apache or Nginx. Most you can do in these web servers is to set a reverse proxy.
NodeJS has its own web-server. cPanel won't help you in that regard, since you only need to install NodeJS on your server (you must have SSH access-root), and run it from there. You can daemonize your Node process to keep running installing PM2 or Forever (NPM Packages).
Here's a good answer (search before asking, the issue might be solved by then).
Run node.js on cpanel hosting server
cPanel typically runs Apache or another web server that is shared among all the cPanel/unix accounts. The web server listens on port 80. Depending on the domain name in the requested URL, the web server uses "Virtual Hosting" to figure out which cPanel/unix account should process the request, i.e. in which home directory to find the files to serve and scripts to run. If the URL only contains an IP address, cPanel has to default to one of cPanel accounts.
Ordinarily, without root access, a job run by a cPanel account cannot listen on port 80. Indeed, the available ports might be quite restrictive. If 8080 doesn't work, you might try 60000. To access a running node.js server, you'll need to have the port number it's listening on. Since that is the only job listening on that port on that server, you should be able to point your browser to the domain name of any of the cPanel accounts or even the IP address of the server, adding the port number to the URL. But, it's typical to use the domain name for the cPanel account running the node.js job, e.g. http://cPanelDomainName.com:60000/ .
Of course port 80 is the default for web services, and relatively few users are familiar with optional port numbers in URLs. To make things easier for users, you can use Apache to "reverse proxy" requests on port 80 to the port that the node.js process is listening on. This can be done using Apache's RewriteRule directive in a configuration or .htaccess file. This reverse proxying of requests arguably has other benefits as well, e.g. Apache may be a more secure, reliable and manageable front-end for facing the public Internet.
Unfortunately, this setup for node.js is not endorsed by all web hosting companies. One hosting company that supports it, even on its inexpensive shared hosting offerings, is A2Hosting.com. They also have a clearly written description of the setup process in their Knowledge Base.
Finally, it's worth noting that the developers of cPanel are working on built-in node.js support. "If all of the stars align we might see this land as soon as version 68," i.e. perhaps early 2018.
References
Apache Virtual Hosting -
http://httpd.apache.org/docs/2.4/vhosts/
Apache RewriteRule Directive - http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html
A2Hosting.com Knowledge Base Article on Configuring Node.js - https://www.a2hosting.com/kb/installable-applications/manual-installations/installing-node-js-on-managed-hosting-accounts
cPanel Feature Request Thread for node.js Support - https://features.cpanel.net/topic/nodejs-hosting
Related StackOverflow Questions
How to host a Node.Js application in shared hosting
Why node.js can't run on shared hosting?
Is worth to point out that the NodeJS support hasn't yet come to cPanel (as early 2019)

Express app not accessible sometimes only for some users

The app is not accessible sometimes but only for some users. In the same LAN also, some users can access but some cannot.
The web app was designed with following technologies
Node
Angular
Express
MySql.
It's hosted in AWS EC2, MySql is also installed on the same EC2 instance.
I have no idea how this is happening. The server was running all the time.
This eror is not related your application - it's just that domain can not be resolved. You should check your DNS setting on server and on clients. See also instruction here, for example.

Odoo on Google compute engine - refused to connect

I am fairly new to both google compute engine and Odoo. I have recently started a google compute engine with Ubuntu-16 installed. I have successfully followed instructions on Odoo website to install and start Odoo server. When I try to access my Odoo instance from another computer by going to
IP-address-of-server:8069
I find
ERR_CONNECTION_REFUSED
Following are the firewall rules for the instance. Please guide me on how to solve this problem. Please feel free to ask for any additional information.
You have multiple things to make sure what exactly is your problem. Check whether odoo service is working by entering systemctl status odoo-server
This should show whether your service is started (and enabled) or not. Check this then reply back.
Also, while accessing your odoo server, use http request instead of https.
Try if you can connect from the VM itself to Odoo. Log in to your VM with ssh and then use curl localhost:8069 or wget localhost:8069. If that's successful, it's a firewall issue.
If it is a firewall problem, add a rule similar to the default-allow-http, but for the port you need. Then add the tag of your rule to your VM instance. You can do this in Cloud console.

Cannot access Google Cloud Compute Instance External IP

I have set up an Google Cloud Compute Instance:
Machine type
n1-standard-1 (1 vCPU, 3.75 GB memory)
CPU platform
Intel Haswell
Zone
us-east1-c
I can ssh in using the external address.
I have installed the vncserver and can access it on port 5901 from localhost as well as the internal IP.
I am trying to access it from the static, external IP address but it is not working.
I have configured the firewall to open to port to 0.0.0.0/0, but it is not reachable.
Can anyone help?
------after further investigation from the tips from the two answers (thanks, both!), I have a partial answer:
The Google Cloud Compute instance was set, by default, to not allow
HTTP traffic. I reset the configuration to allow HTTP traffic. I
then tried the troubleshooting tip to run a small HTTP service in
python. I was able to get a ressponse from the service over the
internet.
The summary of the current situation is as follows:
The external IP address can be reached
It is enabled and working for SSH
It is enabled and working for HTTP
It does not seem to allow traffic from vncserver
Any idea how to configure the compute instance to allow for vncserver traffic?
If you already verified that Google Firewall or your VM are not blocking packets, you must make sure that VNC service is configured to listen on the external IP address.
You can always use a utility like nmap outside Google project to reveal information on the port status.
enable http/https traffic form the firewall as per the need. it will work!!
The Google Cloud Compute instance was set, by default, to not allow HTTP traffic. I reset the configuration to allow HTTP traffic. I then tried the troubleshooting tip to run a small HTTP service in python. I was able to get a response from the service over the internet.
As such, the original question is answered, I can access Google Cloud Compute Instance External IP. My wider issue is still not solved, but I will post a new, more specific question about this issue
TLDR: make sure you are requesting http not https
In my case i was following the link from my CE instance's External Ip property which takes you directly to the https version and i didn't set up https, so that was causing the 'site not found' error.
Create an entry in your local ssh config file as below with mentioned local forward port. In my case its an example of yarn's IP, which I want to access in browser.
Host hadoop
HostName <External-IP>
User <Local-machine-username>
IdentityFile ~/.ssh/<private-key-for-above-user>
LocalForward 8089 <Internal-IP>:8088
In addition to having the firewall rules to allow HTTP traffic in both Google Cloud Platform and within the OS of the instance, make sure you install a web server such as Apache or Nginx.
After installing the web server, you connect to the instance using SSH and verify you do not get a failed connection with the following command:
$ sudo wget http://localhost
If the connection is positive, it means that you can access your external URL:
http://<IP-EXTERNAL-VM>
Usually there are two main things to check.
1. Port
By default, only port 80, 443 and ICMP are exposed. If your server is running on a different port, create a record for the same.
2. Firewall
Make sure you are allowing http and https traffic based on your need.
oua re
For me the problem was that I set up the traffic for the firewall rule to be 'Egress' instead of 'Ingress'.
If anyone already initiated 'https'
just disable it and check again.

Haproxy issue with Openshift

I am running a multisite instance of Locomotive CMS on a scalable Openshift cartridge.
The issue I am having is that haproxy sends GET requests to the root of each Apache instance, returning an erroneous 404, because no host is specified.
Locomotive works fine, but needs a host to each request, so it will serve the appropriate website.
How can I workaround this problem?
You can try sshing into your gear and modifying the ~/haproxy/haproxy.cfg to check a different url instead of / to make sure that your application is up and running.