Remote Build Cache node configure port number

I’m trying to configure and run one of the remote task cache nodes. We’ve discovered it doesn’t always work. And the problem is the build cache node process doesn’t start properly due to the following error:

2017-08-03 16:11:17,774 ERROR c.g.b.n.BuildCacheNodeMain {} Startup failure -$NativeIoException: bind(..) failed: Address already in use
	at io.netty.bootstrap.AbstractBootstrap$
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEv
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(Single
	at io.netty.util.concurrent.SingleThreadEventExecutor$
	at ratpack.exec.internal.DefaultExecController$ExecControllerBindingThre
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorato

So the two things I would like to know are:

  • Is the port number used by the build-cache-node process itself configurable in any way?
  • When this error occurs, the process keeps running, supervisord still sees the process as running correctly, but the nginx process can’t connect to it. The whole process is in this weird, active, but not useful, state.

When you say “doesn’t alway” can you elaborate. Are you starting and stopping the same container or creating a new one. Since this is running in a Docker container there should be nothing else conflicting on that port. It’s the externally bound port that might be an issue.

The build-cache-node process writes the above error message in to the node.log, and the nginx front end return a 503, bad gateway error for all of the accesses.

I’m not running the supplied docker image due to internal company policy. So I’m hoping to run the build-cache-node process + nginx as configured in the docker image. But the fixed port for the build-cache-node is causing things to break.

Ah, this is the bit I was missing.

So yes, you can change the default port by specifying the PORT environment variable. Set this to whatever you like but you’ll also need to change the nginx config to proxy to the new port.

This is like a light shining down from heaven. This clears up a number of questions that came up during our testing. Thank you very much.