aboutsummaryrefslogtreecommitdiffstats
path: root/files/usr/local/bin/entrypoint.sh
blob: 337e62a620084b46a9a9b07f68488b6a0d5e5afd (plain) (blame)
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
#!/bin/sh

# Change apache config
#sed -i "s/#ServerName www.example.com:80/ServerName $APACHE_SERVER_NAME/" /etc/apache2/httpd.conf
sed -i "s/ServerAdmin\ you@example.com/ServerAdmin\ $ADMIN_MAIL/" /etc/apache2/httpd.conf
sed -i 's/ServerSignature On/ServerSignature Off/' /etc/apache2/httpd.conf
sed -i 's#/var/www/localhost/htdocs#/var/www/app/htdocs#g' /etc/apache2/httpd.conf
sed -i "s/#APACHE_SERVER_NAME/$APACHE_SERVER_NAME/" /etc/apache2/conf.d/davical.conf

echo -e "$APACHE_USERS" > /etc/apache2/davical.htpasswd

# Modify php.ini settings
sed -i 's/memory_limit = .*/memory_limit = 256M/' /etc/php7/php.ini
sed -i "s/^;date.timezone =$/date.timezone = \"Europe\/Oslo\"/" /etc/php7/php.ini

# Modify davicals config.php
sed -i "s/#APACHE_SERVER_NAME/$APACHE_SERVER_NAME/" /var/www/app/config/config.php
sed -i "s/#ADMIN_MAIL/$ADMIN_MAIL/" /var/www/app/config/config.php
sed -i "s/#SYSTEM_NAME/$SYSTEM_NAME/" /var/www/app/config/config.php
sed -i "s/#DATABASE_NAME/$DATABASE_NAME/" /var/www/app/config/config.php
sed -i "s/#DATABASE_USER/$DATABASE_USER/" /var/www/app/config/config.php
sed -i "s/#DATABASE_PORT/$DATABASE_PORT/" /var/www/app/config/config.php
sed -i "s/#DATABASE_HOST/$DATABASE_HOST/" /var/www/app/config/config.php
sed -i "s/#DATABASE_PASSWORD/$DATABASE_PASSWORD/" /var/www/app/config/config.php

# display logs
tail -F /var/log/apache2/*log &

echo "Clearing any old processes..."
rm -f /run/apache2/apache2.pid
rm -f /run/apache2/httpd.pid

echo "Starting apache..."
httpd -D FOREGROUND