Browse Source

introduce systemd-unit for indexer

The indexer is launched by systemd when the crawler finishes.
master
René Wagner 4 months ago
parent
commit
b119e8b6d8
  1. 5
      README.md
  2. 3
      infra/gus-crawl.service
  3. 13
      infra/gus-index.service

5
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`

3
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

13
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
Loading…
Cancel
Save