GoogleCloudPlatform / app-gradle-plugin

The library has moved to https://github.com/GoogleCloudPlatform/appengine-plugins/tree/main/app-gradle-plugin
Apache License 2.0
153 stars 40 forks source link

How to load multiple services without the gradle plugin #199

Closed JohannRosenberg closed 6 years ago

JohannRosenberg commented 6 years ago

I am able to load multiple services with the gradle plugin. This would be great if it weren't for the fact that every service is assigned a random port number every time you run:

gradle appengineRun

You can specify a port in the run section of the build.gradle file but this will only apply to the default port. The other services will have a random port.

This makes it difficult to debug an app locally when one service needs to communicate with another service because you have to change the port in code before you run the app each time.

Maybe there's a way to programmatically retrieve the port number used by each service? I doubt it.

That leads me back to using my original solution which was to not use the gradle plugin for running the app. Instead, just launch multiple instances of the local dev server giving each their own port. I then setup the domain names in my hosts file as follows:

127.0.0.1 service-a.myapp.appspot.com
127.0.0.1 service-b.myapp.appspot.com
127.0.0.1 service-c.myapp.appspot.com

I then use IntelliJ and open each service as a separate project. I can put breakpoints in each service and they will get hit. The advantage of all of this? The urls I use for local testing and production are identical except that I need to append a port to the local url. But this port is fixed and never changes.

Still this solution does require running multiple instances of the local dev server when it probably can be eliminated and a single instance run. But this only works if I use the gradle plugin. How can I get the local dev server to use the exploded war files from multiple services but without using the gradle plugin? The gradle plugin is able to do this, so it must be possible by some other means outside of the plugin.

loosebazooka commented 6 years ago

https://github.com/GoogleCloudPlatform/google-cloud-intellij/issues/1912 looks like this was solved here. So I'll close this for now.