#!/bin/bash PROJECT_NAME="jipf" PROJECT_URL="local_lejourduprof.com" PROJECT_PORT=443 # change execution_time and max_upload_size, in wp and nginx SERVER_EXECUTION_TIME=300 SERVER_MAX_UPLOAD_SIZE=512 #ERRORS_LOGS_VOLUME=/var/log # ---------------------------------------------------------------------- # NGINX SETUP NG_CERTS_DIR=/etc/ssl # ---------------------------------------------------------------------- # MARIADB SETUP DB_VOLUME_DIR=/var/lib/mysql DB_HOST=mariadb DB_NAME=db_wp_${PROJECT_NAME} DB_USER=user_wp_${PROJECT_NAME} DB_PSWD="you dont want to know" # ---------------------------------------------------------------------- # WORDPRESS SETUP WP_URL=${PROJECT_URL} WP_PORT=${PROJECT_PORT} # concat url with port if not 443 WP_COMPLETE_URL="${WP_URL}" if [ ! ${WP_PORT} -eq 443 ]; then WP_COMPLETE_URL="${WP_URL}:${WP_PORT}" fi WP_VOLUME_DIR=/var/www/html WP_VOLUME_PLUGINS=/home/www-data WP_TITLE=title WP_ADMIN=admin WP_ADMIN_PSWD="you shall not password !" WP_ADMIN_EMAIL=admin@email.fr # ---------------------------------------------------------------------- # LOCAL VOLUMES # if you want to get the home directory you can use $(HOME) # however, this will not give the same result if you use sudo, ex : # ./create_env : /home/asususus # sudo ./create_env : /root # but you can use this command `eval echo "~$SUDO_USER"` to get # the home directory of the user using sudo, it works in non-sudo also : # - echo "$SUDO_USER" : # - in normal mode it outputs : "" # - in sudo mode it outputs the user : "username" # - same as $USER in normal mode # - echo "~$SUDO_USER" : # - in linux "~USER" is the home directory of a user # - but echo "something" will treat ~ as a string litteral # - so the output in mormal mode will be : "~" # - and in sudo mode it will be : "~username" # - eval echo "~$SUDO_USER" : # - eval will evaluate the expression and perform expansion one more time # - so it will evaluate the output of `echo "~$SUDO_USER"` # - in normal mode : # - it will evaluate : "~" # - and ouptput : "/home/username" # - in sudo mode : # - it will evaluate : "~username" # - and output : "/home/username" # - because "~username" expand in the home (~) directory of given user # https://stackoverflow.com/questions/77088135/makefile-subst-doesnt-use-make-variable-as-expected HOST_HOME_PATH=$(eval echo "~$SUDO_USER") # path to the docker folder containing the srcs/ dir HOST_DOCKER_PATH=$(realpath ${DIR_PATH}/..) HOST_DOCKER_PARENT_PATH=$(realpath ${DIR_PATH}/../..) # makefile will create the volumes folders # we put them inside a volumes/ dir, sibling to the srcs/ dir # there can be only one variable named "HOST_VOLUMES_DIR", or change the Makefile HOST_VOLUMES_DIR=${HOST_DOCKER_PATH}/volumes HOST_VOLUME_WP=${HOST_VOLUMES_DIR}/wp_volume HOST_VOLUME_DB=${HOST_VOLUMES_DIR}/db_volume # we put the plugin folder inside the parent folder of the docker dir HOST_VOLUME_PLUGINS=${HOST_DOCKER_PARENT_PATH}/plugins # error log #HOST_VOLUME_ERROR_LOGS=${HOST_VOLUMES_DIR}/error_logs