2021-01-25 13:36:16 +01:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# forward request and error logs to docker log collector
|
|
|
|
ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log && \
|
|
|
|
ln -sf /dev/stdout /var/log/nginx/mediacms.io.access.log && ln -sf /dev/stderr /var/log/nginx/mediacms.io.error.log
|
|
|
|
cp /home/mediacms.io/mediacms/deploy/docker/local_settings.py /home/mediacms.io/mediacms/cms/local_settings.py
|
|
|
|
|
2021-02-17 21:32:18 +01:00
|
|
|
mkdir -p /home/mediacms.io/mediacms/{logs,pids,media_files/hls}
|
2021-01-25 13:36:16 +01:00
|
|
|
touch /home/mediacms.io/mediacms/logs/debug.log
|
|
|
|
|
2021-02-18 20:25:40 +01:00
|
|
|
# Remove any dangling pids
|
|
|
|
rm -rf /home/mediacms.io/mediacms/pids/*
|
|
|
|
|
2021-01-25 13:36:16 +01:00
|
|
|
chown -R www-data. /home/mediacms.io/
|
|
|
|
|
|
|
|
TARGET_GID=$(stat -c "%g" /home/mediacms.io/mediacms/)
|
|
|
|
|
|
|
|
EXISTS=$(cat /etc/group | grep $TARGET_GID | wc -l)
|
|
|
|
|
|
|
|
# Create new group using target GID and add www-data user
|
|
|
|
if [ $EXISTS == "0" ]; then
|
|
|
|
groupadd -g $TARGET_GID tempgroup
|
|
|
|
usermod -a -G tempgroup www-data
|
|
|
|
else
|
|
|
|
# GID exists, find group name and add
|
|
|
|
GROUP=$(getent group $TARGET_GID | cut -d: -f1)
|
|
|
|
usermod -a -G $GROUP www-data
|
|
|
|
fi
|
|
|
|
|
|
|
|
chmod +x /home/mediacms.io/mediacms/deploy/docker/start.sh /home/mediacms.io/mediacms/deploy/docker/prestart.sh
|
|
|
|
|
2021-01-29 19:38:35 +01:00
|
|
|
exec "$@"
|