app engine insists on binding to port 80 - google-app-engine

I'm trying to run the latest Go SDK of Google App Engine on Windows Subsystem for Linux. I want to bind it to port 8080 but the system keeps trying to bind to port 80, and failing.
$ dev_appserver.py --port 8080 .
INFO 2018-06-08 02:48:56,648 devappserver2.py:120] Skipping SDK update check.
INFO 2018-06-08 02:48:56,786 api_server.py:274] Starting API server at: http://localhost:53314
INFO 2018-06-08 02:48:56,791 dispatcher.py:270] Starting module "default" running at: http://localhost:8080
INFO 2018-06-08 02:48:56,792 admin_server.py:152] Starting admin server at: http://localhost:8000
ERROR 2018-06-08 02:48:58,427 http_runtime.py:396] bad runtime process port ['2018.0608.0248.5842 listen tcp :80: bind: permission denied\n']
I found the problem. I am porting this code from non-appengine Go code, and I had left "http.ListenAndServe(":80", nil)" in the code.

I found the problem. I am porting this code from non-appengine Go code, and I had left "http.ListenAndServe(":80", nil)" in the code.

Related

error on start nginx service on ubuntu vps

i am begginer user of vps, i have a reactJS app, and i wnat to deploy it on my ubuntu 18 vps with nginx.
I have followed the stpes of this tutorial Deploying create-react-app with Nginx and Ubuntu
i had already check all the steps, but when i put the command
sudo service nginx start
the system show's me, the next error message:
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
and when i put "journalctl -xe" shows me this:
nginx, error
ngnix, error
please help me friends
Look in your log file on messages before the error "Failed to startup nginx"
You will see the reason of problem.
bind() to 0.0.0.0:80 failed (98: Address already in use)
Looks like port 80 on your vps server is already in use by some application.
Port 80 used for HTTP services.
So most likely you already have run Apache HTTP server, or some other.
use this command to see what application use it
sudo netstat -tulpn | grep ":80"
If you see apache
tcp6 0 0 :::80 :::* LISTEN 349/apache2
then you can stop apache
# apache service name also can be httpd (use right command)
# sudo service httpd stop
sudo service apache stop
and run nginx
sudo service nginx start
But you should be sure that you don't use apache for another website.

Possible? How to setup VNC in a Google Managed VM Environment

I'm using Java but this isn't necessarily a Java question. Google's "java-compat" image is Debian (3.16.7-ckt20-1+deb8u3~bpo70+1 (2016-01-19)).
Here is my Dockerfile:
FROM gcr.io/google_appengine/java-compat
RUN apt-get -qqy update && apt-get qqy install curl xvfb x11vnc
RUN mkdir -p ~/.vnc
RUN x11vnc -storepasswd xxxxxxxx ~/.vnc/passwd
EXPOSE 5900
ADD . /app
And in the Admin Console I created a firewall rule to open up 5900. And lastly I am calling the vnc server itself in the "_ah/start" startup hook with this command:
x11vnc -forever -usepw -create
All seems to be setup correctly but I'm unable to connect with TightVNC. I use the public (ephemeral) IP address for the instance I find in the Admin Console followed by ::5900 (TightVNC requires two colons for some reason). I'm getting a message that the server refused the connection. And indeed when I try to telnet to port 5900 it's blocked.
Next I SSH into the container machine and when I test the port on the container with wget xxx.xxx.xxx.xxx:5900 I get a connection. So it seems to me the container is not accepting connections on port 5900. Am I getting this right? Is it possible to open up ports and route my VNC client into the docker container? Any help appreciated.
Why I can't use Compute Engine. Just to preempt some comments about using google's Compute Engine environment instead of Managed VMs. I make heavy use of the Datastore and Task Queues in my code. I don't think those can run (or run natively/efficiently) on Compute Engine. But I may pose that as a separate question.
Update: Per Paul in the comments... having learned some of the docker terminology: Can I publish a port on the container in Google's environment?
Out of curiosity - why are you trying to VNC into your instances? If it's just for management purposes, you can SSH into Managed VM instances.
That having been said - you can use the network/forwarded_ports config to route traffic from the VM to the application container:
network:
forwarded_ports:
- 5900
instance_tag: vnc
Put that in your app.yaml, and re-deploy your app. You'll also need to open the port in your firewall (if you intend on accessing this from the public internet):
gcloud compute firewall-rules create default-allow-vnc \
--allow tcp:5900 \
--target-tags vnc \
--description "Allow vnc traffic on port 5900"
Hope this helps!

How to open localhost:8080 in Cloud9 IDE?

I am developing an app engine project (golang) in Cloud9 IDE. For testing in desktop i would go to localhost:8080 in my desktop browser.
In Cloud9, I tried https://workspace-username.c9.io with $PORT set as 8080, but somehow its not working for appengine project. But it is working for normal go web project though.
How do i test app engine application in Cloud9 IDE? or
How do i open http://localhost:8080 in Cloud9 IDE?
Available ports on a hosted Cloud9 workspace
If you're developing a server application, please note that you need
to listen to 0.0.0.0 ($IP) and 8080 ($PORT). Listening to this port
will enable your app to be viewable at https://-.c9users.io
You can also bind to ports 8081, and 8082, which can be accessed by
https://-.c9users.io:8081 and https://-.c9users.io:8082 respectively.
Please note that 8080, 8081, and 8082 are the only available ports on
a hosted Cloud9 workspace.
How to connect to the process running on 'localhost' that is inside of cloud9 server
I see some users are looking for the answer for this, So here is how to do it.
instead of "goapp serve" use "goapp serve -host 0.0.0.0"
credits to Cloud9 support team.
For Google App Engine running Python, the command would be
dev_appserver.py app.yaml --host $IP --port $PORT --admin_host $IP --admin_port 8081
You can also specify the admin host/port. Since Cloud 9 allows access to 8081 and 8082, you can use either of those as your admin ports. For me, the admin console did not open with the Cloud9 preview, but did open in a new tab within my browser.
$IP and $PORT are both environment variables for Cloud 9, with the values of 0.0.0.0 and 8080 respectively.
Edit:
With the most recent gcloud update (March 2018), you don't have to change the IP or PORT, but you do need to figure out how to work around the host whitelisting issue.
My non-ideal workaround is to add a flag to not check for hosts --enable_host_checking=false.
dev_appserver.py app.yaml --enable_host_checking=false
There's an unanswered Cloud 9 post around this issue (link to c9 forum). My guess is that you can add $C9_HOSTNAME as the host, but that doesn't quite work for me.
Interactive Console
If you want to use the interactive console you need to assign the admin port and also use the `--enable_console' flag.
dev_appserver.py app.yaml --enable_host_checking=false --admin_port 8081 --enable_console=true

Pydev + Google App Engine + Eclipse = dev_appserver terminates right on

i've been a happy user for pydev, eclipse and gae.
Now i've changed my computer and reinstalled the latest jee eclipse, pydev and gae. As usual, I configure my pydev gae project (I use App Engine Modules), have it launched by the eclipse debugger.
The issue is that as soon as I launch a cron task through the admin interface (localhost:8000/cron), every thread terminates and the dev_appserver ends (exit value : 137)
Everything run smooth when launching dev_appserver.py by hand and with pycharm (i'd like to keep using pydev!)
versions
Google Cloud SDK 0.9.33
app-engine-python 1.9.12
eclipse 4.4.1
pydev 3.8.0.201425
Debug windows content
<terminated>xxxx xxxx (1) [PyDev Google App Run]
<terminated>dev_appserver.py
dev_appserver.py
dev_appserver.py
dev_appserver.py
<terminated, exit value: 137>dev_appserver.py
console ouput
pydev debugger: starting (pid: 20240)
INFO 2014-10-15 10:27:19,522 api_server.py:171] Starting API server at: http://localhost:34966
INFO 2014-10-15 10:27:19,523 dispatcher.py:174] Starting dispatcher running at: http://localhost:8080
INFO 2014-10-15 10:27:19,553 dispatcher.py:186] Starting module "default" running at: http://localhost:8081
INFO 2014-10-15 10:27:19,586 dispatcher.py:186] Starting module "static-backend" running at: http://localhost:8082
INFO 2014-10-15 10:27:19,589 admin_server.py:117] Starting admin server at: http://localhost:8000
pydev debugger: starting (pid: 20264)

Cannot access Jenkins

I have installed Jenkins on my Ubuntu 12.04 desktop machine using this guide:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu
I also needed to follow this guide:
http://aslamnajeebdeen.com/blog/how-to-fix-apache-could-not-reliably-determine-the-servers-fully-qualified-domain-name-using-127011-for-servername-error-on-ubuntu
From my other machine (mac laptop) I now try to access Jenkins through safari:
http://192.168.1.100/jenkins
where 192.168.1.100 is the ip address of my desktop machine but I get an Error 404. I have also tried:
http://jenkins
but nothing happens. What am I missing?
The Jenkins service is running on my desktop PC:
service jenkins status
...
Jenkins Continuous Integration Server is running with the pid 3713
And if I enter: localhost:8080 in a browser on my desktop pc I get the jenkins web interface.
PROBLEM SOLVED:
I have followed this guide:
http://www.zzorn.net/2009/11/setting-up-hudson-on-port-80-on-debian.html
and it now works.
I had the same problem but not using Apache, rather only Jenkins on Ubuntu
I solved it by replacing HTTP_HOST=127.0.0.1 with HTTP_HOST=0.0.0.0 on /etc/default/jenkins
Jenkins is set to listen on port 8080 by default,
so you should point your browser to:
http://localhost:8080/
(or, in your case: http://192.168.1.100:8080/ )
EDIT:
If still not able to connect, you may wish to check your firewall settings.

Resources