remove old patches and fix the moa worker

This commit is contained in:
Charlotte 🦝 Delenk 2022-11-03 13:24:43 +01:00
parent 2703a886bd
commit a6867616b6
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122

View file

@ -64,10 +64,10 @@ in
buildPhase = '' buildPhase = ''
echo "#!/bin/sh" > start.sh echo "#!/bin/sh" > start.sh
echo "cd $out" >> start.sh echo "cd $out" >> start.sh
echo "${moa-env}/bin/python -m moa.models" >> start.sh
cp start.sh start-worker.sh cp start.sh start-worker.sh
echo "${moa-env}/bin/python -m moa.models" >> start.sh
mv start.sh start-app.sh mv start.sh start-app.sh
echo "while true; do ${moa-env}/bin/python -m moa.worker; sleep 60; done" >> start-worker.sh echo "exec ${moa-env}/bin/python -m moa.worker" >> start-worker.sh
echo "exec ${moa-env}/bin/python app.py" >> start-app.sh echo "exec ${moa-env}/bin/python app.py" >> start-app.sh
chmod +x start-*.sh chmod +x start-*.sh
''; '';
@ -76,12 +76,6 @@ in
cp -rv $src $out cp -rv $src $out
chmod -R +w $out chmod -R +w $out
cp start-*.sh $out cp start-*.sh $out
sed -i 's/, reflect=True//' $out/moa/models.py
substituteInPlace $out/app.py --replace "from authlib.integrations._client import MissingRequestTokenError" "class MissingRequestTokenError(Exception): pass"
substituteInPlace $out/moa/worker.py --replace "Path(f'" "Path(f'/tmp/moa_"
substituteInPlace $out/app.py --replace "logHandler = logging.FileHandler('logs/app.log')" "import sys; logHandler = logging.StreamHandler(sys.stderr)"
substituteInPlace $out/moa/worker.py --replace "sqlite" "postgresql"
substituteInPlace $out/app.py --replace "app.run()" "app.run(host='::1')"
''; '';
meta = { meta = {
description = "Mastodon-Twitter crossposter"; description = "Mastodon-Twitter crossposter";