-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigureAndInitializeShopware.sh
executable file
·81 lines (66 loc) · 2.28 KB
/
configureAndInitializeShopware.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
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
if [ -z "${PROJECT_HOME}" ]; then
echo "$$PROJECT_HOME must be set!"
exit 1
fi
if [ -z "${DB_HOST}" ]; then
DB_HOST=mysql
fi
if [ -z "${DB_PORT}" ]; then
DB_PORT=3306
fi
if [ -z "${DB_USERNAME}" ]; then
DB_USERNAME=root
fi
if [ -z "${DB_PASSWORD}" ]; then
DB_PASSWORD=root
fi
if [ -z "${DB_DATABASE}" ]; then
DB_DATABASE=test
fi
if [ -z "${WEB_HOST}" ]; then
WEB_HOST=localhost
fi
CONFIG_FILE=${PROJECT_HOME}/config.php
cd ${PROJECT_HOME}
if [ -z "${FORCE_INSTALL}" ] && [ -f recovery/install/data/install.lock ]; then
echo "Installation already done! Skipping!"
else
echo "Waiting for mysql!"
sleep 15
echo "Create database"
mysql -u${DB_USERNAME} -p${DB_PASSWORD} -h${DB_HOST} -e "CREATE DATABASE IF NOT EXISTS ${DB_DATABASE}";
echo "Remove install lock file"
rm -f recovery/install/data/install.lock
echo "Writing config"
printf '%s\n' ",s~'host' => '.*'~'host' => '${DB_HOST}'~g" w q | ed -s "${CONFIG_FILE}"
printf '%s\n' ",s~'port' => '.*'~'port' => '${DB_PORT}'~g" w q | ed -s "${CONFIG_FILE}"
printf '%s\n' ",s~'username' => '.*'~'username' => '${DB_USERNAME}'~g" w q | ed -s "${CONFIG_FILE}"
printf '%s\n' ",s~'password' => '.*'~'password' => '${DB_PASSWORD}'~g" w q | ed -s "${CONFIG_FILE}"
printf '%s\n' ",s~'dbname' => '.*'~'dbname' => '${DB_DATABASE}'~g" w q | ed -s "${CONFIG_FILE}"
echo "Initialize shopware"
# install shopware including database
php recovery/install/index.php \
--no-interaction \
--quiet \
--no-skip-import \
--db-host="${DB_HOST}" \
--db-user="${DB_USERNAME}" \
--db-password="${DB_PASSWORD}" \
--db-name="${DB_DATABASE}" \
--shop-locale="de_DE" \
--shop-host="${WEB_HOST}" \
--shop-name="Testshop" \
--shop-email="[email protected]" \
--shop-currency="EUR" \
--admin-username="admin" \
--admin-password="admin" \
--admin-email="[email protected]" \
--admin-name="admin" \
--admin-locale="de_DE"
RECOVERY_INSTALL_RESULT=$?
echo "Exit code for recovery/install: ${RECOVERY_INSTALL_RESULT}"
fi
chown -R www-data:www-data ${PROJECT_HOME}/
echo "Starting php-fpm in foreground"
exec /usr/local/bin/docker-php-entrypoint $@