-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path60-churchcrm
48 lines (40 loc) · 1.98 KB
/
60-churchcrm
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
#!/bin/bash
set +e
if [ ! -f /var/www/html/index.php ]; then
cp /tmp/index.php /var/www/html/index.php
chown www-data:www-data /var/www/html
fi
# populate /web/html if empty
if [ ! -d /var/www/html ]; then
mkdir -p /var/www/html
chown -R www-data:www-data /var/www/html
fi
if [ "$SESSION_SAVE_HANDLER" == "redis" ]; then
REDIS_URL="tcp://$REDIS_HOST:$REDIS_PORT"
if [ ! -z "$REDIS_PASSWORD" ]; then
REDIS_URL="tcp://$REDIS_HOST:$REDIS_PORT?auth=$REDIS_PASSWORD"
fi
sed -i 's/^session.save_handler.*$/session.save_handler = redis/g' $PHP_INI_DIR/php.ini
sed -i "s|^session.save_path.*$|session.save_path=\"${REDIS_URL}\"|g" $PHP_INI_DIR/php.ini
sed -i "s|^;session.save_path.*$|session.save_path=\"${REDIS_URL}\"|g" $PHP_INI_DIR/php.ini
fi
cd /tmp
curl -sOL "$(jq -r ".browser_download_url" < <( curl -s "https://api.github.com/repos/churchCRM/CRM/releases/assets/146429535" ))"
unzip -q *.zip
cp -Rp ./churchcrm/. /var/www/html
rm -R churchcrm
if [ ! -f /var/www/html/Include/Config.php ]; then
# Since we've already set these passwords in the env file, lets just go ahead and put them in the database and skip the setup page.
cp /var/www/html/Include/Config.php.example /var/www/html/Include/Config.php
sed -i "s/ChangeThisToASecureRandomStringBeforeUse/$CHURCHCRM_2FA_SECRET/g" /var/www/html/Include/Config.php
sed -i 's/#$TwoFASecretKey/$TwoFASecretKey/g' /var/www/html/Include/Config.php
sed -i "s/||DB_SERVER_NAME||/$MYSQL_DB_HOST/g" /var/www/html/Include/Config.php
sed -i "s/||DB_SERVER_PORT||/$MYSQL_PORT/g" /var/www/html/Include/Config.php
sed -i "s/||DB_NAME||/$MYSQL_DATABASE/g" /var/www/html/Include/Config.php
sed -i "s/||DB_USER||/$MYSQL_USER/g" /var/www/html/Include/Config.php
sed -i "s/||DB_PASSWORD||/$MYSQL_PASSWORD/g" /var/www/html/Include/Config.php
sed -i "s/||URL||//g" /var/www/html/Include/Config.php
sed -i "s/||ROOT_PATH||//g" /var/www/html/Include/Config.php
fi
chown -R www-data:www-data /var/www/html
docker-php-entrypoint apache2-foreground