geminispace.info

gemini search engine
git clone https://git.clttr.info/geminispace.info.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit b119e8b6d8186b069033f6aa1efaf05fdd22034b
parent 4edb3fc7d421a10a027aef7edd13c02fa1f30329
Author: René Wagner <rwagner@rw-net.de>
Date:   Sun, 31 Jan 2021 21:08:02 +0100

introduce systemd-unit for indexer

The indexer is launched by systemd when the crawler finishes.

Diffstat:
MREADME.md | 5++---
Minfra/gus-crawl.service | 3++-
Ainfra/gus-index.service | 13+++++++++++++
3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md @@ -36,14 +36,13 @@ Now you'll have created `index.new` directory, rename it to `index`. 2. Run: `poetry run build_index` 3. Restart frontend -### Running the crawl in production with systemd +### Running the crawl & indexer in production with systemd -1. update `infra/gus-crawl.service` to match your needs (directory, user) +1. update `infra/gus-crawl.service` & `infra/gus-index.service` to match your needs (directory, user) 2. update `infra/gus-crawl.timer` to match your needs (OnCalendar definition) 3. copy both files to `/etc/systemd/system/` 4. run `systemctl enable gus-crawl.timer` & `systemctl start gus-crawl.timer` to start the timer - ## Running the test suite Run: `poetry run pytest` diff --git a/infra/gus-crawl.service b/infra/gus-crawl.service @@ -1,4 +1,4 @@ -# /etc/systemd/system/gus.service +# /etc/systemd/system/gus-crawl.service [Unit] Description=Gemini Universal Search - Crawler @@ -10,3 +10,4 @@ Type=oneshot WorkingDirectory=/home/gus/code/gus Environment="PYTHONUNBUFFERED=1" ExecStart=/home/gus/.poetry/bin/poetry run crawl +ExecStopPost=systemctl start gus-index --no-block diff --git a/infra/gus-index.service b/infra/gus-index.service @@ -0,0 +1,13 @@ +# /etc/systemd/system/gus-index.service + +[Unit] +Description=Gemini Universal Search - Indexer + +[Service] +User=gus +Group=gus +Type=oneshot +WorkingDirectory=/home/gus/code/gus +Environment="PYTHONUNBUFFERED=1" +ExecStart=/home/gus/.poetry/bin/poetry run build_index +ExecStopPost=systemctl restart gus