On first deploy laravel app: SQLSTATE[HY000] [2002] Connection refused

I have found my mistake!

I have set a Route::redirect() in my app, which dynamically refers to the last data record of a table. Problem: the routes are all initialized when the application is bootstrapped, i.e. an attempt is made to access a table or DB that probably doesn’t even exist yet.

I have now intercepted the whole thing with try-catch, now this error no longer occurs.

Thanks for your advice anyway!

However, I now get a different error later in the procedure:
failed to solve: failed to compute cache key: "/app/public" not found

I have to say: The directory public is called www for various reasons. I have also already adjusted the Dockerfile below as follows:

COPY --from=node_modules_go_brrr /app/public /var/www/html/public-npm
RUN rsync -ar /var/www/html/public-npm/ /var/www/html/www/ \ #instead of /var/www/html/public/
    && rm -rf /var/www/html/public-npm \
    && chown -R www-data:www-data /var/www/html/www #instead of /var/www/html/public

Does anyone have any ideas?

1 Like