I have 3 different Ubuntu droplets with Docker on Digital Ocean. They are all running Caddy as proxy with 2 of them using PHP-FPM and 1 using PHP-FPM Alpine.
After the server has been running a while, sometimes a few days, sometimes 3-4 weeks, the request stops responding.
All has the same type of problem.
I can SSH into the droplet. The caddy seems to be running all fine. I can access everything through caddy that is not the PHP.
The interessting part from the Caddy Docker log is this:
{
"level": "error",
"logger": "http.log.error",
"msg": "dialing backend: dial tcp 172.30.0.3:9000: i/o timeout",
"duration": 3.014910236,
"status": 502,
"err_id": "j14574vxr",
"err_trace": "reverseproxy.statusError (reverseproxy.go:1196)"
}
If I do a docker logs -f PHP_CONTAINER all I can see is a valid request from the time before PHP stopped responding.
If i restart only the PHP container it starts working again. The strange part is that if I ONLY do a restart of CADDY container it will also start working.
I didn't seem to have this problem with NGINX earlier. So I my initial thought was that CADDY was the problem. But I do get connection to other services on the same Docker server. For instance PHP-FPM service doesn't respond, but my phpMyAdmin service is still working.
The caddy file is like this:
mydomain.com {
root * /var/www/public
php_fastcgi /* php:9000
file_server
}
The PHP-FPM Dockerfile is like this:
FROM php:8.1.6-fpm
ARG user
ARG uid
RUN apt-get update && apt-get install -y \
curl \
zip \
unzip
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
r
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user
WORKDIR /var/www
USER $user
I have tried multiple versions of PHP-FPM, it still happening.
For my WordPress site, using the FPM-Alpine version, I basically use the same Dockerfile as this (some smaller modifications only) https://github.com/docker-library/wordpress/blob/master/latest/php8.1/fpm-alpine/Dockerfile
Does anyone has tips to what I can try to figure out why this error keeps happening.