more debugs messages on wp installation

This commit is contained in:
asus
2023-09-03 17:37:23 +02:00
parent 80aa4b7f4a
commit a1532e1873
4 changed files with 17 additions and 18 deletions

View File

@@ -84,6 +84,10 @@ fclean: fclean-images fclean-volumes
re: fclean all
# !! remove everything everything
erase_v:
- rm -rf $(VOLUMES_D)
new: erase_v re
.PHONY : all $(VOLUMES_D) build up list clean fclean re
.PHONY : all $(VOLUMES_D) build up list clean fclean re erase_v new

View File

@@ -6,7 +6,6 @@
- 2. docker
- 2.1. install docker
- 2.2. docker ressources
- 2.3. docker pid 1
- 3. old versions
- 3.1. v1 2022
- 3.1.1. todo
@@ -46,8 +45,6 @@
- [docker engine vs docker desktop](https://docs.docker.com/desktop/faqs/linuxfaqs/#what-is-the-difference-between-docker-desktop-for-linux-and-docker-engine)
- [manage docker as non root user](https://docs.docker.com/engine/install/linux-postinstall/)
## 2.2. docker ressources
- [docker compose man](https://docs.docker.com/compose/compose-file/#volumes)
@@ -71,19 +68,6 @@
- [pass secret to container](https://medium.com/@zdk/simple-and-secure-way-to-pass-secrets-and-credentials-into-docker-containers-c2f66175b0a4)
## 2.3. docker pid 1
- nginx by default will create some child process (a master and some workers), then it quits (doc ?)
- when the first process of a docker container exit, the container exit (doc ?)
- so we must tell nginx to not go background : "-g 'daemon off'"
- [pid1 docker problem](https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/)
- [official nginx docker image](https://hub.docker.com/_/nginx/)
- "If you add a custom CMD in the Dockerfile, be sure to include -g daemon off; in the CMD in order for nginx to stay in the foreground, so that Docker can track the process properly (otherwise your container will stop immediately after starting)!"
- [SO discussion on "-g 'daemon off'"](https://stackoverflow.com/questions/18861300/how-to-run-nginx-within-a-docker-container-without-halting)
- "When PID 1 exits, the container will exit" (where is says in the doc ?)
- ["By design, containers started in detached mode exit when the root process used to run the container exits"](https://docs.docker.com/engine/reference/run/#detached--d)
---
# 3. old versions
@@ -187,3 +171,4 @@
- [google maps api url parameters](https://developers.google.com/maps/documentation/javascript/url-params)
- [google maps api references](https://developers.google.com/maps/documentation/javascript/reference)
- [remove marker cluster](https://googlemaps.github.io/js-markerclusterer/classes/MarkerClusterer.html#removeMarker)

View File

@@ -39,7 +39,7 @@ COPY ./conf/ssl ${NG_VOLUME_CERTS}
RUN if [ -z "$(ls -A ${NG_VOLUME_CERTS} 2>/dev/null)" ]; then \
mkdir ${NG_VOLUME_CERTS}/private ${NG_VOLUME_CERTS}/certs; \
openssl req -newkey rsa:2048 -nodes -x509 -days 365 \
-subj "/C=fr/ST=ile-de-france/L=paris/O=42/OU=lejourdesprofs/CN=${WP_URL}" \
-subj "/C=fr/ST=ile-de-france/L=paris/O=ljdp/OU=lejourdesprofs/CN=${WP_URL}" \
-keyout ${NG_VOLUME_CERTS}/private/${WP_URL}.key \
-out ${NG_VOLUME_CERTS}/certs/${WP_URL}.crt; \
fi

View File

@@ -16,6 +16,7 @@ RESET="\e[0m"
echo -e ${YELLOW}download wordpress :${RESET}
if ! wp core version --path="${WP_VOLUME_DIR}" 2> /dev/null
then
echo -e ${YELLOW}-> wordpress version${RESET}
mkdir -p ${WP_VOLUME_DIR}
wp core download --path="${WP_VOLUME_DIR}" --allow-root
else
@@ -76,12 +77,15 @@ fi
if ! wp core is-installed --path="${WP_VOLUME_DIR}" 2> /dev/null
then
echo -e ${YELLOW}installing...${RESET}
echo -e ${YELLOW}wp config create...${RESET}
wp config create \
--dbhost="${DB_HOST}" \
--dbname="${DB_NAME}" \
--dbuser="${DB_USER}" \
--dbpass="${DB_PSWD}" \
--path="${WP_VOLUME_DIR}" --allow-root
echo -e ${YELLOW}wp core install...${RESET}
wp core install \
--url="${WP_URL}" \
--title="${WP_TITLE}" \
@@ -90,18 +94,24 @@ then
--admin_password="${WP_ADMIN_PSWD}" \
--skip-email \
--path="${WP_VOLUME_DIR}" --allow-root
echo -e ${YELLOW}wp user create...${RESET}
wp user create \
"${WP_USER}" "${WP_USER_EMAIL}" \
--user_pass="${WP_USER_PSWD}" \
--path="${WP_VOLUME_DIR}" --allow-root
echo -e ${YELLOW}chown and chmod...${RESET}
chown -R www-data:www-data /var/www/*
chmod 755 -R /var/www/*
echo -e ${YELLOW}plugins...${RESET}
plugins=$(ls ${WP_VOLUME_PLUGINS})
for dir in $plugins; do
ln -s ${WP_VOLUME_PLUGINS}/$dir ${WP_VOLUME_DIR}/wp-content/plugins/$dir
done
echo -e ${GREEN}done !${RESET}
else
echo -e ${GREEN}wp is installed${RESET}
fi