gajus/lightship

Port is random and I cant force it with the config

Closed this issue · 1 comments

Hello,

I try to use lightship in my project but I have a problem with the lightship HTTP port. It seems it is set randomly at service startup. I try to force it with the env var LIGHTSHIP_PORT or with the port config but, at all cases the used port is random :

const { createLightship } = require('lightship');

const lightship = createLightship({
    port : 9000,
});

lightship.queueBlockingTask(new Promise((resolve) => {
    setTimeout(() => {
        // Lightship service status will be `SERVER_IS_NOT_READY` until all promises
        // submitted to `queueBlockingTask` are resolved.
        resolve();
    }, 1000);
}));

module.exports = lightship;
{"context":{"package":"lightship","namespace":"factories/createLightship","logLevel":40},"message":"shutdown handlers are not used in the local mode","sequence":"0","time":1643961907523,"version":"2.0.0"}
{"context":{"package":"lightship","namespace":"factories/createLightship","logLevel":30},"message":"Lightship HTTP service is running on port 50848","sequence":"1","time":1643961908137,"version":"2.0.0"}
listening on port 8085
{"context":{"package":"lightship","namespace":"factories/createLightship","logLevel":30},"message":"signaling that the server is ready","sequence":"2","time":1643961908140,"version":"2.0.0"}
{"context":{"package":"lightship","namespace":"factories/createLightship","logLevel":20},"message":"service will not become immediately ready because there are blocking tasks","sequence":"3","time":1643961908140,"version":"2.0.0"}
{"context":{"package":"lightship","namespace":"factories/createLightship","logLevel":30},"message":"service became available for the first time","sequence":"4","time":1643961908526,"version":"2.0.0"}

Ok I find this : I try to test this in local mode, without kubernetes. In that case, I have to set the detectKubernetes param to false.

Sorry for that