-
Notifications
You must be signed in to change notification settings - Fork 12
/
dispatcher-mount
executable file
·66 lines (53 loc) · 3.49 KB
/
dispatcher-mount
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
VERSION="ams/2.6"
PATH_TO_CONF="etc/httpd"
if [ ! -d $(pwd)/$VERSION/$PATH_TO_CONF/conf ]; then
echo "**** ERROR ****"
echo "This script is supposed to be run in the root directory of the dispatcher project, "
echo "though we could not find a directory ./$VERSION/$PATH_TO_CONF/conf conf from the current directory."
echo "Please change to the projects main directory and try again."
echo ""
exit 1
fi
mkdir logs 2> /dev/null
mkdir cache 2> /dev/null
echo ""
echo "Starting dispatcher, mounting local configuration from ./$VERSION/$PATH_TO_CONF ..."
echo " Open your browser at http://publish.docker.local/content/we-retail/us/en.html "
echo " **** Press Ctrl-C to stop **** "
echo ""
# copy sample we-retail files
cp sample/weretail.vhost $VERSION/etc/httpd/conf.d/available_vhosts
cp sample/weretail_publish_farm.any $VERSION/etc/httpd/conf.dispatcher.d/available_farms/100_weretail_publish_farm.any
cp sample/weretail_filters.any $VERSION/etc/httpd/conf.dispatcher.d/filters
#create and link up default enabled vhosts
if [ ! -d $VERSION/etc/httpd/conf.d/enabled_vhosts ]; then
mkdir $VERSION/etc/httpd/conf.d/enabled_vhosts
fi
ln -Fs ../available_vhosts/aem_author.vhost $VERSION/etc/httpd/conf.d/enabled_vhosts/aem_author.vhost
ln -Fs ../available_vhosts/aem_flush_author.vhost $VERSION/etc/httpd/conf.d/enabled_vhosts/aem_flush_author.vhost
ln -Fs ../available_vhosts/aem_publish.vhost $VERSION/etc/httpd/conf.d/enabled_vhosts/aem_publish.vhost
ln -Fs ../available_vhosts/aem_flush.vhost $VERSION/etc/httpd/conf.d/enabled_vhosts/aem_flush.vhost
ln -Fs ../available_vhosts/aem_health.vhost $VERSION/etc/httpd/conf.d/enabled_vhosts/aem_health.vhost
ln -Fs ../available_vhosts/weretail.vhost $VERSION/etc/httpd/conf.d/enabled_vhosts/weretail.vhost
#create and link up default enabled farms
if [ ! -d $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms ]; then
mkdir $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms
fi
ln -Fs ../available_farms/000_ams_catchall_farm.any $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms/000_ams_catchall_farm.any
ln -Fs ../available_farms/001_ams_author_flush_farm.any $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms/001_ams_author_flush_farm.any
ln -Fs ../available_farms/001_ams_publish_flush_farm.any $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms/001_ams_publish_flush_farm.any
ln -Fs ../available_farms/002_ams_author_farm.any $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms/002_ams_author_farm.any
ln -Fs ../available_farms/002_ams_publish_farm.any $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms/002_ams_publish_farm.any
#set up sample configs
ln -Fs ../available_farms/100_weretail_publish_farm.any $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms/100_weretail_publish_farm.any
docker run -p 80:8080 -p 443:8443 -it --rm \
--mount type=bind,src=$(pwd)/$VERSION/$PATH_TO_CONF/conf,dst=/etc/httpd/conf,readonly=true \
--mount type=bind,src=$(pwd)/$VERSION/$PATH_TO_CONF/conf.d,dst=/etc/httpd/conf.d,readonly=true \
--mount type=bind,src=$(pwd)/$VERSION/$PATH_TO_CONF/conf.dispatcher.d,dst=/etc/httpd/conf.dispatcher.d,readonly=true \
--mount type=bind,src=$(pwd)/$VERSION/$PATH_TO_CONF/conf.modules.d,dst=/etc/httpd/conf.modules.d,readonly=true \
--mount type=bind,src=$(pwd)/logs,dst=/var/log/httpd \
--mount type=bind,src=$(pwd)/cache,dst=/mnt/var/www/html \
--mount type=tmpfs,dst=/tmp \
--env-file scripts/env.sh \
--name mydispatcher dispatcher | cat