wip trying to get better volume controle and an error log volume
This commit is contained in:
1
Makefile
1
Makefile
@@ -99,6 +99,7 @@ down:
|
|||||||
|
|
||||||
|
|
||||||
# list images, containers, volumes
|
# list images, containers, volumes
|
||||||
|
# better idea for binded volumes ? https://stackoverflow.com/a/59679551/9497573
|
||||||
list:
|
list:
|
||||||
@echo $(B_YELLOW)"\nimages:"$(RESET)
|
@echo $(B_YELLOW)"\nimages:"$(RESET)
|
||||||
@docker images -a
|
@docker images -a
|
||||||
|
|||||||
45
notes.md
45
notes.md
@@ -5,3 +5,48 @@
|
|||||||
- `docker logs <container_name>` to see the logs on standard output of a container
|
- `docker logs <container_name>` to see the logs on standard output of a container
|
||||||
- `docker ps` to list the container, and see their names
|
- `docker ps` to list the container, and see their names
|
||||||
|
|
||||||
|
#### todo :
|
||||||
|
|
||||||
|
- **VOLUMES :** it still not clear the better way to deal with volumes :
|
||||||
|
- if i use named bind volumes with :
|
||||||
|
```
|
||||||
|
services:
|
||||||
|
wordpress:
|
||||||
|
volumes:
|
||||||
|
- wp_plugin:/path/inside/container
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
wp_plugins:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: "bind"
|
||||||
|
device: /path/on/local/machine
|
||||||
|
```
|
||||||
|
- the folder on host has its ownerships changed, because it's recreated by docker
|
||||||
|
- so the pbm is that if the plugin folder has no content yet, you need to use sudo to change its owner back to the user
|
||||||
|
- instead i can use bind mount like in this answer :
|
||||||
|
- https://stackoverflow.com/questions/77949712/docker-compose-ownership-of-named-bind-volume-with-specified-path?noredirect=1#comment137421603_77949712
|
||||||
|
```
|
||||||
|
- /path/on/local/machine:/path/inside/container
|
||||||
|
```
|
||||||
|
- but if i do it with mariadb volume, container mariadb cannot work anymore
|
||||||
|
- i dont have time to understand why, but certainly it doesn't have the appropriates rights anymore
|
||||||
|
- and anyway what is the difference with this :
|
||||||
|
- https://docs.docker.com/storage/bind-mounts/
|
||||||
|
- https://docs.docker.com/compose/compose-file/compose-file-v3/#volumes
|
||||||
|
```
|
||||||
|
- type: bind
|
||||||
|
source: ./static
|
||||||
|
target: /opt/app/static
|
||||||
|
```
|
||||||
|
- **ERRORS LOG :** it would be better to have a way to see all the error logs from all containers
|
||||||
|
maybe with a volume for logs
|
||||||
|
- in the meantime, here are the logs :
|
||||||
|
- wordpress : /var/www/html/wp-content/
|
||||||
|
as precised in the wp-config.php file with DEBUG_LOGS variable,
|
||||||
|
that i create in wp_entrypoint.sh
|
||||||
|
- mariadb :
|
||||||
|
- nginx :
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- wp_volume:${WP_VOLUME_DIR}
|
- wp_volume:${WP_VOLUME_DIR}
|
||||||
- wp_plugins:${WP_VOLUME_PLUGINS}
|
- wp_plugins:${WP_VOLUME_PLUGINS}
|
||||||
- error_logs:${ERRORS_LOGS_VOLUME}
|
|
||||||
build:
|
build:
|
||||||
context: ./requirements/wordpress
|
context: ./requirements/wordpress
|
||||||
args:
|
args:
|
||||||
@@ -98,12 +97,12 @@ volumes:
|
|||||||
type: none
|
type: none
|
||||||
o: "bind"
|
o: "bind"
|
||||||
device: ${HOST_VOLUME_PLUGINS}
|
device: ${HOST_VOLUME_PLUGINS}
|
||||||
error_logs:
|
# error_logs:
|
||||||
driver: local
|
# driver: local
|
||||||
driver_opts:
|
# driver_opts:
|
||||||
type: none
|
# type: none
|
||||||
o: "bind"
|
# o: "bind"
|
||||||
device: ${HOST_VOLUME_ERROR_LOGS}
|
# device: ${HOST_VOLUME_ERROR_LOGS}
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
inception:
|
inception:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ PROJECT_PORT=443
|
|||||||
SERVER_EXECUTION_TIME=300
|
SERVER_EXECUTION_TIME=300
|
||||||
SERVER_MAX_UPLOAD_SIZE=512
|
SERVER_MAX_UPLOAD_SIZE=512
|
||||||
|
|
||||||
ERRORS_LOGS_VOLUME=/var/log
|
#ERRORS_LOGS_VOLUME=/var/log
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
@@ -88,6 +88,6 @@ HOST_VOLUME_DB=${HOST_VOLUMES_DIR}/db_volume
|
|||||||
# we put the plugin folder inside the parent folder of the docker dir
|
# we put the plugin folder inside the parent folder of the docker dir
|
||||||
HOST_VOLUME_PLUGINS=${HOST_DOCKER_PARENT_PATH}/plugins
|
HOST_VOLUME_PLUGINS=${HOST_DOCKER_PARENT_PATH}/plugins
|
||||||
# error log
|
# error log
|
||||||
HOST_VOLUME_ERROR_LOGS=${HOST_VOLUMES_DIR}/error_logs
|
#HOST_VOLUME_ERROR_LOGS=${HOST_VOLUMES_DIR}/error_logs
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ echo -e ${YELLOW}configuring the error logs...${RESET}
|
|||||||
# Enable WP_DEBUG mode
|
# Enable WP_DEBUG mode
|
||||||
php wp-cli.phar config set WP_DEBUG true --raw --path=${WP_VOLUME_DIR}
|
php wp-cli.phar config set WP_DEBUG true --raw --path=${WP_VOLUME_DIR}
|
||||||
# Enable Debug logging to a file (if set to true, this is the /wp-content/debug.log file)
|
# Enable Debug logging to a file (if set to true, this is the /wp-content/debug.log file)
|
||||||
#php wp-cli.phar config set WP_DEBUG_LOG '/var/log/tmp_errors.log' --path=${WP_VOLUME_DIR}
|
php wp-cli.phar config set WP_DEBUG_LOG true --raw --path=${WP_VOLUME_DIR}
|
||||||
php wp-cli.phar config set WP_DEBUG_LOG "${ERRORS_LOGS_VOLUME}/wp_error.log" --path=${WP_VOLUME_DIR}
|
#php wp-cli.phar config set WP_DEBUG_LOG "${ERRORS_LOGS_VOLUME}/wp_error.log" --path=${WP_VOLUME_DIR}
|
||||||
# Disable display of errors and warnings
|
# Disable display of errors and warnings
|
||||||
php wp-cli.phar config set WP_DEBUG_DISPLAY false --raw --path=${WP_VOLUME_DIR}
|
php wp-cli.phar config set WP_DEBUG_DISPLAY false --raw --path=${WP_VOLUME_DIR}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user