Skip to content

Commit

Permalink
Merge pull request #17 from devilbox/release-0.22
Browse files Browse the repository at this point in the history
Allow for global overwritable vhost-gen templates
  • Loading branch information
cytopia authored Aug 5, 2018
2 parents 7041a02 + 24a3a90 commit 9e3c097
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ rebuild: pull
docker build --no-cache -t $(image) .
cd build; ./gen-readme.sh $(image)

tag:
docker tag $(image) $(image):$(ARG)

test:
.ci/start-ci.sh $(image) $(ARG)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ This Docker container adds a lot of injectables in order to customize it to your
| /etc/httpd-custom.d | Mount this directory to add outside configuration files (`*.conf`) to Apache |
| /var/www/default | Apache default virtual host base path (contains by default `htdocs/` and `cfg/` |
| /shared/httpd | Apache mass virtual host root directory |
| /etc/vhost-gen.d | [vhost-gen](https://github.com/devilbox/vhost-gen) directory for custom templates. Copy and customize [apache22.yml](https://github.com/devilbox/vhost-gen/blob/master/etc/templates/apache22.yml) into this mounted directory for global vhost customizations |


#### Default ports
Expand Down
22 changes: 22 additions & 0 deletions data/docker-entrypoint.d/07-vhost-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,28 @@ set -o pipefail
# Functions
############################################################

###
### Copy custom vhost-gen template
###
vhost_gen_copy_custom_template() {
local input_dir="${1}"
local output_dir="${2}"
local template_name="${3}"
local debug="${4}"

if [ ! -d "${input_dir}" ]; then
run "mkdir -p ${input_dir}" "${debug}"
fi

if [ -f "${input_dir}/${template_name}" ]; then
log "info" "vhost-gen: applying customized global template: ${template_name}" "${debug}"
run "cp ${input_dir}/${template_name} ${output_dir}/${template_name}" "${debug}"
else
log "info" "vhost-gen: no customized template found" "${debug}"
fi
}


###
### Set PHP_FPM
###
Expand Down
8 changes: 8 additions & 0 deletions data/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ CA_CRT=/ca/devilbox-ca.crt

# Path to scripts to source
CONFIG_DIR="/docker-entrypoint.d"
VHOST_GEN_DIR="/etc/vhost-gen/templates"
VHOST_GEN_CUST_DIR="/etc/vhost-gen.d"


# Wait this many seconds to start watcherd after httpd has been started
Expand Down Expand Up @@ -123,6 +125,12 @@ fi
## vhost-gen Configuration
#############################################################

###
### Copy custom vhost-gen template
###
vhost_gen_copy_custom_template "${VHOST_GEN_CUST_DIR}" "${VHOST_GEN_DIR}" "apache22.yml" "${DEBUG_LEVEL}"


###
### Enable and configure PHP-FPM
###
Expand Down

0 comments on commit 9e3c097

Please sign in to comment.