Open cesarjorgemartinez opened 7 years ago
Just to mention that the OnPremise framework has implemented a fix for this, based in tunning the entriypoint for perseo-fe instances in the docker compose .yml file.
Thus, in the OnPremise deployment the problem is solved, although the present issue stills having sense, as a pending fix for non-OnPremise deployments (note that Perseo dockers could be used outside OnPremise also).
I solve the issue by setting restart: on-failure for the perseo-fe service in docker-compose.yml not the cleanest way, but it works !
Docker sometimes when startup the perseo-core start slower than perseo-fe and fail with ECONNECTREFUSED (perseo-fe needs perseo-core startup process)
An analysis is performed and a synchronization between perseo-core and perseo-fe But this sync has a cost
Other better option is add a minimal delay in perseo-fe startup. Here we can do the following options:
Inside Dockerfile replace: CMD bin/perseo by CMD sleep 0.5 && bin/perseo
Replace CMD by an entrypoint script and inside this script, before the bin/perseo startup insert a timeout check:
The sh
echo "INFO: perseo-fe entrypoint start"
Use this environment variable:
PERSEO_CORE_URL=http://${PERSEOCORE_HOST}:${PERSEOCORE_PORT_CONT}
Use curl or tcping to check
Current time in seconds
STARTTIME=$(date +%s) while ! tcping -q -t 1 ${PERSEOCORE_HOST} ${PERSEOCORE_PORT_CONT} do [[ $(($(date +%s) - ${DBTIMEOUT})) -lt ${STARTTIME} ]] || { echo "ERROR: Timeout perseo-core endpoint <${PERSEO_CORE_URL}> Exceeds <${DBTIMEOUT}" >&2; exit 3; } echo "INFO: Wait for perseo-core endpoint <${PERSEO_CORE_URL}>" sleep 2 done echo "INFO: It took $(($(date +%s) - ${STARTTIME})) seconds to startup"
echo "INFO: Starting perseo-fe..." bin/perseo