1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 09:04:12 +02:00
haze/nix/image/bootstrap.sh

69 lines
No EOL
2.3 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
exec supervisord -c /etc/supervisor/supervisord.conf