commit 44812ee8b57a1adee542c8877cdc4bafce3ec546
parent d9fc0b3d0b0185a1c7f875f12b6fe6b9da51f4fd
Author: René Wagner <rwagner@rw-net.de>
Date: Thu, 4 Feb 2021 21:05:38 +0100
introduce systemd-unit for indexer
The indexer is launched by systemd when the crawler finishes.
When launched through the unit, the output to stdout is
redirected to systemd-journald. There's no need for additional
file output, thus it has been removed.
Signed-off-by: Natalie Pendragon <natpen@natpen.net>
Diffstat:
4 files changed, 19 insertions(+), 12 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
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
diff --git a/logging.ini b/logging.ini
@@ -2,14 +2,14 @@
keys=root
[handlers]
-keys=consoleHandler,fileHandler
+keys=consoleHandler
[formatters]
keys=plain
[logger_root]
level=NOTSET
-handlers=consoleHandler,fileHandler
+handlers=consoleHandler
[handler_consoleHandler]
class=StreamHandler
@@ -17,11 +17,5 @@ level=INFO
formatter=plain
args=(sys.stdout,)
-[handler_fileHandler]
-class=FileHandler
-level=DEBUG
-formatter=plain
-args=("gus.log",)
-
[formatter_plain]
format=%(asctime)s %(module)-8s %(levelname)-8s %(message)s