X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=bullseye%2Fsetup_scripts%2Fsetup_microblogpub.sh;h=d0f68c938fca59b0dbc4f72ae9655e73cd28edea;hb=0c72ea778890a63b1d6b2302c94f8f840fca07e8;hp=8066430c3dbffc5728901252df48e2cc6053c7d2;hpb=70a753dc297327e3387471efdd998d25f1bba4dc;p=config
diff --git a/bullseye/setup_scripts/setup_microblogpub.sh b/bullseye/setup_scripts/setup_microblogpub.sh
index 8066430..d0f68c9 100755
--- a/bullseye/setup_scripts/setup_microblogpub.sh
+++ b/bullseye/setup_scripts/setup_microblogpub.sh
@@ -26,21 +26,33 @@ python_version=3.11.1
python_dirname="Python-${python_version}"
su -lc "wget https://www.python.org/ftp/python/${python_version}/${python_dirname}.tgz" plom
su -lc "tar -xvf ${python_dirname}.tgz" plom
-# su -lc "cd /home/plom/${python_dirname} && ./configure --enable-optimizations && make && make test"
su -lc "cd /home/plom/${python_dirname} && ./configure --enable-optimizations && make"
cd /home/plom/${python_dirname}/
make altinstall
cd
-# TODO delete python build dir
+rm -rf /home/plom/${python_dirname}
+
+# Configure/install Poetry and microblog.pub.
su -lc "curl -sSL https://install.python-poetry.org | python3.11" - plom
su -lc "git clone https://git.sr.ht/~tsileo/microblog.pub testing.microblog.pub" - plom
su -lc "poetry config installer.parallel false" - plom
su -lc "cd testing.microblog.pub && poetry install" - plom
-su -lc "cd testing.microblog.pub && poetry run inv configuration-wizard" - plom
-su -lc "cd testing.microblog.pub && poetry run inv migrate-db" - plom
-# VENV_DIR=/home/ubuntu/.cache/pypoetry/virtualenvs/microblogpub-chx-y1oE-py3.10 poetry run supervisord -c misc/supervisord.conf -n
+su -lPc "cd testing.microblog.pub && poetry run inv configuration-wizard" - plom
+su -lPc "cd testing.microblog.pub && poetry run inv migrate-db" - plom
+
+# Set up microblog.pub daemon service.
+venv_dir_path=$( su -lPc "cd testing.microblog.pub && poetry env info --path" - plom)
+venv_dir=$(basename ${venv_dir_path})
+sed -i "s/REPLACE_venv_dir_ECALPER/${venv_dir}/g" /etc/systemd/system/microblogpub.service
+systemctl enable microblogpub.service
+service microblogpub start
# Prepare and start NGINX config.
sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/microblogpub.nginx
ln -s /etc/nginx/sites-available/microblogpub.nginx /etc/nginx/sites-enabled/microblogpub.nginx
service nginx restart
+
+# Setup regular DB pruning
+cp "${config_tree_prefix}/other_files/prune_microblog.sh" /home/plom/
+systemctl enable microblogpub_prune.timer
+systemctl start microblogpub_prune.timer