2017-02-17 08:45:48 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2017-02-17 10:28:42 +00:00
|
|
|
mkdir -p /run/php/sessions
|
|
|
|
|
2017-02-17 08:45:48 +00:00
|
|
|
if ! [ -f /app/data/.installed ]; then
|
2019-04-04 17:18:10 +00:00
|
|
|
echo "==> Fresh installation, setting up..."
|
|
|
|
rsync -a /app/code/data-orig/ /app/data/
|
|
|
|
php cli/do-install.php \
|
|
|
|
--environment production --default_user admin \
|
|
|
|
--db-type mysql --db-host "${MYSQL_HOST}" \
|
|
|
|
--db-user "${MYSQL_USERNAME}" --db-password "${MYSQL_PASSWORD}" \
|
|
|
|
--db-base "${MYSQL_DATABASE}" --db-prefix "" \
|
|
|
|
--disable_update
|
|
|
|
php cli/create-user.php --user admin --password changeme --language en
|
|
|
|
php cli/actualize-user.php --user admin
|
|
|
|
touch /app/data/.installed
|
|
|
|
echo "==> Done."
|
2017-02-17 08:45:48 +00:00
|
|
|
fi
|
|
|
|
|
2017-06-01 08:46:06 +00:00
|
|
|
|
2019-04-04 17:18:10 +00:00
|
|
|
echo "==> Symlinking log file"
|
2017-06-01 08:46:06 +00:00
|
|
|
rm -f /app/data/users/_/log_api.txt
|
|
|
|
touch /tmp/log_api.txt
|
|
|
|
ln -s /tmp/log_api.txt /app/data/users/_/log_api.txt
|
|
|
|
|
2018-05-31 16:36:49 +00:00
|
|
|
# We have to copy instead of symlinking extensions (see #2)
|
2019-04-04 17:18:10 +00:00
|
|
|
echo "==> Copying packaged extensions"
|
2017-02-18 10:51:44 +00:00
|
|
|
mkdir -p /app/data/extensions
|
|
|
|
for f in $(ls /app/code/extensions-orig); do
|
2018-05-31 16:36:49 +00:00
|
|
|
rm -rf "/app/data/extensions/$f"
|
|
|
|
cp -r "/app/code/extensions-orig/$f" "/app/data/extensions"
|
2017-02-18 10:51:44 +00:00
|
|
|
done
|
|
|
|
|
2017-02-23 14:25:53 +00:00
|
|
|
|
2019-04-04 17:18:10 +00:00
|
|
|
echo "==> Updating config file"
|
2019-01-03 23:32:16 +00:00
|
|
|
php cli/reconfigure.php --default_user admin --base_url "https://${APP_DOMAIN}" \
|
2017-06-01 08:44:20 +00:00
|
|
|
--db-type mysql --db-host "${MYSQL_HOST}" \
|
2017-03-12 09:45:14 +00:00
|
|
|
--db-user "${MYSQL_USERNAME}" --db-password "${MYSQL_PASSWORD}" \
|
|
|
|
--db-base "${MYSQL_DATABASE}" --db-prefix "" \
|
|
|
|
--disable_update
|
2017-02-23 14:25:53 +00:00
|
|
|
|
2017-02-17 08:45:48 +00:00
|
|
|
|
2019-04-04 17:18:10 +00:00
|
|
|
echo "==> Setting permissions"
|
2017-06-01 08:46:06 +00:00
|
|
|
chown -R www-data.www-data /run/php /app/data /tmp/log_api.txt
|
2017-02-17 08:45:48 +00:00
|
|
|
|
2017-02-23 14:25:53 +00:00
|
|
|
|
2019-04-04 17:18:10 +00:00
|
|
|
echo "==> Starting apache"
|
2017-02-17 08:45:48 +00:00
|
|
|
APACHE_CONFDIR="" source /etc/apache2/envvars
|
|
|
|
rm -f "${APACHE_PID_FILE}"
|
|
|
|
exec /usr/sbin/apache2 -DFOREGROUND
|