GAE modules on the development server

I use several modules with Google AppEngine and wondered if it is possible to start the development server (java version) so that the ports assigned to different modules are always the same? At the moment, they seem random. Can I decide on these ports? I would like to be able to establish a connection between the modules in a sustainable manner (from a development point of view). For now, if we have two modules, let them name them A and B, and we would like to use the services opened by module A in module B, there is no easy way to find out which URL is coming from module B.

+6
google-app-engine
source share
4 answers

Although the service may be useful in this scenario, and I think it works, I solve the problem a little differently.

I modified my build script to run all the modules on the local host, but on different ports (in fact, there are several local application instances). The configuration information (IP: PORT) is stored in the configuration file and is easily accessible for any module. For deployment, I still pack the application in the ear archive.

-2
source share

You can set the port of each module using the JVM options.

-Dcom.google.appengine.devappserver_module.{module_name}.port=8081 

I use appengine-maven-plugin with the following configuration (my custom module is called "analysis"):

 <plugin> <groupId>com.google.appengine</groupId> <artifactId>appengine-maven-plugin</artifactId> <configuration> <jvmFlags> <jvmFlag>-Ddatastore.backing_store=${project.basedir}/target/local_db.bin</jvmFlag> <jvmFlag>-Xdebug</jvmFlag> <jvmFlag>-Dcom.google.appengine.devappserver_module.analysis.port=8081</jvmFlag> <jvmFlag>-XX:MaxPermSize=512m</jvmFlag> <jvmFlag>-agentlib:jdwp=transport=dt_socket,address=8001,server=y,suspend=n</jvmFlag> </jvmFlags> <enhancerApi>JPA</enhancerApi> <fullScanSeconds>2</fullScanSeconds> </configuration> </plugin> 

When I run mvn appengine: devserver, then the logs corresponding to this module look like this:

 [INFO] INFO: Started SelectChannelConnector@127.0.0.1:8081 [INFO] Jun 10, 2014 10:44:16 AM com.google.appengine.tools.development.JettyContainerService startHotDeployScanner [INFO] INFO: Full scan of the web app in place every 2s. [INFO] Jun 10, 2014 10:44:16 AM com.google.appengine.tools.development.AbstractModule startup [INFO] INFO: Module instance analysis is running at http://localhost:8081/ [INFO] Jun 10, 2014 10:44:16 AM com.google.appengine.tools.development.AbstractModule startup [INFO] INFO: The admin console is running at http://localhost:8081/_ah/admin [INFO] Jun 10, 2014 11:44:16 AM com.google.appengine.tools.development.DevAppServerImpl doStart [INFO] INFO: Dev App Server is now running 

I hope this helps.

+8
source share

You can set the module port through the system property in the appengine-web.xml . For example:

 <appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <module>MY_MODULE</module> <version>v1</version> <threadsafe>true</threadsafe> <system-properties> <property name="com.google.appengine.devappserver_module.MY_MODULE.port" value="8081"/> </system-properties> </appengine-web-app> 
+2
source share

I do not think that Google will provide an easy approach to this problem. You will need to use the module service and transfer it to your helper class, for example LinkFactory , using methods such as getLinkToA(String) and getLinkToB(String) and you will find them wherever you create links to modules.

The same (and more) problem if you use a send file . This is actually a big problem because parts of your front-end application may fail because routing does not work on the development server.

+1
source share

All Articles