Basic-scaling random port number in local devserver

101 views
Skip to first unread message

Jagath Weerasinghe

unread,
Oct 1, 2020, 8:46:04 AM10/1/20
to Google App Engine
Hello, 

When I switched from automatic-scaling to basic-scaling in the development environment, I noticed the port numbers assigned are random and do not follow the specified port number in maven configuration. 

I found a similar question https://github.com/GoogleCloudPlatform/app-gradle-plugin/issues/185, but could not find a solution yet. 

I would like to know:
(1) whether this is the expected behavior?
(2) whether there is a way to configure the ports we need as in automatic-scaling?
(3) is this an issue with the build tools (maven) and not related to the local dev server?

Thanks,
Jagath

Katayoon (Cloud Platform Support)

unread,
Oct 1, 2020, 12:40:07 PM10/1/20
to Google App Engine
Hi Jagath,

My assumption is that you are using App Engine Standard environment with Java. Please correct me if I am wrong? Could you clarify if you have set the PORT environment variable in you code? 

Jagath Weerasinghe

unread,
Oct 1, 2020, 1:59:23 PM10/1/20
to Google App Engine
Hi Katayoon, 

We are running appengine standard environment on Java 8 run time.
I think what you mentioned is available only for Java 11. 
The following is the maven pom.xml config that works for us when we use automatic-scaling: 

<plugin>
   <groupId>com.google.cloud.tools</groupId>
   <artifactId>appengine-maven-plugin</artifactId>
   <version>2.2.0</version>
   <configuration>
      <deploy.promote>false</deploy.promote>
      <port>8889</port>
   </configuration>
</plugin>

Thanks,
Jagath

Jagath Weerasinghe

unread,
Oct 6, 2020, 9:46:50 AM10/6/20
to Google App Engine
Hi Katayoon, 

To add more information, when I run basic-scaling in the local dev server with max instance 1, I see two instances like below:

(1) Module instance <module_name> is running at http://localhost:8889/

(2) Module instance <module_name> instance 0 is running at http://localhost:56064/

Based on the log containing "Received /_ah/start request", I see above (2) as the basic-scaling instance. My guess is that above (1) is acting as the dev server, where it should forward the user request to the basic-scaling instance. 
But now when the requests are sent to the above (1), no forwarding happens.

Jagath



Shawn Wu

unread,
Oct 7, 2020, 1:57:42 PM10/7/20
to Google App Engine
I think the forwarded_ports should be set.  You can forward ports from your instance (HOST_PORT) to the Docker container (CONTAINER_PORT). If you only specify a PORT, then App Engine assumes that it is the same port on the host and the container[1].

Jagath Weerasinghe

unread,
Oct 7, 2020, 2:04:54 PM10/7/20
to Google App Engine
Is this forwarded_port option available in the standard environment as well? We run our app in the standard environment. 

Jagath Weerasinghe

unread,
Oct 13, 2020, 8:38:58 AM10/13/20
to google-a...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/09715445-9ba4-4f2a-a5b7-4d9b864a0ee0n%40googlegroups.com.

yananc

unread,
Oct 17, 2020, 12:31:56 PM10/17/20
to Google App Engine

Hello Jagath,

The ‘forwarded_port’ option is not available for App Engine Standard. The App Engine documentation does not provide much information regarding port numbers assigned for basic scaling in local devserver. But based upon the reply to the issue you created in Github, the behavior is expected. Please let me know if you have any further questions. Thank you.

Reply all
Reply to author
Forward
0 new messages