This repository has been archived on 2021-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
docker-peertube/rootfs/usr/local/bin/startup
2017-11-03 13:39:41 +00:00

34 lines
1.3 KiB
Bash
Executable file

#!/bin/sh
#addgroup --gid ${GID} peertube && adduser --disabled-password --shell /bin/sh --gid ${GID} --uid ${UID} --gecos "" peertube
groupadd -g ${GID} peertube && useradd -u ${UID} -M -g ${GID} peertube
sed -i -e 's|<https>|'${HTTPS}'|' \
-e 's|<hostname>|'${HOSTNAME}'|' \
-e 's|<port>|'${PORT}'|' \
-e 's|<database_host>|'${DATABASE_HOST}'|' \
-e 's|<database_port>|'${DATABASE_PORT}'|' \
-e 's|<database_username>|'${DATABASE_USERNAME}'|' \
-e 's|<database_password>|'${DATABASE_PASSWORD}'|' \
-e 's|<admin_email>|'${ADMIN_EMAIL}'|' \
-e 's|<signup_enabled>|'${SIGNUP_ENABLE}'|' \
-e 's|<transcoding_enable>|'${TRANSCODING_ENABLE}'|' \
-e 's|<transcoding_threads>|'${TRANSCODING_THREADS}'|' \
-e 's|<cache_size>|'${CACHE_SIZE}'|' \
-e 's|<signup_limit>|'${SIGNUP_LIMIT}'|' \
-e 's|<resolution_280>|'${RESOLUTION_280}'|' \
-e 's|<resolution_360>|'${RESOLUTION_360}'|' \
-e 's|<resolution_480>|'${RESOLUTION_480}'|' \
-e 's|<resolution_720>|'${RESOLUTION_720}'|' \
-e 's|<resolution_1080>|'${RESOLUTION_1080}'|' /PeerTube/config/production.yaml
sed -i -e 's|<body_size>|'${BODY_SIZE}'|' /etc/nginx/sites-enabled/peertube.conf
chown -R $UID:$GID ./
nginx
if [ $# -eq 0 ]; then
su - peertube -c "cd /PeerTube && NODE_ENV=production npm start"
else
su - peertube -c "cd /PeerTube && NODE_ENV=production npm $#"
fi