5

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?

vvincirey
  • 191
  • 3
  • 11

3 Answers3

2

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

Community
  • 1
  • 1
xgqfrms
  • 10,077
  • 1
  • 69
  • 68
1

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.

vvincirey
  • 191
  • 3
  • 11
1

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

nanselm2
  • 1,397
  • 10
  • 11