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 -  io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use
        at io.netty.channel.unix.Errors.newIOException(Errors.java:117)
        at io.netty.channel.unix.Socket.bind(Socket.java:234)
        at io.netty.channel.epoll.EpollServerSocketChannel.doBind(EpollServerSocketChannel.java:91)
        at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:554)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1258)
        at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501)
        at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486)
        at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.j
ava:980)
	at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:250)
	at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:365
)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEv
entExecutor.java:163)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(Single
ThreadEventExecutor.java:403)
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:304)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThread
EventExecutor.java:858)
	at ratpack.exec.internal.DefaultExecController$ExecControllerBindingThre
adFactory.lambda$newThread$0(DefaultExecController.java:136)
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorato
r.run(DefaultThreadFactory.java:144)
	at java.lang.Thread.run(Thread.java:748)

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.