fixed the pbm of wp cron job not working
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
# then install as recommended : curl -SL https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
|
# then install as recommended : curl -SL https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
|
||||||
# or (neat) : https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
|
# or (neat) : https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
|
||||||
|
|
||||||
version: "3.8"
|
#version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
@@ -75,6 +75,10 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
mariadb:
|
mariadb:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
# i was trying to resolve the wp_cron not working, I used the 'crontrol' plugin, it informed me curl didn't work, so i tried in the wordpress docker : 'curl <url of my local website>' and indeed it failed. I finally added this mapping to my /etc/hosts file in the wordpress container '172.17.0.1 <url of my local website>' (but i'm not sure '172.17.0.1' will always work, it seems to be constant for the default bridge network : https://docs.docker.com/network/network-tutorial-standalone/)
|
||||||
|
# https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach?rq=2
|
||||||
|
# extra_hosts:
|
||||||
|
# - "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
# specify path to named volumes : https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
|
# specify path to named volumes : https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
|
||||||
# local driver options : https://stackoverflow.com/questions/62232676/docker-local-volume-driver-options
|
# local driver options : https://stackoverflow.com/questions/62232676/docker-local-volume-driver-options
|
||||||
@@ -104,6 +108,7 @@ volumes:
|
|||||||
# o: "bind"
|
# o: "bind"
|
||||||
# device: ${HOST_VOLUME_ERROR_LOGS}
|
# device: ${HOST_VOLUME_ERROR_LOGS}
|
||||||
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
local-wp:
|
local-wp:
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
FROM alpine:3.15
|
FROM alpine:3.15
|
||||||
|
|
||||||
RUN apk update
|
RUN apk update
|
||||||
@@ -49,4 +48,3 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli
|
|||||||
COPY ./conf/wp_entrypoint.sh ./
|
COPY ./conf/wp_entrypoint.sh ./
|
||||||
|
|
||||||
ENTRYPOINT [ "sh", "wp_entrypoint.sh" ]
|
ENTRYPOINT [ "sh", "wp_entrypoint.sh" ]
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,18 @@ RESET="\e[0m"
|
|||||||
|
|
||||||
# it gets the ENV variables from .env because specified in the docker-compose.yml file
|
# it gets the ENV variables from .env because specified in the docker-compose.yml file
|
||||||
|
|
||||||
|
|
||||||
|
# this is to make the wp_cron job works
|
||||||
|
# ! it might not be a very strong solution
|
||||||
|
#
|
||||||
|
# somehow it didn't work if the local adress is not accessible from inside the wordpress container :
|
||||||
|
# if : `curl <PROJECT_URL>` don't work, the cron job does not either (why ?)
|
||||||
|
# to make it work, i mapped the docker network gateway ip to the url (without understanding what i'm doing)
|
||||||
|
# the default network is named bridge, and it's gateway is 172.17.0.1 : https://docs.docker.com/network/network-tutorial-standalone/
|
||||||
|
# also might help, even though i didn't use, it helped me find the ip 172.17.0.1 : https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach?rq=2
|
||||||
|
echo "172.17.0.1 ${PROJECT_URL}" >> /etc/hosts
|
||||||
|
|
||||||
|
|
||||||
# install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/
|
# install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/
|
||||||
# commands : https://developer.wordpress.org/cli/commands/
|
# commands : https://developer.wordpress.org/cli/commands/
|
||||||
# bug with wp commands : https://github.com/wp-cli/config-command/issues/31
|
# bug with wp commands : https://github.com/wp-cli/config-command/issues/31
|
||||||
|
|||||||
Reference in New Issue
Block a user