Improve mediagoblin daemon

This commit is contained in:
Bob Mottram 2016-12-24 17:48:44 +00:00
parent 00972ae5a6
commit 8575817867
1 changed files with 3 additions and 16 deletions

View File

@ -253,8 +253,8 @@ function install_mediagoblin {
apt-get install -yq python python-dev python-lxml python-imaging python-virtualenv
apt-get install -yq automake perl sqlite python-paste python-pastedeploy python-pastescript
apt-get install -yq python3 python3-dev libpython3-dev python3-lxml python3-pil
useradd -c "GNU MediaGoblin system account" -d /var/lib/mediagoblin -m -r -g www-data mediagoblin
groupadd mediagoblin
useradd -c "GNU MediaGoblin system account" -d /var/lib/mediagoblin -m -r -g www-data mediagoblin
usermod --append -G mediagoblin mediagoblin
mkdir -p /var/lib/mediagoblin
chown -hR mediagoblin:www-data /var/lib/mediagoblin
@ -430,8 +430,10 @@ function install_mediagoblin {
echo '[Service]' >> /etc/systemd/system/mediagoblin.service
echo 'Type=simple' >> /etc/systemd/system/mediagoblin.service
echo 'User=mediagoblin' >> /etc/systemd/system/mediagoblin.service
echo 'Group=mediagoblin' >> /etc/systemd/system/mediagoblin.service
echo "WorkingDirectory=$MEDIAGOBLIN_BASE_DIR/mediagoblin/" >> /etc/systemd/system/mediagoblin.service
echo "ExecStart=$MEDIAGOBLIN_BASE_DIR/mediagoblin/lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=$MEDIAGOBLIN_PORT" >> /etc/systemd/system/mediagoblin.service
echo "Environment=MEDIAGOBLIN_CONFIG=$MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini CELERY_ALWAYS_EAGER=true" >> /etc/systemd/system/mediagoblin.service
echo 'Restart=always' >> /etc/systemd/system/mediagoblin.service
echo 'RestartSec=10' >> /etc/systemd/system/mediagoblin.service
echo '' >> /etc/systemd/system/mediagoblin.service
@ -443,26 +445,11 @@ function install_mediagoblin {
su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin/ && bin/gmg adduser --username $MY_USERNAME --password $MY_USERNAME $MEDIAGOBLIN_ADMIN_PASSWORD" - mediagoblin
su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin/ && bin/gmg makeadmin $MY_USERNAME" - mediagoblin
sed -i 's|email_debug_mode.*|email_debug_mode = false|g' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin.ini
sed -i 's|email_debug_mode.*|email_debug_mode = false|g' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
sed -i "s|email_sender_address.*|email_sender_address = \"noreply@${DEFAULT_DOMAIN_NAME}\"|g" $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin.ini
sed -i "s|email_sender_address.*|email_sender_address = \"noreply@${DEFAULT_DOMAIN_NAME}\"|g" $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
sed -i 's|allow_reporting.*|allow_reporting = false|g' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin.ini
sed -i 's|allow_reporting.*|allow_reporting = false|g' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
if ! grep 'email_smtp_host' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin.ini; then
sed -i '/email_sender_address/a email_smtp_host = localhost' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin.ini
else
sed -i 's|email_smtp_host.*|email_smtp_host = localhost|g' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin.ini
fi
if ! grep 'email_smtp_host' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini; then
sed -i '/email_sender_address/a email_smtp_host = localhost' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin.ini
else
sed -i 's|email_smtp_host.*|email_smtp_host = localhost|g' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
fi
if ! grep '[[[skip_transcode]]]' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini; then
echo '[[[skip_transcode]]]' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
echo 'mime_types = video/webm, video/ogg, video/mp4, audio/ogg, application/ogg, application/x-annodex' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini