-
Notifications
You must be signed in to change notification settings - Fork 7
/
docker-compose_ezpinstall.sh
executable file
·69 lines (57 loc) · 2.32 KB
/
docker-compose_ezpinstall.sh
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
66
67
68
69
#!/bin/bash
export COMPOSE_PROJECT_NAME=ezpublishdocker
CONFIGFILE=files/docker-compose.config
YMLFILE="docker-compose_ezpinstall.yml"
CMDPARAMETERS="$@"
# Check for parameter "-c alternative-config.file.config"
function set_composeconfig
{
local value
value=0
for i in "$@"; do
if [ $i == "-c" ]; then
value=1
continue
fi
if [ $value == 1 ]; then
value=0
CONFIGFILE=$i
echo Config file overriden. Using $CONFIGFILE instead
continue
fi
CMDPARAMETERS="$CMDPARAMETERS $i"
done
}
set_composeconfig "$@"
# Load default settings
source files/docker-compose.config-EXAMPLE
# Load custom settings
source $CONFIGFILE
if [ ! -f files/auth.json ]; then
touch files/auth.json
fi
if [ ! -f files/kickstart_template.ini ]; then
touch files/kickstart_template.ini
fi
# If {COMPOSE_EXECUTION_PATH} is not set and docker-compose is not in path, we'll test if it is located in /opt/bin. Needed for systemd service
if [ "$COMPOSE_EXECUTION_PATH" == "" ]; then
if [ ! `which ${COMPOSE_EXECUTION_PATH}docker-compose > /dev/null` ]; then
if [ -x "/opt/bin/docker-compose" ]; then
COMPOSE_EXECUTION_PATH="/opt/bin/"
fi
fi
fi
if [ "$SYMFONY_ENV" = "dev" ]; then
YMLFILE="docker-compose_ezpinstall_dev.yml"
fi
${COMPOSE_EXECUTION_PATH}docker-compose -f $YMLFILE $CMDPARAMETERS up --no-recreate
# Unless user has provided install to use in volume folder, install from composer
if [ ! -f volumes/ezpublish/composer.json ]; then
echo "No prior install detected in ezpublish folder, so running Composer with: composer --no-interaction create-project ${EZ_COMPOSERPARAM?}"
${COMPOSE_EXECUTION_PATH}docker-compose -f $YMLFILE $CMDPARAMETERS run --rm ezphp composer --no-interaction create-project --no-progress ${EZ_COMPOSERPARAM?};
${COMPOSE_EXECUTION_PATH}docker-compose -f $YMLFILE $CMDPARAMETERS run --rm ezphp composer dump-autoload --optimize;
${COMPOSE_EXECUTION_PATH}docker-compose -f $YMLFILE $CMDPARAMETERS run --rm ezphp bash -c "if [ -f /var/www/bin/vhost.sh ]; then chmod a+x /var/www/bin/vhost.sh; fi"
${COMPOSE_EXECUTION_PATH}docker-compose -f $YMLFILE $CMDPARAMETERS rm -v -f composercachevol ezphp
else
echo "Prior install detected in ezpublish folder, skipp running Composer"
fi