Fixing the tahoe daemon

This commit is contained in:
Bob Mottram 2017-03-05 14:01:44 +00:00
parent fe55f2976e
commit 32cc9f86da
1 changed files with 14 additions and 5 deletions

View File

@ -104,7 +104,7 @@ function upgrade_tahoelafs {
git submodule update --init --recursive
virtualenv venv
venv/bin/pip install --editable .
chown -R tahoelafs:tahoelafs /home/tahoelafs
chown -R tahoelafs:debian-tor /home/tahoelafs
systemctl start tahoelafs
}
@ -132,7 +132,7 @@ function restore_local_tahoelafs {
exit 246833
fi
rm -rf /home/tahoelafs/data
chown -R tahoelafs:tahoelafs /home/tahoelafs
chown -R tahoelafs:debian-tor /home/tahoelafs
systemctl start tahoelafs
echo $"Restore complete"
}
@ -161,7 +161,7 @@ function restore_remote_tahoelafs {
exit 623925
fi
rm -rf /home/tahoelafs/data-old
chown -R tahoelafs:tahoelafs /home/tahoelafs
chown -R tahoelafs:debian-tor /home/tahoelafs
systemctl start tahoelafs
echo $"Restore complete"
}
@ -257,6 +257,7 @@ function install_tahoelafs {
if [ ! -d /home/tahoelafs ]; then
# add a gogs user account
adduser --disabled-login --gecos 'tahoe-lafs' tahoelafs
adduser tahoelafs debian-tor
fi
if [ -d /home/tahoelafs/Maildir ]; then
@ -289,7 +290,7 @@ function install_tahoelafs {
rm /home/tahoelafs/.procmailrc
# set permissions
chown -R tahoelafs:tahoelafs /home/tahoelafs
chown -R tahoelafs:debian-tor /home/tahoelafs
# create the introducer config
su -c "$TAHOE_COMMAND create-introducer -C /home/tahoelafs/data --hide-ip --hostname=127.0.0.1" - tahoelafs
@ -302,6 +303,13 @@ function install_tahoelafs {
TAHOELAFS_ONION_HOSTNAME=$(add_onion_service tahoelafs ${TAHOELAFS_PORT} ${TAHOELAFS_ONION_PORT})
tahoelafs_setup_config $TAHOELAFS_CONFIG
su -c '/home/tahoelafs/tahoelafs/venv/bin/python2 /home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/data' - tahoelafs
TAHOELAFS_INTRODUCER=/home/tahoelafs/data/tahoe-introducer.tac
if [ ! -f $TAHOELAFS_INTRODUCER ]; then
echo $'Introducer file not found'
exit 782253
fi
# create a daemon
TAHOELAFS_DAEMON_FILE=/etc/systemd/system/tahoelafs.service
echo '[Unit]' > $TAHOELAFS_DAEMON_FILE
@ -314,9 +322,10 @@ function install_tahoelafs {
echo "User=tahoelafs" >> $TAHOELAFS_DAEMON_FILE
echo "Group=tahoelafs" >> $TAHOELAFS_DAEMON_FILE
echo "WorkingDirectory=/home/tahoelafs/tahoelafs" >> $TAHOELAFS_DAEMON_FILE
echo "ExecStart=/home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/data; /home/tahoelafs/tahoelafs/venv/bin/tahoe run /home/tahoelafs/data" >> $TAHOELAFS_DAEMON_FILE
echo "ExecStart=/home/tahoelafs/tahoelafs/venv/bin/tahoe run /home/tahoelafs/data" >> $TAHOELAFS_DAEMON_FILE
echo "ExecStop=/home/tahoelafs/tahoelafs/venv/bin/tahoe stop /home/tahoelafs/data" >> $TAHOELAFS_DAEMON_FILE
echo 'Restart=on-failure' >> $TAHOELAFS_DAEMON_FILE
echo 'RestartSec=10' >> $TAHOELAFS_DAEMON_FILE
echo "Environment=\"USER=tahoelafs\" \"HOME=/home/tahoelafs\"" >> $TAHOELAFS_DAEMON_FILE
echo '' >> $TAHOELAFS_DAEMON_FILE
echo '[Install]' >> $TAHOELAFS_DAEMON_FILE