Skip to content

Commit

Permalink
add healtcheck for php-fpm
Browse files Browse the repository at this point in the history
  • Loading branch information
pdacity committed Apr 12, 2019
1 parent dca4dce commit 0f3d801
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
19 changes: 9 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,23 @@ ENV fpm_conf /etc/php5/php-fpm.conf
ENV fpm_pool /etc/php5/php-fpm.conf

RUN apk add --no-cache nginx php5-fpm php5-gd php5-json php5-dom php5-xml php5-zip
RUN apk add supervisor unzip jq curl
RUN apk add supervisor unzip jq curl

# Configs files
RUN sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" ${php_conf} && \
sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" ${php_conf} && \
sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 100M/g" ${php_conf} && \
sed -i -e "s/variables_order = \"GPCS\"/variables_order = \"EGPCS\"/g" ${php_conf}

RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" ${fpm_conf}

RUN sed -i -e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm.sock/g" ${fpm_pool} && \
sed -i -e "s/variables_order = \"GPCS\"/variables_order = \"EGPCS\"/g" ${php_conf} && \
sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" ${fpm_conf} && \
sed -i -e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm.sock/g" ${fpm_pool} && \
sed -i -e "s/;listen.owner = nobody/listen.owner = nginx/g" ${fpm_pool} && \
sed -i -e "s/;listen.group = nobody/listen.group = nginx/g" ${fpm_pool} && \
sed -i -e "s/user = nobody/user = nginx/g" ${fpm_pool} && \
sed -i -e "s/group = nobody/group = nginx/g" ${fpm_pool}
sed -i -e "s/group = nobody/group = nginx/g" ${fpm_pool} && \
sed -i -e "s/;ping.path = \/ping/ping.path = \/fpm-ping/g" ${fpm_conf} && \
sed -i -e "s/;pm.status_path = \/status/pm.status_path = \/fpm-status/g" ${fpm_conf}


# Disable run nginx in daemon mode
RUN echo "daemon off;" >> ${nginx_conf}

RUN mkdir -p /var/lib/php/session && \
chown -R nginx:nginx /var/lib/php/session

Expand Down Expand Up @@ -56,5 +53,7 @@ RUN cd /tmp/ && \

EXPOSE 80

HEALTHCHECK --timeout=2s CMD curl --silent --fail http://127.0.0.1/fpm-ping

CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]

7 changes: 5 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ version: '2.4'

services:
bludit:
image: pdacity/bludit_docker
build: ./
container_name: bludit
volumes:
- html:/var/www # Bludit home
- nginx:/etc/nginx #Nginx config
- nginx:/etc/nginx # Nginx config
ports:
- 8080:80
restart: always
cpu_shares: 50
mem_limit: 64m
Expand Down

0 comments on commit 0f3d801

Please sign in to comment.