mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 09:04:12 +02:00
94 lines
No EOL
3.1 KiB
Bash
Executable file
94 lines
No EOL
3.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
touch /var/log/nginx/access.log
|
|
touch /var/log/nginx/error.log
|
|
touch /var/log/cron/owncloud.log
|
|
|
|
mkdir -p /config
|
|
echo "# Options in here overwrite the builtin php.ini" > /config/php.ini
|
|
echo "# xdebug.mode = debug" >> /config/php.ini
|
|
echo "# xdebug.start_with_request = yes" >> /config/php.ini
|
|
chmod 0777 /config/php.ini
|
|
PHP_INI_DIR="$(php --ini | grep 'Scan' | cut -d ' ' -f7 | tr -d '"')"
|
|
ln -s /config/php.ini "$PHP_INI_DIR/zz_extra.ini"
|
|
|
|
HAZE_UID=${HAZE_UID:-www-data}
|
|
HAZE_GID=${HAZE_GID:-www-data}
|
|
|
|
nc-auto-config
|
|
shadow-setup
|
|
|
|
echo "Running as $HAZE_UID:$HAZE_GID"
|
|
|
|
mkdir -p /var/www/html/core/skeleton /var/www/html/build/integration/vendor /var/www/html/build/integration/output /var/www/html/build/integration/work /var/www/html/core/skeleton /var/www/.composer/cache /var/www/html/apps/spreed/tests/integration/vendor/composer
|
|
chown -R "$HAZE_UID":"$HAZE_GID" /var/www/html/data /var/www/html/config
|
|
chown "$HAZE_UID":"$HAZE_GID" /var/www/html/core/skeleton /var/www/html/build/integration/vendor /var/www/html/build/integration/composer.lock /var/www/html/build/integration/output /var/www/html/build/integration/work /var/www/html/core/skeleton /var/www/.composer/cache /var/www/html/apps/spreed/tests/integration/vendor/composer
|
|
|
|
echo "{}" > /var/www/html/build/integration/composer.lock
|
|
|
|
echo "Starting server using $SQL database…"
|
|
|
|
chmod +sx /sbin/sudo
|
|
|
|
mkdir -p /var/log/nginx /tmp /var/run/blackfire
|
|
touch /var/log/nginx/access.log
|
|
touch /var/log/nginx/error.log
|
|
|
|
HAZE_UID=${HAZE_UID:-1000}
|
|
HAZE_GID=${HAZE_GID:-1000}
|
|
|
|
if [ "$(getent group "$HAZE_GID")" ]; then
|
|
groupadd haze
|
|
EXTRA_GROUP=" -G haze"
|
|
else
|
|
groupadd -g "$HAZE_GID" haze
|
|
EXTRA_GROUP=""
|
|
fi
|
|
|
|
useradd -u "$HAZE_UID" -g "$HAZE_GID""$EXTRA_GROUP" haze
|
|
chown -R haze:"$HAZE_GID" /home/haze
|
|
|
|
if [ -f "/var/run/docker.sock" ]; then
|
|
groupadd docker -g "$(stat --format "%g" /var/run/docker.sock)"
|
|
usermod -a -G docker haze
|
|
fi
|
|
|
|
if [ -n "${REDIS_TLS:-}" ]
|
|
then
|
|
cp /etc/supervisor/redis-tls.conf /etc/supervisor/enabled/
|
|
else
|
|
cp /etc/supervisor/redis-plain.conf /etc/supervisor/enabled/
|
|
fi
|
|
|
|
if [ -n "${BLACKFIRE_SERVER_ID:-}" ]
|
|
then
|
|
blackfire agent:config --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN"
|
|
cp /etc/supervisor/blackfire.conf /etc/supervisor/enabled/
|
|
fi
|
|
|
|
if [ -n "${PROXY_BASE:-}" ]; then
|
|
UPSTREAM_DNS=$(cat /etc/resolv.conf | grep nameserver | cut -d' ' -f 2)
|
|
(
|
|
RC=$(sed '/nameserver/d' /etc/resolv.conf)
|
|
echo "$RC" > /etc/resolv.conf
|
|
)
|
|
echo 'nameserver 127.0.0.22' >> /etc/resolv.conf
|
|
|
|
echo "s/UPSTREAM_DNS/${UPSTREAM_DNS}"
|
|
sed -i "s/UPSTREAM_DNS/${UPSTREAM_DNS}/" /etc/dnsmasq.conf
|
|
echo "s/PROXY_BASE/${PROXY_BASE}"
|
|
sed -i "s/PROXY_BASE/${PROXY_BASE}/" /etc/dnsmasq.conf
|
|
echo "s/HOST_IP/${HOST_IP}"
|
|
sed -i "s/HOST_IP/${HOST_IP}/" /etc/dnsmasq.conf
|
|
|
|
cp /etc/supervisor/dnsmasq.conf /etc/supervisor/enabled/
|
|
fi
|
|
|
|
if [ -n "${FRANKENPHP:-}" ]; then
|
|
cp /etc/supervisor/frankenphp.conf /etc/supervisor/enabled/
|
|
else
|
|
cp /etc/supervisor/php-fpm.conf /etc/supervisor/enabled/
|
|
cp /etc/supervisor/nginx.conf /etc/supervisor/enabled/
|
|
fi
|
|
|
|
exec supervisord -c /etc/supervisor/supervisord.conf |