Skip to content

Commit e2e3580

Browse files
authored
Merge pull request #17 from devilbox/release-0.22
Allow for global overwritable vhost-gen templates
2 parents 3cd9427 + 9722050 commit e2e3580

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ rebuild: pull
1414
docker build --no-cache -t $(image) .
1515
cd build; ./gen-readme.sh $(image)
1616

17+
tag:
18+
docker tag $(image) $(image):$(ARG)
19+
1720
test:
1821
.ci/start-ci.sh $(image) $(ARG)
1922

README.md

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

165166

166167
#### Default ports

data/docker-entrypoint.d/07-vhost-gen.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,28 @@ set -o pipefail
99
# Functions
1010
############################################################
1111

12+
###
13+
### Copy custom vhost-gen template
14+
###
15+
vhost_gen_copy_custom_template() {
16+
local input_dir="${1}"
17+
local output_dir="${2}"
18+
local template_name="${3}"
19+
local debug="${4}"
20+
21+
if [ ! -d "${input_dir}" ]; then
22+
run "mkdir -p ${input_dir}" "${debug}"
23+
fi
24+
25+
if [ -f "${input_dir}/${template_name}" ]; then
26+
log "info" "vhost-gen: applying customized global template: ${template_name}" "${debug}"
27+
run "cp ${input_dir}/${template_name} ${output_dir}/${template_name}" "${debug}"
28+
else
29+
log "info" "vhost-gen: no customized template found" "${debug}"
30+
fi
31+
}
32+
33+
1234
###
1335
### Set PHP_FPM
1436
###

data/docker-entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ CA_CRT=/ca/devilbox-ca.crt
2121

2222
# Path to scripts to source
2323
CONFIG_DIR="/docker-entrypoint.d"
24+
VHOST_GEN_DIR="/etc/vhost-gen/templates"
25+
VHOST_GEN_CUST_DIR="/etc/vhost-gen.d"
2426

2527

2628
# Wait this many seconds to start watcherd after httpd has been started
@@ -123,6 +125,12 @@ fi
123125
## vhost-gen Configuration
124126
#############################################################
125127

128+
###
129+
### Copy custom vhost-gen template
130+
###
131+
vhost_gen_copy_custom_template "${VHOST_GEN_CUST_DIR}" "${VHOST_GEN_DIR}" "apache22.yml" "${DEBUG_LEVEL}"
132+
133+
126134
###
127135
### Enable and configure PHP-FPM
128136
###

0 commit comments

Comments
 (0)