-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathentrypoint.sh
executable file
·70 lines (55 loc) · 2.41 KB
/
entrypoint.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
#!/bin/bash
# shellcheck disable=SC1091
set -o errexit
set -o nounset
set -o pipefail
# set -o xtrace # Uncomment this line for debugging purpose
# Load Magento environment
. /opt/bitnami/scripts/magento-env.sh
# Load libraries
. /opt/bitnami/scripts/libbitnami.sh
. /opt/bitnami/scripts/liblog.sh
. /opt/bitnami/scripts/libwebserver.sh
print_welcome_page
if [[ "$MAGENTO_ADMIN_TASK" = "no" && ! -f /bitnami/magento/__INIT_IS_OK__ ]]; then
while [ ! -f /bitnami/magento/__INIT_IS_OK__ ]; do
info "** Magento Still not Initialised, Waiting**"
sleep 60
done
fi
if [[ "$1" = "/opt/bitnami/scripts/magento/run.sh" || "$1" = "/opt/bitnami/scripts/$(web_server_type)/run.sh" || "$1" = "/opt/bitnami/scripts/nginx-php-fpm/run.sh" ]]; then
info "** Starting Magento setup **"
/opt/bitnami/scripts/"$(web_server_type)"/setup.sh
info "** Starting Magento setup php**"
/opt/bitnami/scripts/php/setup.sh
info "** Starting Magento setup mysql**"
/opt/bitnami/scripts/mysql-client/setup.sh
info "** Fix Grant **"
if [[ "$MAGENTO_ADMIN_TASK" = "yes" ]]; then
# Wait for database to be ready (if necessary)
until mysql -h $MAGENTO_DATABASE_HOST -u $MAGENTO_DATABASE_USER -p$MAGENTO_DATABASE_PASSWORD -e "SELECT 1"; do
echo "Waiting for database connection..."
sleep 5
done
# Now apply your GRANT privileges
mysql -h $MAGENTO_DATABASE_HOST -u $MAGENTO_DATABASE_USER -p$MAGENTO_DATABASE_PASSWORD $MAGENTO_DATABASE_NAME <<EOF
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER,
CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW,
CREATE ROUTINE, ALTER ROUTINE, TRIGGER ON $MAGENTO_DATABASE_NAME.*
TO '$MAGENTO_DATABASE_USER'@'%';
FLUSH PRIVILEGES;
EOF
fi
info "** Starting Magento magento **"
#Accelerate the boot for additional tasks by disabling setup:upgrade
if [[ "$MAGENTO_ADMIN_TASK" = "no" ]]; then
sed -i 's/ info "Upgrading database schema"/ info "DISABLE Upgrading database schema"/' /opt/bitnami/scripts/libmagento.sh
sed -i 's/ magento_execute setup:upgrade/ info "DISABLE Upgrading database schema" #magento_execute setup:upgrade/' /opt/bitnami/scripts/libmagento.sh
fi
/opt/bitnami/scripts/magento/setup.sh
info "** Starting Magento post **"
/post-init.sh
info "** Magento setup finished! **"
fi
echo ""
exec "$@"