home · contact · privacy
Improve microblog.pub setup.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 26 Dec 2022 16:44:40 +0000 (17:44 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 26 Dec 2022 16:44:40 +0000 (17:44 +0100)
bullseye/etc_files/microblogpub/etc/systemd/system/microblogpub.service [new file with mode: 0644]
bullseye/setup_scripts/setup_microblogpub.sh

diff --git a/bullseye/etc_files/microblogpub/etc/systemd/system/microblogpub.service b/bullseye/etc_files/microblogpub/etc/systemd/system/microblogpub.service
new file mode 100644 (file)
index 0000000..7a64014
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=microblog.pub
+
+[Service]
+Type=simple
+User=plom
+WorkingDirectory=/home/plom/testing.microblog.pub/
+ExecStart=/bin/sh -c 'poetry run supervisord -c misc/supervisord.conf -n'
+Environment=VENV_DIR=REPLACE_venv_dir_ECALPER
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
index 8066430c3dbffc5728901252df48e2cc6053c7d2..2c057af13d316d553eb6bfc57ab7946b4f5c2222 100755 (executable)
@@ -26,19 +26,25 @@ 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=$( su -lPc "cd testing.microblog.pub && poetry env info" - plom | grep 'Path' | head -1 | awk '{print $2}')
+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